From 5d14ae3017d5961d87b1169df3cd11e82fe77c14 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 4 May 2009 03:58:23 +0000 Subject: Fixed broken preferences singleton and removed GUI encapsulation leakage. Fixes bug #367752. (bzr r7816) --- src/inkscape.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/inkscape.cpp') 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 #include #include +#include #include #include #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(); -- cgit v1.2.3