Wire up the default toggle button (replaces the old menu)
This commit is contained in:
parent
fab8d8d524
commit
4c3acd35e5
|
@ -27,8 +27,10 @@ DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Gl
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
muteToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &DeviceWidget::onMuteToggleButton));
|
muteToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &DeviceWidget::onMuteToggleButton));
|
||||||
|
defaultToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &DeviceWidget::onDefaultToggleButton));
|
||||||
|
|
||||||
for (unsigned i = 0; i < PA_CHANNELS_MAX; i++)
|
for (unsigned i = 0; i < PA_CHANNELS_MAX; i++)
|
||||||
channelWidgets[i] = NULL;
|
channelWidgets[i] = NULL;
|
||||||
|
@ -88,6 +90,12 @@ void DeviceWidget::onMuteToggleButton() {
|
||||||
channelWidgets[i]->set_sensitive(!muteToggleButton->get_active());
|
channelWidgets[i]->set_sensitive(!muteToggleButton->get_active());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceWidget::onDefaultToggleButton() {
|
||||||
|
/* Prevent the button being untoggled */
|
||||||
|
if (defaultToggleButton->get_active())
|
||||||
|
defaultToggleButton->set_sensitive(false);
|
||||||
|
}
|
||||||
|
|
||||||
bool DeviceWidget::timeoutEvent() {
|
bool DeviceWidget::timeoutEvent() {
|
||||||
executeVolumeUpdate();
|
executeVolumeUpdate();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
void setVolume(const pa_cvolume &volume, bool force = false);
|
void setVolume(const pa_cvolume &volume, bool force = false);
|
||||||
virtual void updateChannelVolume(int channel, pa_volume_t v);
|
virtual void updateChannelVolume(int channel, pa_volume_t v);
|
||||||
|
|
||||||
Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
|
Gtk::ToggleButton *lockToggleButton, *muteToggleButton, *defaultToggleButton;
|
||||||
|
|
||||||
pa_channel_map channelMap;
|
pa_channel_map channelMap;
|
||||||
pa_cvolume volume;
|
pa_cvolume volume;
|
||||||
|
@ -43,6 +43,7 @@ public:
|
||||||
ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
|
ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
|
||||||
|
|
||||||
virtual void onMuteToggleButton();
|
virtual void onMuteToggleButton();
|
||||||
|
virtual void onDefaultToggleButton();
|
||||||
|
|
||||||
sigc::connection timeoutConnection;
|
sigc::connection timeoutConnection;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue