move some widget initializations from MinimalStreamWidget to subclasses
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.
This commit is contained in:
parent
d3b3bee378
commit
c760edaf24
|
@ -32,9 +32,15 @@
|
||||||
|
|
||||||
/*** DeviceWidget ***/
|
/*** DeviceWidget ***/
|
||||||
DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
|
DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
|
||||||
MinimalStreamWidget(cobject, x),
|
MinimalStreamWidget(cobject),
|
||||||
offsetButtonEnabled(false) {
|
offsetButtonEnabled(false) {
|
||||||
|
|
||||||
|
/* 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("lockToggleButton", lockToggleButton);
|
x->get_widget("lockToggleButton", lockToggleButton);
|
||||||
x->get_widget("muteToggleButton", muteToggleButton);
|
x->get_widget("muteToggleButton", muteToggleButton);
|
||||||
x->get_widget("defaultToggleButton", defaultToggleButton);
|
x->get_widget("defaultToggleButton", defaultToggleButton);
|
||||||
|
@ -76,6 +82,8 @@ DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Buil
|
||||||
void DeviceWidget::init(MainWindow* mainWindow, Glib::ustring deviceType) {
|
void DeviceWidget::init(MainWindow* mainWindow, Glib::ustring deviceType) {
|
||||||
mpMainWindow = mainWindow;
|
mpMainWindow = mainWindow;
|
||||||
mDeviceType = deviceType;
|
mDeviceType = deviceType;
|
||||||
|
|
||||||
|
MinimalStreamWidget::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
|
void DeviceWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
|
||||||
|
|
|
@ -25,23 +25,31 @@
|
||||||
#include "minimalstreamwidget.h"
|
#include "minimalstreamwidget.h"
|
||||||
|
|
||||||
/*** MinimalStreamWidget ***/
|
/*** MinimalStreamWidget ***/
|
||||||
MinimalStreamWidget::MinimalStreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
|
MinimalStreamWidget::MinimalStreamWidget(BaseObjectType* cobject) :
|
||||||
Gtk::VBox(cobject),
|
Gtk::VBox(cobject),
|
||||||
|
channelsVBox(NULL),
|
||||||
|
nameLabel(NULL),
|
||||||
|
boldNameLabel(NULL),
|
||||||
|
iconImage(NULL),
|
||||||
peakProgressBar(),
|
peakProgressBar(),
|
||||||
lastPeak(0),
|
lastPeak(0),
|
||||||
peak(NULL),
|
peak(NULL),
|
||||||
updating(false),
|
updating(false),
|
||||||
volumeMeterEnabled(false),
|
volumeMeterEnabled(false),
|
||||||
volumeMeterVisible(true) {
|
volumeMeterVisible(true) {
|
||||||
|
}
|
||||||
|
|
||||||
x->get_widget("channelsVBox", channelsVBox);
|
void MinimalStreamWidget::init() {
|
||||||
x->get_widget("nameLabel", nameLabel);
|
/* Set up the peak meter. This is not done in the constructor, because
|
||||||
x->get_widget("boldNameLabel", boldNameLabel);
|
* channelsVBox is initialized by the subclasses, so it's not yet available
|
||||||
x->get_widget("iconImage", iconImage);
|
* in the constructor. */
|
||||||
|
|
||||||
peakProgressBar.set_size_request(-1, 10);
|
peakProgressBar.set_size_request(-1, 10);
|
||||||
channelsVBox->pack_end(peakProgressBar, false, false);
|
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();
|
peakProgressBar.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,15 @@
|
||||||
|
|
||||||
class MinimalStreamWidget : public Gtk::VBox {
|
class MinimalStreamWidget : public Gtk::VBox {
|
||||||
public:
|
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::VBox *channelsVBox;
|
||||||
Gtk::Label *nameLabel, *boldNameLabel;
|
Gtk::Label *nameLabel, *boldNameLabel;
|
||||||
Gtk::Image *iconImage;
|
Gtk::Image *iconImage;
|
||||||
|
|
||||||
Gtk::ProgressBar peakProgressBar;
|
Gtk::ProgressBar peakProgressBar;
|
||||||
double lastPeak;
|
double lastPeak;
|
||||||
pa_stream *peak;
|
pa_stream *peak;
|
||||||
|
@ -45,6 +49,11 @@ public:
|
||||||
void updatePeak(double v);
|
void updatePeak(double v);
|
||||||
void setVolumeMeterVisible(bool v);
|
void setVolumeMeterVisible(bool v);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/* Subclasses must call this after the constructor to finalize the initial
|
||||||
|
* layout. */
|
||||||
|
virtual void init();
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool volumeMeterVisible;
|
bool volumeMeterVisible;
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="iconImage">
|
<object class="GtkImage" id="deviceIconImage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="stock">gtk-missing-image</property>
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
@ -238,7 +238,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="boldNameLabel">
|
<object class="GtkLabel" id="deviceBoldNameLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="use_markup">True</property>
|
<property name="use_markup">True</property>
|
||||||
|
@ -250,7 +250,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="nameLabel">
|
<object class="GtkLabel" id="deviceNameLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
|
@ -393,7 +393,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="channelsVBox">
|
<object class="GtkVBox" id="deviceChannelsVBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
@ -1437,7 +1437,7 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="iconImage">
|
<object class="GtkImage" id="streamIconImage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="stock">gtk-missing-image</property>
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
@ -1454,7 +1454,7 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">2</property>
|
<property name="spacing">2</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="boldNameLabel">
|
<object class="GtkLabel" id="streamBoldNameLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="use_markup">True</property>
|
<property name="use_markup">True</property>
|
||||||
|
@ -1466,7 +1466,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="nameLabel">
|
<object class="GtkLabel" id="streamNameLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
|
@ -1583,7 +1583,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="channelsVBox">
|
<object class="GtkVBox" id="streamChannelsVBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
|
|
@ -30,9 +30,15 @@
|
||||||
|
|
||||||
/*** StreamWidget ***/
|
/*** StreamWidget ***/
|
||||||
StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
|
StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
|
||||||
MinimalStreamWidget(cobject, x),
|
MinimalStreamWidget(cobject),
|
||||||
mpMainWindow(NULL) {
|
mpMainWindow(NULL) {
|
||||||
|
|
||||||
|
/* 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("lockToggleButton", lockToggleButton);
|
x->get_widget("lockToggleButton", lockToggleButton);
|
||||||
x->get_widget("muteToggleButton", muteToggleButton);
|
x->get_widget("muteToggleButton", muteToggleButton);
|
||||||
x->get_widget("directionLabel", directionLabel);
|
x->get_widget("directionLabel", directionLabel);
|
||||||
|
@ -55,6 +61,8 @@ StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Buil
|
||||||
|
|
||||||
void StreamWidget::init(MainWindow* mainWindow) {
|
void StreamWidget::init(MainWindow* mainWindow) {
|
||||||
mpMainWindow = mainWindow;
|
mpMainWindow = mainWindow;
|
||||||
|
|
||||||
|
MinimalStreamWidget::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StreamWidget::onContextTriggerEvent(GdkEventButton* event) {
|
bool StreamWidget::onContextTriggerEvent(GdkEventButton* event) {
|
||||||
|
|
Loading…
Reference in New Issue