summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2009-06-17 22:25:19 +0100
committerColin Guthrie <cguthrie@mandriva.org>2009-06-17 22:25:19 +0100
commit7a7c1fc7f2a94fea91c66e9be35e8d6d81c0c7fe (patch)
treef8dd5ef70300062de48612c17d37b8214ad11275 /src
parent02b316fcba8a112e528a0bddfcb93cf6f3179168 (diff)
Hide the terminate button.
The terminate button is a last resort and shouldn't be promoted in the UI. This commit hides it behind a right click menu instead. This also hides the 'Set as Fallback' label in the glade file.
Diffstat (limited to 'src')
-rw-r--r--src/pavucontrol.glade43
-rw-r--r--src/sinkinputwidget.cc29
-rw-r--r--src/sinkinputwidget.h4
-rw-r--r--src/sourceoutputwidget.cc29
-rw-r--r--src/sourceoutputwidget.h4
-rw-r--r--src/streamwidget.cc9
-rw-r--r--src/streamwidget.h3
7 files changed, 59 insertions, 62 deletions
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</property>
<property name="position">1</property>
</packing>
</child>
- <child>
- <widget class="GtkButton" id="terminateButton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip" translatable="yes">Terminate stream</property>
- <child>
- <widget class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-delete</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -794,28 +774,11 @@ Monitors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="tooltip" translatable="yes">Set as default</property>
+ <property name="tooltip" translatable="yes">Set as fallback</property>
<child>
- <widget class="GtkHBox" id="hbox2">
+ <widget class="GtkImage" id="image2">
<property name="visible">True</property>
- <child>
- <widget class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="icon_name">emblem-default</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Use as fallback</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="icon_name">emblem-default</property>
</widget>
</child>
</widget>
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::RefPtr<Gno
gchar *txt;
directionLabel->set_label(txt = g_markup_printf_escaped("<i>%s</i>", _("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("<i>%s</i>", _("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::RefPtr<Gnome::Gl
x->get_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<Gnome::Gl
channelWidgets[i] = NULL;
}
-void StreamWidget::onKill() {
+
+bool StreamWidget::onWidgetButtonEvent(GdkEventButton*) {
+ return false;
}
void StreamWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
diff --git a/src/streamwidget.h b/src/streamwidget.h
index 48e3fd6..c11d993 100644
--- a/src/streamwidget.h
+++ b/src/streamwidget.h
@@ -36,7 +36,6 @@ public:
virtual void updateChannelVolume(int channel, pa_volume_t v);
Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
- Gtk::Button *terminateButton;
Gtk::Label *directionLabel;
Gtk::EventBox *deviceButton;
Gtk::Label *deviceLabel;
@@ -48,7 +47,7 @@ public:
virtual void onMuteToggleButton();
virtual bool onDeviceChangePopup(GdkEventButton*);
- virtual void onKill();
+ virtual bool onWidgetButtonEvent(GdkEventButton*);
sigc::connection timeoutConnection;