From e8229623bcadeaebcbbe7a7de0eb4708fa7e5470 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 3 Jan 2009 16:57:51 +0100 Subject: [PATCH] Integration: complete GTK-GUI loaded from main Lumiera App. !Yay! --- src/gui/gtk-lumiera.cpp | 19 +++++++++------ src/gui/gtk-lumiera.hpp | 2 +- src/gui/guistart.cpp | 51 +++++++++++++++++++++++++++-------------- 3 files changed, 47 insertions(+), 25 deletions(-) diff --git a/src/gui/gtk-lumiera.cpp b/src/gui/gtk-lumiera.cpp index 64dd4668c..e9c7b0088 100644 --- a/src/gui/gtk-lumiera.cpp +++ b/src/gui/gtk-lumiera.cpp @@ -46,20 +46,14 @@ using namespace gui::model; GtkLumiera the_application; -int -main (int argc, char *argv[]) -{ - return the_application.main(argc, argv); -} namespace gui { -int +void GtkLumiera::main(int argc, char *argv[]) { - NOBUG_INIT; Main kit(argc, argv); @@ -92,3 +86,14 @@ application() } // namespace gui + +/** + * Run the Lumiera GTK GUI as standalone application without backend. + */ +int +main (int argc, char *argv[]) +{ + NOBUG_INIT; + gui::application().main(argc, argv); + return 0; +} diff --git a/src/gui/gtk-lumiera.hpp b/src/gui/gtk-lumiera.hpp index 4f3021b76..ce3d4c2e4 100644 --- a/src/gui/gtk-lumiera.hpp +++ b/src/gui/gtk-lumiera.hpp @@ -98,7 +98,7 @@ static const gchar* AppAuthors[] = { class GtkLumiera : private boost::noncopyable { public: - int main(int argc, char *argv[]); + void main(int argc, char *argv[]); static Glib::ustring get_home_data_path(); diff --git a/src/gui/guistart.cpp b/src/gui/guistart.cpp index cca023ac9..4b9d28262 100644 --- a/src/gui/guistart.cpp +++ b/src/gui/guistart.cpp @@ -31,18 +31,24 @@ ** ** After successfully loading this module, a call to #kickOff is expected to be ** issued, passing a termination signal (callback) to be executed when the GUI - ** terminates. This call returns immediately, after spawning off the main thread - ** and setting up the termination callback accordingly. Additionally, it cares - ** for opening the primary "business" interface of the GUI, i.e. the interface - ** gui::GuiNotification. + ** terminates. This call remains blocked within the main GTK event loop; thus + ** typically this should already run within a separate dedicated GUI thread. + ** Especially, the gui::GuiRunner will ensure this to happen. + ** + ** Prior to entering the GTK event loop, all primary "business" interface of the GUI + ** will be opened (currently as of 1/09 this is the interface gui::GuiNotification.) + ** @todo implement this! ** ** @see lumiera::AppState ** @see gui::GuiFacade ** @see guifacade.cpp - ** @see ///////////////////////////////////TODO: add link to the gui main routine here! + ** @see gui::GtkLumiera#main the GTK GUI main */ +#include "gui/gtk-lumiera.hpp" +#include "include/nobugcfg.h" +#include "lib/error.hpp" #include "gui/guifacade.hpp" #include "common/subsys.hpp" #include "lib/singleton.hpp" @@ -52,12 +58,7 @@ extern "C" { #include "common/interfacedescriptor.h" } -#include -using std::string; - -#include /////////////TODO -using std::cout; //////////////TODO using lumiera::Subsys; @@ -75,14 +76,30 @@ namespace gui { : public GuiFacade { - void kickOff (Subsys::SigTerm& terminationHandle) + void kickOff (Subsys::SigTerm& reportTermination) { - cout << " *** Ha Ha Ha\n" - << " this is the GuiStarterPlugin speaking!\n" - << " now, the Lumiera GUI should be spawned....\n" - << " but actually nothing happens!!!!!!!!!!!!!!\n\n"; - - terminationHandle(0); // signal immediate shutdown without error + try + { + int argc =0; /////////////////////////////////////////////////////////////////////////////TODO pass arguments from core + char *argv[] = {}; + + gui::application().main(argc, argv); // execute the GTK Event Loop + + if (!lumiera_error_peek()) + { + reportTermination(0); // report GUI shutdown without error + return; + } + } + catch (lumiera::Error& problem) + { + reportTermination(&problem); // signal shutdown reporting the error + return; + } + catch (...){ } + lumiera::error::Fatal problemIndicator("unexpected error terminated the GUI.", lumiera_error()); + reportTermination (&problemIndicator); + return; } };