From 09ce234c1fc367a2607936e6cf106cb24c60e94f Mon Sep 17 00:00:00 2001 From: Eric Greveson Date: Wed, 3 Jul 2013 20:06:11 +0100 Subject: Modified dbus interface so that it works in console mode (--dbus-listen) Modified action context setup so that in console mode, when a document is added to the main inkscape app instance, it gets a selection model and layer model automatically set up for it Made a couple more verbs work in console mode (bzr r12387.1.4) --- src/file.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 5b4110253..5007cd901 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -68,6 +68,7 @@ #include "ui/dialog/font-substitution.h" #include +#include #include #include @@ -209,8 +210,13 @@ SPDesktop* sp_file_new_default() void sp_file_exit() { - sp_ui_close_all(); - // no need to call inkscape_exit here; last document being closed will take care of that + if (SP_ACTIVE_DESKTOP == NULL) { + // We must be in console mode + Gtk::Main::quit(); + } else { + sp_ui_close_all(); + // no need to call inkscape_exit here; last document being closed will take care of that + } } @@ -582,24 +588,25 @@ sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d /** * Remove unreferenced defs from the defs section of the document. */ -void sp_file_vacuum() +void sp_file_vacuum(SPDocument *doc) { - SPDocument *doc = SP_ACTIVE_DOCUMENT; - unsigned int diff = doc->vacuumDocument(); DocumentUndo::done(doc, SP_VERB_FILE_VACUUM, _("Clean up document")); SPDesktop *dt = SP_ACTIVE_DESKTOP; - if (diff > 0) { - dt->messageStack()->flashF(Inkscape::NORMAL_MESSAGE, - ngettext("Removed %i unused definition in <defs>.", - "Removed %i unused definitions in <defs>.", - diff), - diff); - } else { - dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No unused definitions in <defs>.")); + if (dt != NULL) { + // Show status messages when in GUI mode + if (diff > 0) { + dt->messageStack()->flashF(Inkscape::NORMAL_MESSAGE, + ngettext("Removed %i unused definition in <defs>.", + "Removed %i unused definitions in <defs>.", + diff), + diff); + } else { + dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No unused definitions in <defs>.")); + } } } -- cgit v1.2.3