diff options
author | Colin Guthrie <cguthrie@mandriva.org> | 2009-06-13 19:15:02 +0100 |
---|---|---|
committer | Colin Guthrie <cguthrie@mandriva.org> | 2009-06-17 08:54:14 +0100 |
commit | 02b316fcba8a112e528a0bddfcb93cf6f3179168 (patch) | |
tree | 96471135e9d83af7ebb275d77e71c9d0c0b6033d /src/sinkinputwidget.h | |
parent | e71562619a67fa6823ba5d14c3df411b12fe192b (diff) |
More changes in the UI to try and make things neater.
This abandons the combo box approach an instead partially reverts to the popup.
We now display a suffix after the stream title saying " on <device>" or " from <device>"
where the <device> part looks like a hyperlink and, when clicked, shows the popup to change the device.
If there is only one device available, we suppress the whole thing and thus avoid confusion.
Diffstat (limited to 'src/sinkinputwidget.h')
-rw-r--r-- | src/sinkinputwidget.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/sinkinputwidget.h b/src/sinkinputwidget.h index 503c67c..b48a802 100644 --- a/src/sinkinputwidget.h +++ b/src/sinkinputwidget.h @@ -31,6 +31,7 @@ class SinkInputWidget : public StreamWidget { public: SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x); static SinkInputWidget* create(MainWindow* mainWindow); + ~SinkInputWidget(void); void init(MainWindow* mainWindow); @@ -40,7 +41,7 @@ public: void setSinkIndex(uint32_t idx); uint32_t sinkIndex(); virtual void executeVolumeUpdate(); - virtual void onDeviceChange(); + virtual bool onDeviceChangePopup(GdkEventButton*); virtual void onMuteToggleButton(); virtual void onKill(); @@ -48,6 +49,28 @@ private: MainWindow *mpMainWindow; uint32_t mSinkIndex; + void clearMenu(); + void buildMenu(); + + Gtk::Menu menu; + + struct SinkMenuItem { + SinkMenuItem(SinkInputWidget *w, const char *label, uint32_t i, bool active) : + widget(w), + menuItem(label), + index(i) { + menuItem.set_active(active); + menuItem.set_draw_as_radio(true); + menuItem.signal_toggled().connect(sigc::mem_fun(*this, &SinkMenuItem::onToggle)); + } + + SinkInputWidget *widget; + Gtk::CheckMenuItem menuItem; + uint32_t index; + void onToggle(); + }; + + std::map<uint32_t, SinkMenuItem*> sinkMenuItems; }; #endif |