summaryrefslogtreecommitdiffstats
path: root/src/file.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-07-05 15:46:24 +0000
committerJaviertxo <jtx@jtx.marker.es>2013-07-05 15:46:24 +0000
commitc0503c1a2b9a5f7a4030a664ca5a324ce38c967a (patch)
tree9bc6d203a70155251a7a50210abe236cc2277d11 /src/file.cpp
parentUpadate to trunk (diff)
parentMerge: Command-line and DBus refactoring to improve inkscapes ability to be r... (diff)
downloadinkscape-c0503c1a2b9a5f7a4030a664ca5a324ce38c967a.tar.gz
inkscape-c0503c1a2b9a5f7a4030a664ca5a324ce38c967a.zip
Update to trunk
(bzr r11950.1.123)
Diffstat (limited to 'src/file.cpp')
-rw-r--r--src/file.cpp33
1 files changed, 20 insertions, 13 deletions
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 <gtk/gtk.h>
+#include <gtkmm/main.h>
#include <glibmm/convert.h>
#include <glibmm/i18n.h>
@@ -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 <b>%i</b> unused definition in &lt;defs&gt;.",
- "Removed <b>%i</b> unused definitions in &lt;defs&gt;.",
- diff),
- diff);
- } else {
- dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No unused definitions in &lt;defs&gt;."));
+ if (dt != NULL) {
+ // Show status messages when in GUI mode
+ if (diff > 0) {
+ dt->messageStack()->flashF(Inkscape::NORMAL_MESSAGE,
+ ngettext("Removed <b>%i</b> unused definition in &lt;defs&gt;.",
+ "Removed <b>%i</b> unused definitions in &lt;defs&gt;.",
+ diff),
+ diff);
+ } else {
+ dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No unused definitions in &lt;defs&gt;."));
+ }
}
}