From fb8198311fa62b09e3fdad9546e92420825ebcd2 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 23 Apr 2011 15:18:35 -0700 Subject: Fixed warning to use GUI when appropriate. (bzr r10191) --- src/extension/system.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/extension/system.cpp') diff --git a/src/extension/system.cpp b/src/extension/system.cpp index cf58f2733..aa5731985 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -35,6 +35,8 @@ #include "implementation/xslt.h" #include "xml/rebase-hrefs.h" #include "io/sys.h" +#include "inkscape.h" + /* #include "implementation/plugin.h" */ namespace Inkscape { @@ -64,8 +66,7 @@ static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementatio * * Lastly, the open function is called in the module itself. */ -SPDocument * -open(Extension *key, gchar const *filename) +SPDocument *open(Extension *key, gchar const *filename) { Input *imod = NULL; if (key == NULL) { @@ -93,8 +94,9 @@ open(Extension *key, gchar const *filename) throw Input::open_failed(); } - if (!imod->prefs(filename)) + if (!imod->prefs(filename)) { return NULL; + } SPDocument *doc = imod->open(filename); if (!doc) { @@ -102,11 +104,11 @@ open(Extension *key, gchar const *filename) } if (last_chance_svg) { - /* We can't call sp_ui_error_dialog because we may be - running from the console, in which case calling sp_ui - routines will cause a segfault. See bug 1000350 - bryce */ - // sp_ui_error_dialog(_("Format autodetect failed. The file is being opened as SVG.")); - g_warning(_("Format autodetect failed. The file is being opened as SVG.")); + if ( inkscape_use_gui() ) { + sp_ui_error_dialog(_("Format autodetect failed. The file is being opened as SVG.")); + } else { + g_warning(_("Format autodetect failed. The file is being opened as SVG.")); + } } /* This kinda overkill as most of these are already set, but I want -- cgit v1.2.3 From cff58b6bd80f0fb13ab65daea0d92eafd5213ff2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 8 Jun 2011 20:23:27 +0200 Subject: Save a copy dialog now opens in current directory if this option is set for save as... dialog. (there is also the possibility to manually change the preferences file to change this option independently from save as... dialog) Fixed bugs: - https://launchpad.net/bugs/791098 (bzr r10263) --- src/extension/system.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/extension/system.cpp') diff --git a/src/extension/system.cpp b/src/extension/system.cpp index aa5731985..b3b64ca7d 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -590,10 +590,11 @@ Glib::ustring get_file_save_path (SPDocument *doc, FileSaveMethod method) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring path; + bool use_current_dir = true; switch (method) { case FILE_SAVE_METHOD_SAVE_AS: { - bool use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true); + use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true); if (doc->getURI() && use_current_dir) { path = Glib::path_get_dirname(doc->getURI()); } else { @@ -605,7 +606,12 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) { path = prefs->getString("/dialogs/save_as/path"); break; case FILE_SAVE_METHOD_SAVE_COPY: - path = prefs->getString("/dialogs/save_copy/path"); + use_current_dir = prefs->getBool("/dialogs/save_copy/use_current_dir", prefs->getBool("/dialogs/save_as/use_current_dir", true)); + if (doc->getURI() && use_current_dir) { + path = Glib::path_get_dirname(doc->getURI()); + } else { + path = prefs->getString("/dialogs/save_copy/path"); + } break; case FILE_SAVE_METHOD_INKSCAPE_SVG: if (doc->getURI()) { -- cgit v1.2.3