diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2009-05-04 03:58:23 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2009-05-04 03:58:23 +0000 |
| commit | 5d14ae3017d5961d87b1169df3cd11e82fe77c14 (patch) | |
| tree | 12a9f0c54ce65b4336bec4368e0c75b7e726060e /src/inkscape.cpp | |
| parent | Clean up formatting so that methods are not all run together. Helps with diffs. (diff) | |
| download | inkscape-5d14ae3017d5961d87b1169df3cd11e82fe77c14.tar.gz inkscape-5d14ae3017d5961d87b1169df3cd11e82fe77c14.zip | |
Fixed broken preferences singleton and removed GUI encapsulation leakage. Fixes bug #367752.
(bzr r7816)
Diffstat (limited to 'src/inkscape.cpp')
| -rw-r--r-- | src/inkscape.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 25b3cc5a9..5d9e217a8 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -41,6 +41,7 @@ using Inkscape::Extension::Internal::PrintWin32; #include <glibmm/i18n.h> #include <gtk/gtkmain.h> #include <gtk/gtkmessagedialog.h> +#include <gtkmm/messagedialog.h> #include <signal.h> #include <string> #include "application/application.h" @@ -742,6 +743,28 @@ inkscape_crash_handler (int /*signum*/) } +class InkErrorHandler : public Inkscape::ErrorReporter { +public: + InkErrorHandler(bool useGui) : Inkscape::ErrorReporter(), + _useGui(useGui) + {} + virtual ~InkErrorHandler() {} + + virtual void handleError( Glib::ustring const& primary, Glib::ustring const& secondary ) const + { + if (_useGui) { + Gtk::MessageDialog err(primary, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true); + err.set_secondary_text(secondary); + err.run(); + } else { + g_message("%s", primary.data()); + g_message("%s", secondary.data()); + } + } + +private: + bool _useGui; +}; void inkscape_application_init (const gchar *argv0, gboolean use_gui) @@ -762,7 +785,9 @@ inkscape_application_init (const gchar *argv0, gboolean use_gui) /* Load the preferences and menus */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->load(use_gui, false); + InkErrorHandler* handler = new InkErrorHandler(use_gui); + prefs->setErrorHandler(handler); + inkscape_load_menus(inkscape); sp_input_load_from_preferences(); |
