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>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkEventBox" id="deviceButton">
|
<widget class="GtkButton" id="deviceButton">
|
||||||
|
<property name="label" translatable="yes">Device</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<property name="can_focus">True</property>
|
||||||
<widget class="GtkLabel" id="deviceLabel">
|
<property name="receives_default">True</property>
|
||||||
<property name="visible">True</property>
|
<property name="relief">half</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="xalign">0</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>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">3</property>
|
<property name="position">3</property>
|
||||||
|
|
|
@ -61,15 +61,12 @@ SinkInputWidget::~SinkInputWidget(void) {
|
||||||
void SinkInputWidget::setSinkIndex(uint32_t idx) {
|
void SinkInputWidget::setSinkIndex(uint32_t idx) {
|
||||||
mSinkIndex = idx;
|
mSinkIndex = idx;
|
||||||
|
|
||||||
gchar *txt;
|
|
||||||
if (mpMainWindow->sinkWidgets.count(idx)) {
|
if (mpMainWindow->sinkWidgets.count(idx)) {
|
||||||
SinkWidget *w = mpMainWindow->sinkWidgets[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
|
else
|
||||||
txt = g_markup_printf_escaped("<a href=\"\">%s</a>", _("Unknown output"));
|
deviceButton->set_label(_("Unknown output"));
|
||||||
deviceLabel->set_label(txt);
|
|
||||||
g_free(txt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t SinkInputWidget::sinkIndex() {
|
uint32_t SinkInputWidget::sinkIndex() {
|
||||||
|
@ -157,13 +154,8 @@ void SinkInputWidget::SinkMenuItem::onToggle() {
|
||||||
pa_operation_unref(o);
|
pa_operation_unref(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SinkInputWidget::onDeviceChangePopup(GdkEventButton* event) {
|
void SinkInputWidget::onDeviceChangePopup() {
|
||||||
if (GDK_BUTTON_PRESS == event->type && 1 == event->button) {
|
clearMenu();
|
||||||
clearMenu();
|
buildMenu();
|
||||||
buildMenu();
|
menu.popup(1, 0);
|
||||||
menu.popup(event->button, event->time);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
void setSinkIndex(uint32_t idx);
|
void setSinkIndex(uint32_t idx);
|
||||||
uint32_t sinkIndex();
|
uint32_t sinkIndex();
|
||||||
virtual void executeVolumeUpdate();
|
virtual void executeVolumeUpdate();
|
||||||
virtual bool onDeviceChangePopup(GdkEventButton*);
|
virtual void onDeviceChangePopup();
|
||||||
virtual bool onWidgetButtonEvent(GdkEventButton*);
|
virtual bool onWidgetButtonEvent(GdkEventButton*);
|
||||||
virtual void onMuteToggleButton();
|
virtual void onMuteToggleButton();
|
||||||
virtual void onKill();
|
virtual void onKill();
|
||||||
|
|
|
@ -61,15 +61,12 @@ SourceOutputWidget::~SourceOutputWidget(void) {
|
||||||
void SourceOutputWidget::setSourceIndex(uint32_t idx) {
|
void SourceOutputWidget::setSourceIndex(uint32_t idx) {
|
||||||
mSourceIndex = idx;
|
mSourceIndex = idx;
|
||||||
|
|
||||||
gchar *txt;
|
|
||||||
if (mpMainWindow->sourceWidgets.count(idx)) {
|
if (mpMainWindow->sourceWidgets.count(idx)) {
|
||||||
SourceWidget *w = mpMainWindow->sourceWidgets[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
|
else
|
||||||
txt = g_markup_printf_escaped("<a href=\"\">%s</a>", _("Unknown input"));
|
deviceButton->set_label(_("Unknown input"));
|
||||||
deviceLabel->set_label(txt);
|
|
||||||
g_free(txt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t SourceOutputWidget::sourceIndex() {
|
uint32_t SourceOutputWidget::sourceIndex() {
|
||||||
|
@ -132,13 +129,8 @@ void SourceOutputWidget::SourceMenuItem::onToggle() {
|
||||||
pa_operation_unref(o);
|
pa_operation_unref(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SourceOutputWidget::onDeviceChangePopup(GdkEventButton* event) {
|
void SourceOutputWidget::onDeviceChangePopup() {
|
||||||
if (GDK_BUTTON_PRESS == event->type && 1 == event->button) {
|
clearMenu();
|
||||||
clearMenu();
|
buildMenu();
|
||||||
buildMenu();
|
menu.popup(1, 0);
|
||||||
menu.popup(event->button, event->time);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
uint32_t index, clientIndex;
|
uint32_t index, clientIndex;
|
||||||
void setSourceIndex(uint32_t idx);
|
void setSourceIndex(uint32_t idx);
|
||||||
uint32_t sourceIndex();
|
uint32_t sourceIndex();
|
||||||
virtual bool onDeviceChangePopup(GdkEventButton*);
|
virtual void onDeviceChangePopup();
|
||||||
virtual bool onWidgetButtonEvent(GdkEventButton*);
|
virtual bool onWidgetButtonEvent(GdkEventButton*);
|
||||||
virtual void onKill();
|
virtual void onKill();
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,10 @@ StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Gl
|
||||||
x->get_widget("muteToggleButton", muteToggleButton);
|
x->get_widget("muteToggleButton", muteToggleButton);
|
||||||
x->get_widget("directionLabel", directionLabel);
|
x->get_widget("directionLabel", directionLabel);
|
||||||
x->get_widget("deviceButton", deviceButton);
|
x->get_widget("deviceButton", deviceButton);
|
||||||
x->get_widget("deviceLabel", deviceLabel);
|
|
||||||
|
|
||||||
this->signal_button_press_event().connect(sigc::mem_fun(*this, &StreamWidget::onWidgetButtonEvent));
|
this->signal_button_press_event().connect(sigc::mem_fun(*this, &StreamWidget::onWidgetButtonEvent));
|
||||||
muteToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onMuteToggleButton));
|
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++)
|
for (unsigned i = 0; i < PA_CHANNELS_MAX; i++)
|
||||||
channelWidgets[i] = NULL;
|
channelWidgets[i] = NULL;
|
||||||
|
@ -110,6 +109,5 @@ bool StreamWidget::timeoutEvent() {
|
||||||
void StreamWidget::executeVolumeUpdate() {
|
void StreamWidget::executeVolumeUpdate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StreamWidget::onDeviceChangePopup(GdkEventButton*) {
|
void StreamWidget::onDeviceChangePopup() {
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,7 @@ public:
|
||||||
|
|
||||||
Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
|
Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
|
||||||
Gtk::Label *directionLabel;
|
Gtk::Label *directionLabel;
|
||||||
Gtk::EventBox *deviceButton;
|
Gtk::Button *deviceButton;
|
||||||
Gtk::Label *deviceLabel;
|
|
||||||
|
|
||||||
pa_channel_map channelMap;
|
pa_channel_map channelMap;
|
||||||
pa_cvolume volume;
|
pa_cvolume volume;
|
||||||
|
@ -46,7 +45,7 @@ public:
|
||||||
ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
|
ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
|
||||||
|
|
||||||
virtual void onMuteToggleButton();
|
virtual void onMuteToggleButton();
|
||||||
virtual bool onDeviceChangePopup(GdkEventButton*);
|
virtual void onDeviceChangePopup();
|
||||||
virtual bool onWidgetButtonEvent(GdkEventButton*);
|
virtual bool onWidgetButtonEvent(GdkEventButton*);
|
||||||
|
|
||||||
sigc::connection timeoutConnection;
|
sigc::connection timeoutConnection;
|
||||||
|
|
Loading…
Reference in New Issue