From d7ca106d89b0fa15b37039bb615458a50bf2289e Mon Sep 17 00:00:00 2001 From: tchernobog Date: Wed, 5 Jul 2006 15:16:58 +0000 Subject: [PATCH] - Add about dialog as an extra example on how to use libglade with signals - Remember that sigc::bind exists for passing extra parameters to called methods/functions git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@729 3ecf2c5c-341e-0410-92b4-d18e462d057c --- glade/main-window.glade | 71 ++++++++++++++++++++++++++++++++++++++--- src/start_gui.cc | 11 ++++++- 2 files changed, 76 insertions(+), 6 deletions(-) diff --git a/glade/main-window.glade b/glade/main-window.glade index 5e1768f..3f150f3 100644 --- a/glade/main-window.glade +++ b/glade/main-window.glade @@ -2,6 +2,8 @@ + 300 + 200 True @@ -9,7 +11,7 @@ True - + True _File True @@ -17,7 +19,7 @@ True - + True gtk-quit True @@ -29,15 +31,15 @@ - + True _Help True - + True - + True gtk-about True @@ -73,6 +75,27 @@ True + + + True + False + gtk-media-play + + + + + True + False + gtk-media-pause + + + + + True + False + gtk-media-stop + + False @@ -95,4 +118,42 @@ + + SGPEMv2 + 0.3 + University of Padova, dept. of Pure and Applied Mathematics + SGPEMv2 comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License; for details see file COPYING contained in the source package. + Giovanni Giacobbi <ggiacobb@studenti.math.unipd.it> +Filippo Paparella <ironpipp@gmail.com> +Paolo Santi <psanti@studenti.math.unipd.it> +Matteo Settenvini <matteo@member.fsf.org> +Marco Trevisan <mtrevisa@studenti.math.unipd.it> +Djina Verbanac <betalgez@yahoo.com> +Luca Vezzaro <lvezzaro@studenti.math.unipd.it> + + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK + 12 + 12 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK + 6 + GTK_BUTTONBOX_END + + + False + GTK_PACK_END + + + + + diff --git a/src/start_gui.cc b/src/start_gui.cc index d5f7a47..9f9fb8d 100644 --- a/src/start_gui.cc +++ b/src/start_gui.cc @@ -24,6 +24,8 @@ #include "start_gui.hh" #include +#include +#include #include #include #include @@ -49,9 +51,16 @@ start_gui(int argc, char** argv) // here -- ugly -- derive widgets and then use // Glade::Xml::get_widget_derived -- better --) MenuItem* file_quit = NULL; - refXml->get_widget("Menu.File.Quit", file_quit); + refXml->get_widget("MenuItem.File.Quit", file_quit); file_quit->signal_activate().connect(sigc::ptr_fun(&Main::quit)); + // About dialog + MenuItem* help_about = NULL; + refXml->get_widget("MenuItem.Help.About", help_about); + AboutDialog* about_dialog = NULL; + refXml->get_widget("AboutDialog", about_dialog); + help_about->signal_activate().connect(sigc::mem_fun(*about_dialog, &Window::show)); + main_window->show_all_children(); Main::run(*main_window);