Hide the terminate button.
The terminate button is a last resort and shouldn't be promoted in the UI. This commit hides it behind a right click menu instead. This also hides the 'Set as Fallback' label in the glade file.
This commit is contained in:
parent
02b316fcba
commit
7a7c1fc7f2
|
@ -612,26 +612,6 @@ Monitors</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<widget class="GtkButton" id="terminateButton">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="has_tooltip">True</property>
|
|
||||||
<property name="tooltip" translatable="yes">Terminate stream</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImage" id="image1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="stock">gtk-delete</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -794,29 +774,12 @@ Monitors</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="tooltip" translatable="yes">Set as default</property>
|
<property name="tooltip" translatable="yes">Set as fallback</property>
|
||||||
<child>
|
|
||||||
<widget class="GtkHBox" id="hbox2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImage" id="image2">
|
<widget class="GtkImage" id="image2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="icon_name">emblem-default</property>
|
<property name="icon_name">emblem-default</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Use as fallback</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
@ -35,6 +35,11 @@ SinkInputWidget::SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gno
|
||||||
gchar *txt;
|
gchar *txt;
|
||||||
directionLabel->set_label(txt = g_markup_printf_escaped("<i>%s</i>", _("on")));
|
directionLabel->set_label(txt = g_markup_printf_escaped("<i>%s</i>", _("on")));
|
||||||
g_free(txt);
|
g_free(txt);
|
||||||
|
|
||||||
|
terminate.set_label(_("Terminate Playback"));
|
||||||
|
terminate.signal_activate().connect(sigc::mem_fun(*this, &SinkInputWidget::onKill));
|
||||||
|
terminateMenu.append(terminate);
|
||||||
|
terminateMenu.show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SinkInputWidget::init(MainWindow* mainWindow) {
|
void SinkInputWidget::init(MainWindow* mainWindow) {
|
||||||
|
@ -97,6 +102,15 @@ void SinkInputWidget::onMuteToggleButton() {
|
||||||
pa_operation_unref(o);
|
pa_operation_unref(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SinkInputWidget::onWidgetButtonEvent(GdkEventButton* event) {
|
||||||
|
if (GDK_BUTTON_PRESS == event->type && 3 == event->button) {
|
||||||
|
terminateMenu.popup(event->button, event->time);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void SinkInputWidget::onKill() {
|
void SinkInputWidget::onKill() {
|
||||||
pa_operation* o;
|
pa_operation* o;
|
||||||
if (!(o = pa_context_kill_sink_input(get_context(), index, NULL, NULL))) {
|
if (!(o = pa_context_kill_sink_input(get_context(), index, NULL, NULL))) {
|
||||||
|
@ -144,13 +158,12 @@ void SinkInputWidget::SinkMenuItem::onToggle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SinkInputWidget::onDeviceChangePopup(GdkEventButton* event) {
|
bool SinkInputWidget::onDeviceChangePopup(GdkEventButton* event) {
|
||||||
if (GDK_BUTTON_PRESS == event->type && 1 == event->button)
|
if (GDK_BUTTON_PRESS == event->type && 1 == event->button) {
|
||||||
{
|
|
||||||
clearMenu();
|
clearMenu();
|
||||||
buildMenu();
|
buildMenu();
|
||||||
menu.popup(event->button, event->time);
|
menu.popup(event->button, event->time);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
uint32_t sinkIndex();
|
uint32_t sinkIndex();
|
||||||
virtual void executeVolumeUpdate();
|
virtual void executeVolumeUpdate();
|
||||||
virtual bool onDeviceChangePopup(GdkEventButton*);
|
virtual bool onDeviceChangePopup(GdkEventButton*);
|
||||||
|
virtual bool onWidgetButtonEvent(GdkEventButton*);
|
||||||
virtual void onMuteToggleButton();
|
virtual void onMuteToggleButton();
|
||||||
virtual void onKill();
|
virtual void onKill();
|
||||||
|
|
||||||
|
@ -49,6 +50,9 @@ private:
|
||||||
MainWindow *mpMainWindow;
|
MainWindow *mpMainWindow;
|
||||||
uint32_t mSinkIndex;
|
uint32_t mSinkIndex;
|
||||||
|
|
||||||
|
Gtk::Menu terminateMenu;
|
||||||
|
Gtk::MenuItem terminate;
|
||||||
|
|
||||||
void clearMenu();
|
void clearMenu();
|
||||||
void buildMenu();
|
void buildMenu();
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,11 @@ SourceOutputWidget::SourceOutputWidget(BaseObjectType* cobject, const Glib::RefP
|
||||||
gchar *txt;
|
gchar *txt;
|
||||||
directionLabel->set_label(txt = g_markup_printf_escaped("<i>%s</i>", _("from")));
|
directionLabel->set_label(txt = g_markup_printf_escaped("<i>%s</i>", _("from")));
|
||||||
g_free(txt);
|
g_free(txt);
|
||||||
|
|
||||||
|
terminate.set_label(_("Terminate Recording"));
|
||||||
|
terminate.signal_activate().connect(sigc::mem_fun(*this, &SourceOutputWidget::onKill));
|
||||||
|
terminateMenu.append(terminate);
|
||||||
|
terminateMenu.show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceOutputWidget::init(MainWindow* mainWindow) {
|
void SourceOutputWidget::init(MainWindow* mainWindow) {
|
||||||
|
@ -71,6 +76,15 @@ uint32_t SourceOutputWidget::sourceIndex() {
|
||||||
return mSourceIndex;
|
return mSourceIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SourceOutputWidget::onWidgetButtonEvent(GdkEventButton* event) {
|
||||||
|
if (GDK_BUTTON_PRESS == event->type && 3 == event->button) {
|
||||||
|
terminateMenu.popup(event->button, event->time);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void SourceOutputWidget::onKill() {
|
void SourceOutputWidget::onKill() {
|
||||||
pa_operation* o;
|
pa_operation* o;
|
||||||
if (!(o = pa_context_kill_source_output(get_context(), index, NULL, NULL))) {
|
if (!(o = pa_context_kill_source_output(get_context(), index, NULL, NULL))) {
|
||||||
|
@ -119,13 +133,12 @@ void SourceOutputWidget::SourceMenuItem::onToggle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SourceOutputWidget::onDeviceChangePopup(GdkEventButton* event) {
|
bool SourceOutputWidget::onDeviceChangePopup(GdkEventButton* event) {
|
||||||
if (GDK_BUTTON_PRESS == event->type && 1 == event->button)
|
if (GDK_BUTTON_PRESS == event->type && 1 == event->button) {
|
||||||
{
|
|
||||||
clearMenu();
|
clearMenu();
|
||||||
buildMenu();
|
buildMenu();
|
||||||
menu.popup(event->button, event->time);
|
menu.popup(event->button, event->time);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,16 @@ public:
|
||||||
void setSourceIndex(uint32_t idx);
|
void setSourceIndex(uint32_t idx);
|
||||||
uint32_t sourceIndex();
|
uint32_t sourceIndex();
|
||||||
virtual bool onDeviceChangePopup(GdkEventButton*);
|
virtual bool onDeviceChangePopup(GdkEventButton*);
|
||||||
|
virtual bool onWidgetButtonEvent(GdkEventButton*);
|
||||||
virtual void onKill();
|
virtual void onKill();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow *mpMainWindow;
|
MainWindow *mpMainWindow;
|
||||||
uint32_t mSourceIndex;
|
uint32_t mSourceIndex;
|
||||||
|
|
||||||
|
Gtk::Menu terminateMenu;
|
||||||
|
Gtk::MenuItem terminate;
|
||||||
|
|
||||||
void clearMenu();
|
void clearMenu();
|
||||||
void buildMenu();
|
void buildMenu();
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,11 @@ StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Gl
|
||||||
|
|
||||||
x->get_widget("lockToggleButton", lockToggleButton);
|
x->get_widget("lockToggleButton", lockToggleButton);
|
||||||
x->get_widget("muteToggleButton", muteToggleButton);
|
x->get_widget("muteToggleButton", muteToggleButton);
|
||||||
x->get_widget("terminateButton", terminateButton);
|
|
||||||
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);
|
x->get_widget("deviceLabel", deviceLabel);
|
||||||
|
|
||||||
terminateButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onKill));
|
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_button_press_event().connect(sigc::mem_fun(*this, &StreamWidget::onDeviceChangePopup));
|
||||||
|
|
||||||
|
@ -44,7 +43,9 @@ StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Gl
|
||||||
channelWidgets[i] = NULL;
|
channelWidgets[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamWidget::onKill() {
|
|
||||||
|
bool StreamWidget::onWidgetButtonEvent(GdkEventButton*) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
|
void StreamWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
|
||||||
|
|
|
@ -36,7 +36,6 @@ public:
|
||||||
virtual void updateChannelVolume(int channel, pa_volume_t v);
|
virtual void updateChannelVolume(int channel, pa_volume_t v);
|
||||||
|
|
||||||
Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
|
Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
|
||||||
Gtk::Button *terminateButton;
|
|
||||||
Gtk::Label *directionLabel;
|
Gtk::Label *directionLabel;
|
||||||
Gtk::EventBox *deviceButton;
|
Gtk::EventBox *deviceButton;
|
||||||
Gtk::Label *deviceLabel;
|
Gtk::Label *deviceLabel;
|
||||||
|
@ -48,7 +47,7 @@ public:
|
||||||
|
|
||||||
virtual void onMuteToggleButton();
|
virtual void onMuteToggleButton();
|
||||||
virtual bool onDeviceChangePopup(GdkEventButton*);
|
virtual bool onDeviceChangePopup(GdkEventButton*);
|
||||||
virtual void onKill();
|
virtual bool onWidgetButtonEvent(GdkEventButton*);
|
||||||
|
|
||||||
sigc::connection timeoutConnection;
|
sigc::connection timeoutConnection;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue