// src/startgui.cc - Copyright 2005, 2006, University // of Padova, dept. of Pure and Applied // Mathematics // // This file is part of SGPEMv2. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // SGPEMv2 is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with SGPEMv2; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "config.h" #include "gettext.h" #include "start_gui.hh" #include #include #include #include #include #include #include #include void start_gui(const std::string& filename) { using namespace Gnome; using namespace Gtk; // Debug line (erase me when done): std::cout << _("Filename to open: ") << filename << std::endl; Glib::RefPtr refXml = Glade::Xml::create(GLADEDIR "/main-window.glade"); Window* main_window = NULL; refXml->get_widget("MainWindow", main_window); assert(main_window != NULL); // Connect extra signals (decide where to do this... // here -- ugly -- derive widgets and then use // Glade::Xml::get_widget_derived -- better --) MenuItem* file_quit = NULL; 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)); // Here open filename if != "" main_window->show_all_children(); Main::run(*main_window); }