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
This commit is contained in:
parent
514a66e0c8
commit
7b3083df57
|
@ -544,17 +544,13 @@ Monitors</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEventBox" id="deviceButton">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="deviceLabel">
|
||||
<widget class="GtkButton" id="deviceButton">
|
||||
<property name="label" translatable="yes">Device</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="relief">half</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes"><a href="">Device</a></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
|
|
|
@ -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) {
|
||||
void SinkInputWidget::onDeviceChangePopup() {
|
||||
clearMenu();
|
||||
buildMenu();
|
||||
menu.popup(event->button, event->time);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
menu.popup(1, 0);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
void SourceOutputWidget::onDeviceChangePopup() {
|
||||
clearMenu();
|
||||
buildMenu();
|
||||
menu.popup(event->button, event->time);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
menu.popup(1, 0);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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() {
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue