Skip to content
Commits on Source (5)
  • Tanu Kaskinen's avatar
    move some widget initializations from MinimalStreamWidget to subclasses · c760edaf
    Tanu Kaskinen authored
    Current Glade versions want object IDs to be unique, but currently
    pavucontrol.glade shares some IDs between the top-level windows. I guess
    this used to be OK in the past, and the "interface-naming-policy
    toplevel-contextual" comment in the beginning of the .glade file
    probably has something to do with this. I want to update the .glade file
    to be easy to work with current Glade versions, so I will remove the
    duplicated object IDs.
    
    The first IDs to change are the "channelsVBox", "nameLabel",
    "boldNameLabel" and "iconImage" IDs. These were used by
    MinimalStreamWidget to create widgets for both devices and streams, but
    now that the IDs are different for devices and streams, the widgets have
    to be created by the subclasses.
    
    MinimalStreamWidget doesn't need the Gtk::Builder in its constructor any
    more, so remove that parameter to avoid warnings about an unused
    variable.
    c760edaf
  • Tanu Kaskinen's avatar
    rename more objects in the quest to get rid of duplicate IDs · 0047261f
    Tanu Kaskinen authored
    Continuing from the previous patch, this patch renames more objects in
    pavucontrol.glade to get rid of duplicate IDs. nameLabel and iconImage
    actually weren't any more duplicates, because the previous patch renamed
    the corresponding IDs for devices and streams, but the card related
    objects were renamed nevertheless to be more descriptive and consistent
    with the IDs used by the device and stream widgets.
    0047261f
  • Tanu Kaskinen's avatar
    pavucontrol.glade: object renames automatically done by Glade · 0fa19691
    Tanu Kaskinen authored
    When opening pavucontrol.glade with Glade and saving it without any
    manual changes, Glade does these object rename to get rid of duplicate
    IDs. None of these are referenced by the code, so the renames are
    harmless.
    0fa19691
  • Tanu Kaskinen's avatar
    pavucontrol.glade: changes automatically done by Glade · 577246f1
    Tanu Kaskinen authored
    When opening pavucontrol.glade in Glade 3.22.1 and saving the file
    without doing any manual changes, these changes are made to the file.
    The changes seem harmless, so let's apply them to avoid unnecessary
    clutter appearing when doing more important changes in the future.
    577246f1
  • Tanu Kaskinen's avatar
    drop gtk2 support · dfeabf08
    Tanu Kaskinen authored
    When opening pavucontrol.glade with Glade 3.22.1, this message was
    shown:
    
        pavucontrol.glade targets Gtk+ 2.16
    
        But this version of Glade is for GTK+ 3 only.
        Make sure you can run this project with Glade 3.8 with no deprecated
        widgets first.
    
    I think it's best to just drop the gtk2 support.
    dfeabf08
