From 7b3083df574d15941449ae8532fef472aedc1ae6 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Wed, 17 Jun 2009 23:23:04 +0100 Subject: Don't use a hyperlink to display the device, just use a regular button. I'm not super happy with this style but it's probably more reliable --- src/pavucontrol.glade | 16 ++++++---------- src/sinkinputwidget.cc | 20 ++++++-------------- src/sinkinputwidget.h | 2 +- src/sourceoutputwidget.cc | 20 ++++++-------------- src/sourceoutputwidget.h | 2 +- src/streamwidget.cc | 6 ++---- src/streamwidget.h | 5 ++--- 7 files changed, 24 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/pavucontrol.glade b/src/pavucontrol.glade index b9a8b96..892b281 100644 --- a/src/pavucontrol.glade +++ b/src/pavucontrol.glade @@ -544,17 +544,13 @@ Monitors - + + Device True - - - True - True - 0 - <a href="">Device</a> - True - - + True + True + half + 0 3 diff --git a/src/sinkinputwidget.cc b/src/sinkinputwidget.cc index 25ed7fe..23c80ed 100644 --- a/src/sinkinputwidget.cc +++ b/src/sinkinputwidget.cc @@ -61,15 +61,12 @@ SinkInputWidget::~SinkInputWidget(void) { void SinkInputWidget::setSinkIndex(uint32_t idx) { mSinkIndex = idx; - gchar *txt; if (mpMainWindow->sinkWidgets.count(idx)) { SinkWidget *w = mpMainWindow->sinkWidgets[idx]; - txt = g_markup_printf_escaped("%s", w->description.c_str()); + deviceButton->set_label(w->description.c_str()); } else - txt = g_markup_printf_escaped("%s", _("Unknown output")); - deviceLabel->set_label(txt); - g_free(txt); + deviceButton->set_label(_("Unknown output")); } uint32_t SinkInputWidget::sinkIndex() { @@ -157,13 +154,8 @@ void SinkInputWidget::SinkMenuItem::onToggle() { pa_operation_unref(o); } -bool SinkInputWidget::onDeviceChangePopup(GdkEventButton* event) { - if (GDK_BUTTON_PRESS == event->type && 1 == event->button) { - clearMenu(); - buildMenu(); - menu.popup(event->button, event->time); - return true; - } - - return false; +void SinkInputWidget::onDeviceChangePopup() { + clearMenu(); + buildMenu(); + menu.popup(1, 0); } diff --git a/src/sinkinputwidget.h b/src/sinkinputwidget.h index 6ec1b69..a4e0baf 100644 --- a/src/sinkinputwidget.h +++ b/src/sinkinputwidget.h @@ -41,7 +41,7 @@ public: void setSinkIndex(uint32_t idx); uint32_t sinkIndex(); virtual void executeVolumeUpdate(); - virtual bool onDeviceChangePopup(GdkEventButton*); + virtual void onDeviceChangePopup(); virtual bool onWidgetButtonEvent(GdkEventButton*); virtual void onMuteToggleButton(); virtual void onKill(); diff --git a/src/sourceoutputwidget.cc b/src/sourceoutputwidget.cc index 513c293..89f3bc4 100644 --- a/src/sourceoutputwidget.cc +++ b/src/sourceoutputwidget.cc @@ -61,15 +61,12 @@ SourceOutputWidget::~SourceOutputWidget(void) { void SourceOutputWidget::setSourceIndex(uint32_t idx) { mSourceIndex = idx; - gchar *txt; if (mpMainWindow->sourceWidgets.count(idx)) { SourceWidget *w = mpMainWindow->sourceWidgets[idx]; - txt = g_markup_printf_escaped("%s", w->description.c_str()); + deviceButton->set_label(w->description.c_str()); } else - txt = g_markup_printf_escaped("%s", _("Unknown input")); - deviceLabel->set_label(txt); - g_free(txt); + deviceButton->set_label(_("Unknown input")); } uint32_t SourceOutputWidget::sourceIndex() { @@ -132,13 +129,8 @@ void SourceOutputWidget::SourceMenuItem::onToggle() { pa_operation_unref(o); } -bool SourceOutputWidget::onDeviceChangePopup(GdkEventButton* event) { - if (GDK_BUTTON_PRESS == event->type && 1 == event->button) { - clearMenu(); - buildMenu(); - menu.popup(event->button, event->time); - return true; - } - - return false; +void SourceOutputWidget::onDeviceChangePopup() { + clearMenu(); + buildMenu(); + menu.popup(1, 0); } diff --git a/src/sourceoutputwidget.h b/src/sourceoutputwidget.h index 1782c77..4eaf613 100644 --- a/src/sourceoutputwidget.h +++ b/src/sourceoutputwidget.h @@ -40,7 +40,7 @@ public: uint32_t index, clientIndex; void setSourceIndex(uint32_t idx); uint32_t sourceIndex(); - virtual bool onDeviceChangePopup(GdkEventButton*); + virtual void onDeviceChangePopup(); virtual bool onWidgetButtonEvent(GdkEventButton*); virtual void onKill(); diff --git a/src/streamwidget.cc b/src/streamwidget.cc index 256e56a..2b47f1b 100644 --- a/src/streamwidget.cc +++ b/src/streamwidget.cc @@ -33,11 +33,10 @@ StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtrget_widget("muteToggleButton", muteToggleButton); x->get_widget("directionLabel", directionLabel); x->get_widget("deviceButton", deviceButton); - x->get_widget("deviceLabel", deviceLabel); 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)); + deviceButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onDeviceChangePopup)); for (unsigned i = 0; i < PA_CHANNELS_MAX; i++) channelWidgets[i] = NULL; @@ -110,6 +109,5 @@ bool StreamWidget::timeoutEvent() { void StreamWidget::executeVolumeUpdate() { } -bool StreamWidget::onDeviceChangePopup(GdkEventButton*) { - return false; +void StreamWidget::onDeviceChangePopup() { } diff --git a/src/streamwidget.h b/src/streamwidget.h index c11d993..7fe13ee 100644 --- a/src/streamwidget.h +++ b/src/streamwidget.h @@ -37,8 +37,7 @@ public: Gtk::ToggleButton *lockToggleButton, *muteToggleButton; Gtk::Label *directionLabel; - Gtk::EventBox *deviceButton; - Gtk::Label *deviceLabel; + Gtk::Button *deviceButton; pa_channel_map channelMap; pa_cvolume volume; @@ -46,7 +45,7 @@ public: ChannelWidget *channelWidgets[PA_CHANNELS_MAX]; virtual void onMuteToggleButton(); - virtual bool onDeviceChangePopup(GdkEventButton*); + virtual void onDeviceChangePopup(); virtual bool onWidgetButtonEvent(GdkEventButton*); sigc::connection timeoutConnection; -- cgit