- Pardon my italian, but "'affanculo" is the only thing that

crosses my mind seeing what was the correct fix.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@738 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-07-06 11:26:23 +00:00
parent 933d814ddc
commit 483cf2815d
4 changed files with 20 additions and 13 deletions

View File

@ -53,6 +53,6 @@ main(int argc, char* argv[])
// Parses options and prepares vector with
// filenames of documents to be opened
parse_options(argc, argv);
return 0;
}

View File

@ -93,7 +93,7 @@ parse_options(int argc, char** argv)
try
{
// Parse options, initialising the Gtk::Main at the same time
Gtk::Main(argc, argv, context);
Gtk::Main main_loop(argc, argv, context);
GlobalPreferences& prefs = GlobalPreferences::get_instance();
@ -118,11 +118,15 @@ parse_options(int argc, char** argv)
throw Glib::OptionError(Glib::OptionError::FAILED, _("The `No-GUI' option isn't active yet."));
// FIXME : to be written!
} else {
if(fnames.begin() != fnames.end())
start_gui(*fnames.begin());
else
start_gui("");
}
else
{
Gtk::Window* main_window;
if(fnames.begin() != fnames.end())
main_window = start_gui(*fnames.begin());
else
main_window = start_gui("");
main_loop.run(*main_window);
}
} // ~ try
catch(Glib::OptionError e)

View File

@ -28,12 +28,11 @@
#include <gtkmm/aboutdialog.h>
#include <gtkmm/main.h>
#include <gtkmm/menuitem.h>
#include <gtkmm/window.h>
#include <cassert>
#include <iostream>
void
Gtk::Window*
start_gui(const std::string& filename)
{
using namespace Gnome;
@ -54,19 +53,21 @@ start_gui(const std::string& filename)
// 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));
assert(file_quit != NULL);
file_quit->signal_activate().connect(sigc::ptr_fun(&Main::quit));
// About dialog
MenuItem* help_about = NULL;
refXml->get_widget("MenuItem.Help.About", help_about);
assert(help_about != NULL);
AboutDialog* about_dialog = NULL;
refXml->get_widget("AboutDialog", about_dialog);
assert(about_dialog != NULL);
help_about->signal_activate().connect(sigc::mem_fun(*about_dialog, &Window::show));
// FIXME: Here open filename if != ""
main_window->show_all_children();
Main::run(*main_window);
return main_window;
}

View File

@ -23,12 +23,14 @@
#include "config.h"
#include <gtkmm/window.h>
#include <string>
/** \brief This function initialize and starts the whole GUI
*/
void SG_DLLEXPORT start_gui(const std::string& filename);
Gtk::Window* start_gui(const std::string& filename);
#endif