diff --git a/src/pavucontrol.glade b/src/pavucontrol.glade index 07d1a36..b9a8b96 100644 --- a/src/pavucontrol.glade +++ b/src/pavucontrol.glade @@ -612,26 +612,6 @@ Monitors 1 - - - True - True - True - True - Terminate stream - - - True - gtk-delete - - - - - False - False - 2 - - False @@ -794,28 +774,11 @@ Monitors True True False - Set as default + Set as fallback - + True - - - True - emblem-default - - - 0 - - - - - True - Use as fallback - - - 1 - - + emblem-default diff --git a/src/sinkinputwidget.cc b/src/sinkinputwidget.cc index e5307b7..25ed7fe 100644 --- a/src/sinkinputwidget.cc +++ b/src/sinkinputwidget.cc @@ -35,6 +35,11 @@ SinkInputWidget::SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtrset_label(txt = g_markup_printf_escaped("%s", _("on"))); g_free(txt); + + terminate.set_label(_("Terminate Playback")); + terminate.signal_activate().connect(sigc::mem_fun(*this, &SinkInputWidget::onKill)); + terminateMenu.append(terminate); + terminateMenu.show_all(); } void SinkInputWidget::init(MainWindow* mainWindow) { @@ -97,6 +102,15 @@ void SinkInputWidget::onMuteToggleButton() { pa_operation_unref(o); } +bool SinkInputWidget::onWidgetButtonEvent(GdkEventButton* event) { + if (GDK_BUTTON_PRESS == event->type && 3 == event->button) { + terminateMenu.popup(event->button, event->time); + return true; + } + + return false; +} + void SinkInputWidget::onKill() { pa_operation* o; if (!(o = pa_context_kill_sink_input(get_context(), index, NULL, NULL))) { @@ -144,13 +158,12 @@ void SinkInputWidget::SinkMenuItem::onToggle() { } bool SinkInputWidget::onDeviceChangePopup(GdkEventButton* event) { - if (GDK_BUTTON_PRESS == event->type && 1 == event->button) - { - clearMenu(); - buildMenu(); - menu.popup(event->button, event->time); - return true; - } - else + if (GDK_BUTTON_PRESS == event->type && 1 == event->button) { + clearMenu(); + buildMenu(); + menu.popup(event->button, event->time); + return true; + } + return false; } diff --git a/src/sinkinputwidget.h b/src/sinkinputwidget.h index b48a802..6ec1b69 100644 --- a/src/sinkinputwidget.h +++ b/src/sinkinputwidget.h @@ -42,6 +42,7 @@ public: uint32_t sinkIndex(); virtual void executeVolumeUpdate(); virtual bool onDeviceChangePopup(GdkEventButton*); + virtual bool onWidgetButtonEvent(GdkEventButton*); virtual void onMuteToggleButton(); virtual void onKill(); @@ -49,6 +50,9 @@ private: MainWindow *mpMainWindow; uint32_t mSinkIndex; + Gtk::Menu terminateMenu; + Gtk::MenuItem terminate; + void clearMenu(); void buildMenu(); diff --git a/src/sourceoutputwidget.cc b/src/sourceoutputwidget.cc index fb3f441..513c293 100644 --- a/src/sourceoutputwidget.cc +++ b/src/sourceoutputwidget.cc @@ -35,6 +35,11 @@ SourceOutputWidget::SourceOutputWidget(BaseObjectType* cobject, const Glib::RefP gchar *txt; directionLabel->set_label(txt = g_markup_printf_escaped("%s", _("from"))); g_free(txt); + + terminate.set_label(_("Terminate Recording")); + terminate.signal_activate().connect(sigc::mem_fun(*this, &SourceOutputWidget::onKill)); + terminateMenu.append(terminate); + terminateMenu.show_all(); } void SourceOutputWidget::init(MainWindow* mainWindow) { @@ -71,6 +76,15 @@ uint32_t SourceOutputWidget::sourceIndex() { return mSourceIndex; } +bool SourceOutputWidget::onWidgetButtonEvent(GdkEventButton* event) { + if (GDK_BUTTON_PRESS == event->type && 3 == event->button) { + terminateMenu.popup(event->button, event->time); + return true; + } + + return false; +} + void SourceOutputWidget::onKill() { pa_operation* o; if (!(o = pa_context_kill_source_output(get_context(), index, NULL, NULL))) { @@ -119,13 +133,12 @@ void SourceOutputWidget::SourceMenuItem::onToggle() { } bool SourceOutputWidget::onDeviceChangePopup(GdkEventButton* event) { - if (GDK_BUTTON_PRESS == event->type && 1 == event->button) - { - clearMenu(); - buildMenu(); - menu.popup(event->button, event->time); - return true; + if (GDK_BUTTON_PRESS == event->type && 1 == event->button) { + clearMenu(); + buildMenu(); + menu.popup(event->button, event->time); + return true; } - else - return false; + + return false; } diff --git a/src/sourceoutputwidget.h b/src/sourceoutputwidget.h index ecf937f..1782c77 100644 --- a/src/sourceoutputwidget.h +++ b/src/sourceoutputwidget.h @@ -41,12 +41,16 @@ public: void setSourceIndex(uint32_t idx); uint32_t sourceIndex(); virtual bool onDeviceChangePopup(GdkEventButton*); + virtual bool onWidgetButtonEvent(GdkEventButton*); virtual void onKill(); private: MainWindow *mpMainWindow; uint32_t mSourceIndex; + Gtk::Menu terminateMenu; + Gtk::MenuItem terminate; + void clearMenu(); void buildMenu(); diff --git a/src/streamwidget.cc b/src/streamwidget.cc index fd737fd..256e56a 100644 --- a/src/streamwidget.cc +++ b/src/streamwidget.cc @@ -31,12 +31,11 @@ StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtrget_widget("lockToggleButton", lockToggleButton); x->get_widget("muteToggleButton", muteToggleButton); - x->get_widget("terminateButton", terminateButton); x->get_widget("directionLabel", directionLabel); x->get_widget("deviceButton", deviceButton); x->get_widget("deviceLabel", deviceLabel); - - terminateButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onKill)); + + this->signal_button_press_event().connect(sigc::mem_fun(*this, &StreamWidget::onWidgetButtonEvent)); muteToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onMuteToggleButton)); deviceButton->signal_button_press_event().connect(sigc::mem_fun(*this, &StreamWidget::onDeviceChangePopup)); @@ -44,7 +43,9 @@ StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr