diff --git a/Makefile.am b/Makefile.am index 8f5df07..0a5e538 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,11 +36,11 @@ SUBDIRS += \ plugins/pyloader \ plugins/xmlsave -# directories definition +datarootdir = @datarootdir@ sharedir = $(pkgdatadir) policiesdir = $(sharedir)/policies plugindir = $(sharedir)/plugins -datarootdir = @datarootdir@ +gladedir = $(sharedir)/glade localedir = @datadir@/locale aclocaldir = @datadir@/aclocal @@ -245,8 +245,11 @@ sgpemv2_CPPFLAGS = \ -I@top_srcdir@ \ -I@top_srcdir@/src/templates \ -DLOCALEDIR="\"$(localedir)\"" \ + -DSHAREDIR="\"$(sharedir)\"" \ + -DGLADEDIR="\"$(gladedir)\"" \ $(CAIRO_CFLAGS) \ $(GTKMM_CFLAGS) \ + $(LIBGLADEMM_CFLAGS) \ $(PYTHON_CPPFLAGS) \ $(GTHREAD_CFLAGS) sgpemv2_CXXFLAGS = $(VISIB_HIDDEN) @@ -255,6 +258,7 @@ sgpemv2_LDADD = \ src/backend/libbackend.la \ $(CAIRO_LIBS) \ $(GTKMM_LIBS) \ + $(LIBGLADEMM_LIBS) \ $(GTHREAD_LIBS) # Please keep this in sorted order: @@ -282,6 +286,11 @@ noinst_HEADERS += \ src/start_gui.hh \ src/text_simulation.hh +# ---------- glade files ----------- + +glade_DATA = \ + glade/main-window.glade + # ############################################################ # # source : templates diff --git a/configure.ac b/configure.ac index 467e248..81a108d 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,7 @@ AM_GNU_GETTEXT_VERSION([0.14.1]) dnl various requisites SIGCPP_VERSION=2.0.10 GTKMM_VERSION=2.8.0 +LIBGLADEMM_VERSION=2.6.2 CAIRO_VERSION=1.0.0 dnl c++ compiler and flags @@ -92,6 +93,9 @@ PKG_CHECK_MODULES([GLIBMM], PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= $GTKMM_VERSION], :, AC_MSG_ERROR([$GTKMM_PKG_ERRORS])) +PKG_CHECK_MODULES([LIBGLADEMM], + [libglademm-2.4 >= $LIBGLADEMM_VERSION], + :, AC_MSG_ERROR([$LIBGLADEMM_PKG_ERRORS])) dnl use DSO visibility tags for systems that supports it correctly SGPEMV2_VISIBILITY_SUPPORT diff --git a/src/main.cc b/src/main.cc index 6605723..d5c3197 100644 --- a/src/main.cc +++ b/src/main.cc @@ -24,7 +24,7 @@ #include "main.hh" #include "parse_opts.hh" -// #include "start_gui.hh" +#include "start_gui.hh" #include "backend/plugin_manager.hh" @@ -66,5 +66,7 @@ main(int argc, char* argv[]) // Initializes plugin system PluginManager::get_instance(); + start_gui(argc, argv); + return 0; } diff --git a/src/start_gui.cc b/src/start_gui.cc index 1088b41..d5f7a47 100644 --- a/src/start_gui.cc +++ b/src/start_gui.cc @@ -21,24 +21,39 @@ #include "config.h" #include "gettext.h" -#include "graphical_terminal_io.hh" #include "start_gui.hh" -#include "smartp.tcc" +#include #include +#include +#include + +#include void -start_gui(int argc, char** argv, TextSimulation& txt) +start_gui(int argc, char** argv) { - Gtk::Main gtk_main(argc, argv); + using namespace Gnome; + using namespace Gtk; - GraphicalTerminalIO* gt = new sgpem::GraphicalTerminalIO(&txt); - memory::smart_ptr main_window(gt); - txt.add_io_device(main_window); + Main gtk_main(argc, argv); - //print the initial status on each iomanager - //txt.update(); + Glib::RefPtr refXml = + Glade::Xml::create(GLADEDIR "/main-window.glade"); - Gtk::Main::run(*gt); + 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("Menu.File.Quit", file_quit); + file_quit->signal_activate().connect(sigc::ptr_fun(&Main::quit)); + + main_window->show_all_children(); + + Main::run(*main_window); } diff --git a/src/start_gui.hh b/src/start_gui.hh index 0225e29..5bd9e54 100644 --- a/src/start_gui.hh +++ b/src/start_gui.hh @@ -23,13 +23,10 @@ #include "config.h" -#include "text_simulation.hh" - - /** \brief This function initialize and starts the whole GUI */ -void SG_DLLEXPORT start_gui(int argc, char** argv, TextSimulation& txt); +void SG_DLLEXPORT start_gui(int argc, char** argv); #endif