[Debconf-video] [patch] Add quit button to the dvswitch GUI
Hi. Here is a new small patch to dvswitch, adding a quit button to
the GUI. It will make it more obvious for the casual user to know how
to exit the program. Please include in a future version of dvswitch.
Index: src/mixer_window.hpp
===================================================================
--- src/mixer_window.hpp (revision 153)
+++ src/mixer_window.hpp (working copy)
@@ -29,6 +29,7 @@
explicit mixer_window(mixer & mixer);
private:
+ virtual void quit(void) throw();
virtual bool on_key_press_event(GdkEventKey *) throw();
void toggle_record() throw();
bool update(Glib::IOCondition) throw();
@@ -45,6 +46,7 @@
Gtk::VBox command_box_;
Gtk::ToggleButton record_button_;
Gtk::Button cut_button_;
+ Gtk::Button quit_button_;
dv_full_display_widget display_;
dv_selector_widget selector_;
Index: src/mixer_window.cpp
===================================================================
--- src/mixer_window.cpp (revision 153)
+++ src/mixer_window.cpp (working copy)
@@ -22,11 +22,13 @@
: mixer_(mixer),
record_button_("gtk-media-record"),
cut_button_("gtk-cut"),
+ quit_button_("gtk-quit"),
wakeup_pipe_(O_NONBLOCK, O_NONBLOCK),
next_source_id_(0)
{
record_button_.set_use_stock();
cut_button_.set_use_stock();
+ quit_button_.set_use_stock();
Glib::RefPtr<Glib::IOSource> pipe_io_source(
Glib::IOSource::create(wakeup_pipe_.reader.get(), Glib::IO_IN));
@@ -46,6 +48,9 @@
cut_button_.signal_pressed().connect(sigc::mem_fun(mixer_, &mixer::cut));
cut_button_.show();
+ quit_button_.signal_pressed().connect(sigc::mem_fun(*this, &mixer_window::quit));
+ quit_button_.show();
+
display_.show();
selector_.set_accel_group(get_accel_group());
@@ -58,6 +63,7 @@
command_box_.set_spacing(gui_standard_spacing);
command_box_.pack_start(record_button_, Gtk::PACK_SHRINK);
command_box_.pack_start(cut_button_, Gtk::PACK_SHRINK);
+ command_box_.pack_start(quit_button_, Gtk::PACK_SHRINK);
command_box_.show();
upper_box_.set_spacing(gui_standard_spacing);
@@ -72,11 +78,16 @@
add(main_box_);
}
+void mixer_window::quit(void) throw()
+{
+ Gtk::Main::quit();
+}
+
bool mixer_window::on_key_press_event(GdkEventKey * event) throw()
{
if (event->keyval == 'q' && event->state & Gdk::CONTROL_MASK)
{
- Gtk::Main::quit();
+ quit();
return true;
}
Reply to: