Hi all, I'm trying to code with libglademm, and i have this: The problem is that prefs_test_btn in prefs_diag closes prefs_diag even though on_prefs_test_btn_clicked() does nothing. Could anyone help this struggling newbie? Thanks!! #include <libglademm/xml.h> #include <gtkmm.h> #include <iostream> #ifdef ENABLE_NLS # include <libintl.h> #endif /* For testing propose use the local (not installed) glade file */ /* #define GLADE_FILE PACKAGE_DATA_DIR"/xamoz/glade/xamoz.glade" */ #define GLADE_FILE "xamoz.glade" Gtk::Window* main_win; //declare all windows here Gtk::Dialog* prefs_diag; void on_prefs_btn_clicked(); //declare all action functions here void on_quit_btn_clicked(); void on_prefs_cancel_btn_clicked(); void on_prefs_test_btn_clicked(); //-------------------------------------action functions-------------------------------------- void on_prefs_btn_clicked() { prefs_diag->run(); //kit.run(*prefs_diag);, seems to be the same? } void on_quit_btn_clicked() { main_win->hide(); } void on_prefs_cancel_btn_clicked() { prefs_diag->hide(); } void on_prefs_test_btn_clicked() { //do nothing } int main (int argc, char *argv[]) { Gtk::Main kit(argc, argv); //Load the Glade file and instiate its widgets: Glib::RefPtr<Gnome::Glade::Xml> refXml; refXml = Gnome::Glade::Xml::create(GLADE_FILE); refXml->get_widget("main_window", main_win); //link windows here refXml->get_widget("prefs_diag", prefs_diag); Gtk::Button* quit_btn; //declare buttons here Gtk::Button* prefs_btn; Gtk::Button* prefs_cancel_btn; Gtk::Button* prefs_test_btn; //now link buttons and connect them to actions refXml->get_widget("quit_btn", quit_btn); quit_btn->signal_clicked().connect( sigc::ptr_fun(on_quit_btn_clicked) ); refXml->get_widget("prefs_btn", prefs_btn); prefs_btn->signal_clicked().connect( sigc::ptr_fun(on_prefs_btn_clicked) ); refXml->get_widget("prefs_cancel_btn", prefs_cancel_btn); prefs_btn->signal_clicked().connect( sigc::ptr_fun(on_prefs_cancel_btn_clicked) ); refXml->get_widget("prefs_test_btn", prefs_test_btn); prefs_btn->signal_clicked().connect( sigc::ptr_fun(on_prefs_test_btn_clicked) ); //main if (main_win) { kit.run(*main_win); } return 0; }
Attachment:
xamoz.glade
Description: application/glade