......@@ -41,26 +41,7 @@ AC_TYPE_SIGNAL
AC_HEADER_STDC
AX_CXX_COMPILE_STDCXX_11
AC_ARG_ENABLE(gtk3,
[AS_HELP_STRING([--disable-gtk3],
[Whether to build or not against gtk3 [default=yes]])],
[enable_gtk3=$enableval],
[enable_gtk3="yes"])
if test "x$enable_gtk3" = "xyes"; then
gtkmm_ver="3.0"
gtkmm_min_ver="2.99"
canberra_ver="3"
AC_DEFINE([HAVE_GTK3], [1], [Define if we are building against gtk3])
echo "***"
echo "*** Attempting build in GTK3 mode. Use --disable-gtk3 to build for GTK2"
echo "***"
else
gtkmm_ver="2.4"
gtkmm_min_ver="2.16"
canberra_ver=""
fi
PKG_CHECK_MODULES(GUILIBS, [ gtkmm-$gtkmm_ver >= $gtkmm_min_ver sigc++-2.0 libcanberra-gtk$canberra_ver >= 0.16 ])
PKG_CHECK_MODULES(GUILIBS, [ gtkmm-3.0 >= 3.0 sigc++-2.0 libcanberra-gtk3 >= 0.16 ])
AC_SUBST(GUILIBS_CFLAGS)
AC_SUBST(GUILIBS_LIBS)
......
......@@ -30,9 +30,9 @@
CardWidget::CardWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
Gtk::VBox(cobject) {
x->get_widget("nameLabel", nameLabel);
x->get_widget("cardNameLabel", nameLabel);
x->get_widget("profileList", profileList);
x->get_widget("iconImage", iconImage);
x->get_widget("cardIconImage", iconImage);
treeModel = Gtk::ListStore::create(profileModel);
profileList->set_model(treeModel);
......
......@@ -32,11 +32,17 @@
/*** DeviceWidget ***/
DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
MinimalStreamWidget(cobject, x),
MinimalStreamWidget(cobject),
offsetButtonEnabled(false) {
x->get_widget("lockToggleButton", lockToggleButton);
x->get_widget("muteToggleButton", muteToggleButton);
/* MinimalStreamWidget member variables. */
x->get_widget("deviceChannelsVBox", channelsVBox);
x->get_widget("deviceNameLabel", nameLabel);
x->get_widget("deviceBoldNameLabel", boldNameLabel);
x->get_widget("deviceIconImage", iconImage);
x->get_widget("deviceLockToggleButton", lockToggleButton);
x->get_widget("deviceMuteToggleButton", muteToggleButton);
x->get_widget("defaultToggleButton", defaultToggleButton);
x->get_widget("portSelect", portSelect);
x->get_widget("portList", portList);
......@@ -64,18 +70,15 @@ DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Buil
for (unsigned i = 0; i < PA_CHANNELS_MAX; i++)
channelWidgets[i] = NULL;
#ifdef HAVE_GTK3
offsetAdjustment = Gtk::Adjustment::create(0.0, -2000.0, 5000.0, 10.0, 50.0, 0.0);
offsetButton->configure(offsetAdjustment, 0, 2);
#else
offsetAdjustment = new Gtk::Adjustment(0.0, -2000.0, 5000.0, 10.0, 50.0, 0.0);
offsetButton->configure(*offsetAdjustment, 0.0, 2);
#endif /* HAVE_GTK3 */
}
void DeviceWidget::init(MainWindow* mainWindow, Glib::ustring deviceType) {
mpMainWindow = mainWindow;
mDeviceType = deviceType;
MinimalStreamWidget::init();
}
void DeviceWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
......
......@@ -101,11 +101,7 @@ protected:
Gtk::HBox *portSelect, *offsetSelect;
Gtk::ComboBox *portList;
Glib::RefPtr<Gtk::ListStore> treeModel;
#ifdef HAVE_GTK3
Glib::RefPtr<Gtk::Adjustment> offsetAdjustment;
#else
Gtk::Adjustment *offsetAdjustment;
#endif /* HAVE_GTK3 */
private:
Glib::ustring mDeviceType;
......
......@@ -196,11 +196,7 @@ MainWindow* MainWindow::create(bool maximize) {
void MainWindow::on_realize() {
Gtk::Window::on_realize();
#ifdef HAVE_GTK3
get_window()->set_cursor(Gdk::Cursor::create(Gdk::WATCH));
#else
get_window()->set_cursor(Gdk::Cursor(Gdk::WATCH));
#endif /* HAVE_GTK3 */
}
bool MainWindow::on_key_press_event(GdkEventKey* event) {
......
......@@ -25,23 +25,31 @@
#include "minimalstreamwidget.h"
/*** MinimalStreamWidget ***/
MinimalStreamWidget::MinimalStreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
MinimalStreamWidget::MinimalStreamWidget(BaseObjectType* cobject) :
Gtk::VBox(cobject),
channelsVBox(NULL),
nameLabel(NULL),
boldNameLabel(NULL),
iconImage(NULL),
peakProgressBar(),
lastPeak(0),
peak(NULL),
updating(false),
volumeMeterEnabled(false),
volumeMeterVisible(true) {
}
x->get_widget("channelsVBox", channelsVBox);
x->get_widget("nameLabel", nameLabel);
x->get_widget("boldNameLabel", boldNameLabel);
x->get_widget("iconImage", iconImage);
void MinimalStreamWidget::init() {
/* Set up the peak meter. This is not done in the constructor, because
* channelsVBox is initialized by the subclasses, so it's not yet available
* in the constructor. */
peakProgressBar.set_size_request(-1, 10);
channelsVBox->pack_end(peakProgressBar, false, false);
/* XXX: Why is the peak meter hidden by default? Maybe the idea is that if
* setting up the monitoring stream fails for whatever reason, then we
* shouldn't show the peak meter at all. */
peakProgressBar.hide();
}
......
......@@ -25,11 +25,15 @@
class MinimalStreamWidget : public Gtk::VBox {
public:
MinimalStreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
MinimalStreamWidget(BaseObjectType* cobject);
/* Subclass constructors are expected to initialize these variables.
* MinimalStreamWidget can't initialize these, because the glade object
* id's depend on the subclass type. */
Gtk::VBox *channelsVBox;
Gtk::Label *nameLabel, *boldNameLabel;
Gtk::Image *iconImage;
Gtk::ProgressBar peakProgressBar;
double lastPeak;
pa_stream *peak;
......@@ -45,6 +49,11 @@ public:
void updatePeak(double v);
void setVolumeMeterVisible(bool v);
protected:
/* Subclasses must call this after the constructor to finalize the initial
* layout. */
virtual void init();
private :
bool volumeMeterVisible;
......
This diff is collapsed.
......@@ -30,11 +30,17 @@
/*** StreamWidget ***/
StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
MinimalStreamWidget(cobject, x),
MinimalStreamWidget(cobject),
mpMainWindow(NULL) {
x->get_widget("lockToggleButton", lockToggleButton);
x->get_widget("muteToggleButton", muteToggleButton);
/* MinimalStreamWidget member variables. */
x->get_widget("streamChannelsVBox", channelsVBox);
x->get_widget("streamNameLabel", nameLabel);
x->get_widget("streamBoldNameLabel", boldNameLabel);
x->get_widget("streamIconImage", iconImage);
x->get_widget("streamLockToggleButton", lockToggleButton);
x->get_widget("streamMuteToggleButton", muteToggleButton);
x->get_widget("directionLabel", directionLabel);
x->get_widget("deviceButton", deviceButton);
......@@ -55,6 +61,8 @@ StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Buil
void StreamWidget::init(MainWindow* mainWindow) {
mpMainWindow = mainWindow;
MinimalStreamWidget::init();
}
bool StreamWidget::onContextTriggerEvent(GdkEventButton* event) {
......