diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pavucontrol.cc | 46 | ||||
-rw-r--r-- | src/pavucontrol.glade | 30 |
2 files changed, 45 insertions, 31 deletions
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc index 6271058..0367e72 100644 --- a/src/pavucontrol.cc +++ b/src/pavucontrol.cc @@ -74,6 +74,12 @@ public: ChannelWidget *channelWidgets[PA_CHANNELS_MAX]; virtual void onMuteToggleButton(); + + sigc::connection timeoutConnection; + + bool timeoutEvent(); + + virtual void executeVolumeUpdate(); }; class SinkWidget : public StreamWidget { @@ -81,9 +87,9 @@ public: SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x); static SinkWidget* create(); - virtual void updateChannelVolume(int channel, pa_volume_t v); virtual void onMuteToggleButton(); uint32_t index; + virtual void executeVolumeUpdate(); }; class SourceWidget : public StreamWidget { @@ -91,9 +97,9 @@ public: SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x); static SourceWidget* create(); - virtual void updateChannelVolume(int channel, pa_volume_t v); virtual void onMuteToggleButton(); uint32_t index; + virtual void executeVolumeUpdate(); }; class SinkInputWidget : public StreamWidget { @@ -101,8 +107,8 @@ public: SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x); static SinkInputWidget* create(); - virtual void updateChannelVolume(int channel, pa_volume_t v); uint32_t index; + virtual void executeVolumeUpdate(); }; class MainWindow : public Gtk::Window { @@ -169,7 +175,7 @@ void ChannelWidget::setVolume(pa_volume_t volume) { volumeLabel->set_text(txt); if (v > 100) - v = 1000; + v = 100; volumeScaleEnabled = false; volumeScale->set_value(v); @@ -242,6 +248,11 @@ void StreamWidget::updateChannelVolume(int channel, pa_volume_t v) { volume.values[i] = v; } else volume.values[channel] = v; + + setVolume(volume); + + if (timeoutConnection.empty()) + timeoutConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &StreamWidget::timeoutEvent), 50); } void StreamWidget::onMuteToggleButton() { @@ -251,6 +262,14 @@ void StreamWidget::onMuteToggleButton() { channelWidgets[i]->set_sensitive(!muteToggleButton->get_active()); } +bool StreamWidget::timeoutEvent() { + executeVolumeUpdate(); + return false; +} + +void StreamWidget::executeVolumeUpdate() { +} + SinkWidget::SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : StreamWidget(cobject, x) { } @@ -262,10 +281,9 @@ SinkWidget* SinkWidget::create() { return w; } -void SinkWidget::updateChannelVolume(int channel, pa_volume_t v) { - StreamWidget::updateChannelVolume(channel, v); - +void SinkWidget::executeVolumeUpdate() { pa_operation* o; + if (!(o = pa_context_set_sink_volume_by_index(context, index, &volume, NULL, NULL))) { show_error("pa_context_set_sink_volume_by_index() failed"); return; @@ -284,7 +302,6 @@ void SinkWidget::onMuteToggleButton() { } pa_operation_unref(o); - } SourceWidget::SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : @@ -298,17 +315,15 @@ SourceWidget* SourceWidget::create() { return w; } -void SourceWidget::updateChannelVolume(int channel, pa_volume_t v) { - StreamWidget::updateChannelVolume(channel, v); - +void SourceWidget::executeVolumeUpdate() { pa_operation* o; + if (!(o = pa_context_set_source_volume_by_index(context, index, &volume, NULL, NULL))) { show_error("pa_context_set_source_volume_by_index() failed"); return; } pa_operation_unref(o); - return; } void SourceWidget::onMuteToggleButton() { @@ -319,7 +334,7 @@ void SourceWidget::onMuteToggleButton() { show_error("pa_context_set_source_mute_by_index() failed"); return; } - + pa_operation_unref(o); } @@ -334,10 +349,9 @@ SinkInputWidget* SinkInputWidget::create() { return w; } -void SinkInputWidget::updateChannelVolume(int channel, pa_volume_t v) { - StreamWidget::updateChannelVolume(channel, v); - +void SinkInputWidget::executeVolumeUpdate() { pa_operation* o; + if (!(o = pa_context_set_sink_input_volume(context, index, &volume, NULL, NULL))) { show_error("pa_context_set_sink_input_volume() failed"); return; diff --git a/src/pavucontrol.glade b/src/pavucontrol.glade index 6283f06..5aa2676 100644 --- a/src/pavucontrol.glade +++ b/src/pavucontrol.glade @@ -127,7 +127,7 @@ <property name="enable_popup">False</property> <child> - <widget class="GtkScrolledWindow" id="scrolledwindow8"> + <widget class="GtkScrolledWindow" id="scrolledwindow5"> <property name="border_width">12</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -137,21 +137,21 @@ <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> - <widget class="GtkViewport" id="viewport4"> + <widget class="GtkViewport" id="viewport1"> <property name="visible">True</property> <property name="shadow_type">GTK_SHADOW_IN</property> <child> - <widget class="GtkVBox" id="sinksVBox"> + <widget class="GtkVBox" id="streamsVBox"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child> - <widget class="GtkLabel" id="noSinksLabel"> + <widget class="GtkLabel" id="noStreamsLabel"> <property name="visible">True</property> <property name="sensitive">False</property> - <property name="label" translatable="yes"><i>No Sinks Available</i></property> + <property name="label" translatable="yes"><i>No Streams Available</i></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -184,9 +184,9 @@ </child> <child> - <widget class="GtkLabel" id="label4711"> + <widget class="GtkLabel" id="label34"> <property name="visible">True</property> - <property name="label" translatable="yes">_Sinks</property> + <property name="label" translatable="yes">_Streams</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -207,7 +207,7 @@ </child> <child> - <widget class="GtkScrolledWindow" id="scrolledwindow5"> + <widget class="GtkScrolledWindow" id="scrolledwindow8"> <property name="border_width">12</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -217,21 +217,21 @@ <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> - <widget class="GtkViewport" id="viewport1"> + <widget class="GtkViewport" id="viewport4"> <property name="visible">True</property> <property name="shadow_type">GTK_SHADOW_IN</property> <child> - <widget class="GtkVBox" id="streamsVBox"> + <widget class="GtkVBox" id="sinksVBox"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child> - <widget class="GtkLabel" id="noStreamsLabel"> + <widget class="GtkLabel" id="noSinksLabel"> <property name="visible">True</property> <property name="sensitive">False</property> - <property name="label" translatable="yes"><i>No Streams Available</i></property> + <property name="label" translatable="yes"><i>No Sinks Available</i></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -264,9 +264,9 @@ </child> <child> - <widget class="GtkLabel" id="label34"> + <widget class="GtkLabel" id="label4711"> <property name="visible">True</property> - <property name="label" translatable="yes">_Streams</property> + <property name="label" translatable="yes">_Sinks</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -701,7 +701,7 @@ <property name="draw_value">False</property> <property name="value_pos">GTK_POS_TOP</property> <property name="digits">0</property> - <property name="update_policy">GTK_UPDATE_DELAYED</property> + <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> <property name="inverted">False</property> <property name="adjustment">44.2408370972 0 100 5 0 0</property> </widget> |