summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2009-06-17 23:23:04 +0100
committerColin Guthrie <cguthrie@mandriva.org>2009-06-17 23:23:04 +0100
commit7b3083df574d15941449ae8532fef472aedc1ae6 (patch)
tree7d55ff52585102f66520890a3f13c89cf4c105f5 /src
parent514a66e0c8570f9706bcfcf93cec124094931b6e (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/pavucontrol.glade16
-rw-r--r--src/sinkinputwidget.cc20
-rw-r--r--src/sinkinputwidget.h2
-rw-r--r--src/sourceoutputwidget.cc20
-rw-r--r--src/sourceoutputwidget.h2
-rw-r--r--src/streamwidget.cc6
-rw-r--r--src/streamwidget.h5
7 files changed, 24 insertions, 47 deletions
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</property>
</packing>
</child>
<child>
- <widget class="GtkEventBox" id="deviceButton">
+ <widget class="GtkButton" id="deviceButton">
+ <property name="label" translatable="yes">Device</property>
<property name="visible">True</property>
- <child>
- <widget class="GtkLabel" id="deviceLabel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;a href=""&gt;Device&lt;/a&gt;</property>
- <property name="use_markup">True</property>
- </widget>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">half</property>
+ <property name="xalign">0</property>
</widget>
<packing>
<property name="position">3</property>
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("<a href=\"\">%s</a>", w->description.c_str());
+ deviceButton->set_label(w->description.c_str());
}
else
- txt = g_markup_printf_escaped("<a href=\"\">%s</a>", _("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("<a href=\"\">%s</a>", w->description.c_str());
+ deviceButton->set_label(w->description.c_str());
}
else
- txt = g_markup_printf_escaped("<a href=\"\">%s</a>", _("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::RefPtr<Gnome::Gl
x->get_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;