From a2aed97d12baab841915cfebb0cd5e982edbbb01 Mon Sep 17 00:00:00 2001 From: John Smith Date: Wed, 20 Jun 2012 09:40:29 +0900 Subject: Fix for 591225 : Fix wording of 'Clean up document' in Undo History (bzr r11507) --- src/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 2ce532f03..5dab48d75 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -570,7 +570,7 @@ void sp_file_vacuum() unsigned int diff = doc->vacuumDocument(); DocumentUndo::done(doc, SP_VERB_FILE_VACUUM, - _("Vacuum <defs>")); + _("Clean up document")); SPDesktop *dt = SP_ACTIVE_DESKTOP; if (diff > 0) { -- cgit v1.2.3 From 53fe022959ca3f120d07401366bb2a9e5618f262 Mon Sep 17 00:00:00 2001 From: John Smith Date: Wed, 4 Jul 2012 09:48:30 +0900 Subject: Fix for 168658 : Font substitution warning dialog (bzr r11522) --- src/file.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 5dab48d75..b895c6591 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -64,6 +64,7 @@ #include "xml/rebase-hrefs.h" #include "verbs.h" #include "event-log.h" +#include "ui/dialog/font-substitution.h" #include #include @@ -270,6 +271,9 @@ bool sp_file_open(const Glib::ustring &uri, Glib::ustring msg = _("Broken links have been changed to point to existing files."); desktop->showInfoDialog(msg); } + + // Check for font substitutions + Inkscape::UI::Dialog::FontSubstitution::getInstance().checkFontSubstitutions(doc); } return TRUE; -- cgit v1.2.3 From d9da2a4f178e71f5b33ea158c0631e86220f2e5d Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 12 Jul 2012 17:19:58 +0900 Subject: Fix for 612221 : Add metadata default configuration in the preferences (bzr r11544) --- src/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index b895c6591..fd039323b 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -186,10 +186,10 @@ SPDesktop* sp_file_new_default() g_free(foundTemplate); foundTemplate = 0; } + rdf_add_from_preferences( SP_ACTIVE_DOCUMENT ); return desk; } - /*###################### ## D E L E T E ######################*/ -- cgit v1.2.3 From a51385827276535559541fb2e4c5145876a7d08a Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 30 Aug 2012 09:22:17 +0900 Subject: Fix for 170550 : open blank document on 'close' (bzr r11632) --- src/file.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index fd039323b..3b24876c4 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -145,7 +145,7 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) return dt; } -SPDesktop* sp_file_new_default() +Glib::ustring sp_file_default_template_uri() { std::list sources; sources.push_back( profile_path("templates") ); // first try user's local dir @@ -181,12 +181,22 @@ SPDesktop* sp_file_new_default() g_free(*it); } - SPDesktop* desk = sp_file_new(foundTemplate ? foundTemplate : ""); + Glib::ustring templateUri = foundTemplate ? foundTemplate : ""; + if (foundTemplate) { g_free(foundTemplate); foundTemplate = 0; } + + return templateUri; +} + +SPDesktop* sp_file_new_default() +{ + Glib::ustring templateUri = sp_file_default_template_uri(); + SPDesktop* desk = sp_file_new(sp_file_default_template_uri()); rdf_add_from_preferences( SP_ACTIVE_DOCUMENT ); + return desk; } -- cgit v1.2.3 From 084d7a6ef635846b124644a47fb73df75b62e292 Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 3 Sep 2012 09:45:30 +0900 Subject: Fix for 422644 : Show filename in statusbar on saving (bzr r11648) --- src/file.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 3b24876c4..dcdae1700 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -669,7 +669,8 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, } SP_ACTIVE_DESKTOP->event_log->rememberFileSave(); - SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Document saved.")); + Glib::ustring msg = Glib::ustring::format(_("Document saved."), " ", doc->getURI()); + SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, msg.c_str()); return true; } @@ -945,7 +946,8 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) } } } else { - SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No changes need to be saved.")); + Glib::ustring msg = Glib::ustring::format(_("No changes need to be saved."), " ", doc->getURI()); + SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg.c_str()); success = TRUE; } -- cgit v1.2.3 From bf7c3e8d98b557cb64447804399797d93e1cedc0 Mon Sep 17 00:00:00 2001 From: John Smith Date: Wed, 19 Sep 2012 10:52:19 +0900 Subject: Fix for 643150 : Auto-palette swatches duplicated on copy and paste (bzr r11677) --- src/file.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index dcdae1700..778306d5d 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1142,6 +1142,8 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, place_to_insert = in_doc->getRoot(); } + in_doc->importDefs(doc); + // Construct a new object representing the imported image, // and insert it into the current document. SPObject *new_obj = NULL; @@ -1162,12 +1164,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // don't lose top-level defs or style elements else if (child->getRepr()->type() == Inkscape::XML::ELEMENT_NODE) { const gchar *tag = child->getRepr()->name(); - if (!strcmp(tag, "svg:defs")) { - for ( SPObject *x = child->firstChild(); x; x = x->getNext() ) { - in_defs->getRepr()->addChild(x->getRepr()->duplicate(xml_in_doc), last_def); - } - } - else if (!strcmp(tag, "svg:style")) { + if (!strcmp(tag, "svg:style")) { in_doc->getRoot()->appendChildRepr(child->getRepr()->duplicate(xml_in_doc)); } } -- cgit v1.2.3 From 05c9f6824d14012a71528bd204bcdd4e6624db29 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 11 Oct 2012 12:34:08 +0900 Subject: Fix for 426763 : Cancelling import leads to error message (bzr r11777) --- src/file.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 778306d5d..a03c459da 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -235,12 +235,16 @@ bool sp_file_open(const Glib::ustring &uri, } SPDocument *doc = NULL; + bool cancelled = false; try { doc = Inkscape::Extension::open(key, uri.c_str()); } catch (Inkscape::Extension::Input::no_extension_found &e) { doc = NULL; } catch (Inkscape::Extension::Input::open_failed &e) { doc = NULL; + } catch (Inkscape::Extension::Input::open_cancelled &e) { + doc = NULL; + cancelled = true; } if (desktop) { @@ -287,7 +291,7 @@ bool sp_file_open(const Glib::ustring &uri, } return TRUE; - } else { + } else if (!cancelled) { gchar *safeUri = Inkscape::IO::sanitizeString(uri.c_str()); gchar *text = g_strdup_printf(_("Failed to load the requested file %s"), safeUri); sp_ui_error_dialog(text); @@ -295,6 +299,8 @@ bool sp_file_open(const Glib::ustring &uri, g_free(safeUri); return FALSE; } + + return FALSE; } /** -- cgit v1.2.3 From 4b2c5f1410bce434005641ad6849f2d02a920e82 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 26 Oct 2012 13:39:55 +0200 Subject: Fix for Bug #1070903 (Crash when saving a new document). (bzr r11828) --- src/file.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index a03c459da..cb4ea591c 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -952,7 +952,13 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) } } } else { - Glib::ustring msg = Glib::ustring::format(_("No changes need to be saved."), " ", doc->getURI()); + Glib::ustring msg; + if ( doc->getURI() == NULL ) + { + msg = Glib::ustring::format(_("No changes need to be saved.")); + } else { + msg = Glib::ustring::format(_("No changes need to be saved."), " ", doc->getURI()); + } SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg.c_str()); success = TRUE; } -- cgit v1.2.3 From 258b9b4a5dd01aceebf244522bab72f47b60ea03 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sun, 28 Oct 2012 18:31:24 +0100 Subject: Fix for Bug #1072391 (Save as copy crash). (bzr r11848) --- src/file.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index cb4ea591c..14f70fc8c 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -675,7 +675,12 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, } SP_ACTIVE_DESKTOP->event_log->rememberFileSave(); - Glib::ustring msg = Glib::ustring::format(_("Document saved."), " ", doc->getURI()); + Glib::ustring msg; + if (doc->getURI() == NULL) { + msg = Glib::ustring::format(_("Document saved.")); + } else { + msg = Glib::ustring::format(_("Document saved."), " ", doc->getURI()); + } SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, msg.c_str()); return true; } -- cgit v1.2.3 From c8a761256b40300761c7ff6a0d642ac75b6f541a Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 11 Feb 2013 23:34:59 +0000 Subject: A couple of forward declarations (bzr r12119) --- src/file.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 14f70fc8c..468d02eba 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -62,6 +62,7 @@ #include "ui/view/view-widget.h" #include "uri.h" #include "xml/rebase-hrefs.h" +#include "xml/sp-css-attr.h" #include "verbs.h" #include "event-log.h" #include "ui/dialog/font-substitution.h" -- cgit v1.2.3 From 8764988ec95bd0fc0f26aaa79612284c8b667b9c Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 4 Mar 2013 17:21:11 +0000 Subject: Drop dead Inkboard code. Config flag no longer exists (bzr r12173) --- src/file.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 468d02eba..97087c1a1 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -81,10 +81,6 @@ using Inkscape::DocumentUndo; #include "extension/dbus/dbus-init.h" #endif -//#ifdef WITH_INKBOARD -//#include "jabber_whiteboard/session-manager.h" -//#endif - #ifdef WIN32 #include #endif -- cgit v1.2.3 From 4a4cafd45b5f7ccc2151263e3f05a9331bcb7bb4 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 15 Mar 2013 19:25:30 +0000 Subject: Drop a couple of unused variables and a pixmap (bzr r12210) --- src/file.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 97087c1a1..5737f0a8a 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1124,9 +1124,6 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, prevent_id_clashes(doc, in_doc); - SPObject *in_defs = in_doc->getDefs(); - Inkscape::XML::Node *last_def = in_defs->getRepr()->lastChild(); - SPCSSAttr *style = sp_css_attr_from_object(doc->getRoot()); // Count the number of top-level items in the imported document. -- cgit v1.2.3 From d2bba282171a9e2c70a624794650689ec4531047 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 26 Mar 2013 16:03:49 +0000 Subject: Fix Glibmm inclusions for Gtk+ 3 builds and implement a Gtk+ 3 compatible check for X11 backend Fixed bugs: - https://launchpad.net/bugs/1160252 - https://launchpad.net/bugs/1122774 (bzr r12247) --- src/file.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 5737f0a8a..453ddb546 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -68,8 +68,10 @@ #include "ui/dialog/font-substitution.h" #include -#include + +#include #include +#include using Inkscape::DocumentUndo; -- cgit v1.2.3 From 4a42a32a27979a3e045c3ce8092b66356211705f Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Mon, 15 Apr 2013 20:33:53 +0200 Subject: Fix for Bug #503712 (Personal default template not used) by Slagvi. (bzr r12277) --- src/file.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 453ddb546..5b4110253 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -157,8 +157,8 @@ Glib::ustring sp_file_default_template_uri() baseNames.push_back("default.svg"); gchar *foundTemplate = 0; - for (std::list::iterator nameIt = baseNames.begin(); (nameIt != baseNames.end()) && !foundTemplate; ++nameIt) { - for (std::list::iterator it = sources.begin(); (it != sources.end()) && !foundTemplate; ++it) { + for (std::list::iterator it = sources.begin(); (it != sources.end()) && !foundTemplate; ++it) { + for (std::list::iterator nameIt = baseNames.begin(); (nameIt != baseNames.end()) && !foundTemplate; ++nameIt) { gchar *dirname = *it; if ( Inkscape::IO::file_test( dirname, (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) ) ) { -- cgit v1.2.3 From ec3d3965f0aa7444d42fc8765abbc9c3ed0916ce Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Wed, 3 Jul 2013 13:35:06 +0200 Subject: Templates menu item fixed (bzr r12379.2.6) --- src/file.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 5b4110253..7f8bfc8bf 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -66,6 +66,7 @@ #include "verbs.h" #include "event-log.h" #include "ui/dialog/font-substitution.h" +#include "ui/dialog/new-from-template.h" #include @@ -199,6 +200,13 @@ SPDesktop* sp_file_new_default() return desk; } +SPDesktop* sp_file_new_from_templatee() +{ + Inkscape::UI::NewFromTemplate dl; + dl.run(); + return sp_file_new_default(); +} + /*###################### ## D E L E T E ######################*/ -- cgit v1.2.3 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 From 46211dc227f62c2e71b3edfa1ffb508c9fe8e0ac Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Thu, 4 Jul 2013 16:19:38 +0200 Subject: Added loading templates into NewFromTemplate dialog. (bzr r12379.2.7) --- src/file.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 7f8bfc8bf..9d3c513ab 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -66,7 +66,6 @@ #include "verbs.h" #include "event-log.h" #include "ui/dialog/font-substitution.h" -#include "ui/dialog/new-from-template.h" #include @@ -200,12 +199,6 @@ SPDesktop* sp_file_new_default() return desk; } -SPDesktop* sp_file_new_from_templatee() -{ - Inkscape::UI::NewFromTemplate dl; - dl.run(); - return sp_file_new_default(); -} /*###################### ## D E L E T E -- cgit v1.2.3 From 3d59db609dcae34444b45348c57ac203886576b6 Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Sun, 4 Aug 2013 14:37:48 +0200 Subject: Removing template data from XML tree added (bzr r12379.2.18) --- src/file.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 9d3c513ab..ee205b035 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -227,7 +227,7 @@ sp_file_exit() */ bool sp_file_open(const Glib::ustring &uri, Inkscape::Extension::Extension *key, - bool add_to_recent, bool replace_empty) + int flags) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop) { @@ -252,9 +252,19 @@ bool sp_file_open(const Glib::ustring &uri, } if (doc) { + if (flags & IS_FROM_TEMPLATE){ + Inkscape::XML::Node *myRoot = doc->getReprRoot(); + Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + if (nodeToRemove != NULL){ + sp_repr_unparent(nodeToRemove); + delete nodeToRemove; + DocumentUndo::clearUndo(doc); + } + } + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; - if (existing && existing->virgin && replace_empty) { + if (existing && existing->virgin && (flags & REPLACE_EMPTY)) { // If the current desktop is empty, open the document there doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. desktop->change_document(doc); @@ -268,14 +278,14 @@ bool sp_file_open(const Glib::ustring &uri, doc->virgin = FALSE; - // everyone who cares now has a reference, get rid of ours + // everyone who cares now has a reference, get rid of our`s doc->doUnref(); // resize the window to match the document properties sp_namedview_window_from_document(desktop); sp_namedview_update_layers_from_document(desktop); - if (add_to_recent) { + if (flags & ADD_TO_RECENT) { sp_file_add_recent( doc->getURI() ); } -- cgit v1.2.3 From 625d70be1e222b3cfbbf6527b2829b645f369cd2 Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Tue, 6 Aug 2013 22:48:28 +0200 Subject: Adapted sp_file_new for use with templates (bzr r12379.2.19) --- src/file.cpp | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index ee205b035..258628d32 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -127,21 +127,46 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) { SPDocument *doc = SPDocument::createNewDoc( !templ.empty() ? templ.c_str() : 0 , TRUE, true ); g_return_val_if_fail(doc != NULL, NULL); + + // Remove all the template info from xml tree + Inkscape::XML::Node *myRoot = doc->getReprRoot(); + Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + if (nodeToRemove != NULL){ + sp_repr_unparent(nodeToRemove); + delete nodeToRemove; + DocumentUndo::clearUndo(doc); + } + + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + if (desktop) { + desktop->setWaitingCursor(); + } + + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; + + if (existing && existing->virgin) { + // If the current desktop is empty, open the document there + doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. + desktop->change_document(doc); + doc->emitResizedSignal(doc->getWidth(), doc->getHeight()); + } else { + // create a whole new desktop and window + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. + g_return_val_if_fail(dtw != NULL, NULL); + sp_create_window(dtw, TRUE); + desktop = static_cast(dtw->view); + } - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); - g_return_val_if_fail(dtw != NULL, NULL); doc->doUnref(); - sp_create_window(dtw, TRUE); - SPDesktop *dt = static_cast(dtw->view); - sp_namedview_window_from_document(dt); - sp_namedview_update_layers_from_document(dt); + sp_namedview_window_from_document(desktop); + sp_namedview_update_layers_from_document(desktop); #ifdef WITH_DBUS Inkscape::Extension::Dbus::dbus_init_desktop_interface(dt); #endif - return dt; + return desktop; } Glib::ustring sp_file_default_template_uri() @@ -252,16 +277,7 @@ bool sp_file_open(const Glib::ustring &uri, } if (doc) { - if (flags & IS_FROM_TEMPLATE){ - Inkscape::XML::Node *myRoot = doc->getReprRoot(); - Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); - if (nodeToRemove != NULL){ - sp_repr_unparent(nodeToRemove); - delete nodeToRemove; - DocumentUndo::clearUndo(doc); - } - } - + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; if (existing && existing->virgin && (flags & REPLACE_EMPTY)) { -- cgit v1.2.3 From 7f43184f78f3ab203d6c597639805bf65cd22387 Mon Sep 17 00:00:00 2001 From: su_v Date: Wed, 14 Aug 2013 20:52:42 +0200 Subject: fix build with dbusapi enabled Fixed bugs: - https://launchpad.net/bugs/1212355 (bzr r12477) --- src/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index eb917f169..68e229e62 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -164,7 +164,7 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) sp_namedview_update_layers_from_document(desktop); #ifdef WITH_DBUS - Inkscape::Extension::Dbus::dbus_init_desktop_interface(dt); + Inkscape::Extension::Dbus::dbus_init_desktop_interface(desktop); #endif return desktop; -- cgit v1.2.3 From f10048be170a45921ae8fc65ccd2588a9ad2897d Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 27 Aug 2013 12:32:55 -0400 Subject: Added viewBox implement document unit support. (bzr r12475.1.2) --- src/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 5007cd901..bb66e3330 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -263,7 +263,7 @@ bool sp_file_open(const Glib::ustring &uri, // If the current desktop is empty, open the document there doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. desktop->change_document(doc); - doc->emitResizedSignal(doc->getWidth(), doc->getHeight()); + doc->emitResizedSignal(doc->getWidth().value("px"), doc->getHeight().value("px")); } else { // create a whole new desktop and window SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. -- cgit v1.2.3 From 4eb731d194e43b55a97ad1c9d4f5d095d4b759a0 Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Wed, 18 Sep 2013 17:15:17 +0200 Subject: Opening new documents behaviour fixed. (bzr r12481.1.9) --- src/file.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 68e229e62..12373a2e5 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -139,24 +139,14 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) } SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop) { + if (desktop) desktop->setWaitingCursor(); - } - SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; - if (existing && existing->virgin) { - // If the current desktop is empty, open the document there - doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. - desktop->change_document(doc); - doc->emitResizedSignal(doc->getWidth(), doc->getHeight()); - } else { - // create a whole new desktop and window - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. - g_return_val_if_fail(dtw != NULL, NULL); - sp_create_window(dtw, TRUE); - desktop = static_cast(dtw->view); - } + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. + g_return_val_if_fail(dtw != NULL, NULL); + sp_create_window(dtw, TRUE); + desktop = static_cast(dtw->view); doc->doUnref(); @@ -166,6 +156,9 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) #ifdef WITH_DBUS Inkscape::Extension::Dbus::dbus_init_desktop_interface(desktop); #endif + + if (desktop) + desktop->clearWaitingCursor(); return desktop; } @@ -220,7 +213,7 @@ SPDesktop* sp_file_new_default() { Glib::ustring templateUri = sp_file_default_template_uri(); SPDesktop* desk = sp_file_new(sp_file_default_template_uri()); - rdf_add_from_preferences( SP_ACTIVE_DOCUMENT ); + //rdf_add_from_preferences( SP_ACTIVE_DOCUMENT ); return desk; } -- cgit v1.2.3 From 18bc66ea42cb3e7ad8d2b77ba70bd06d1b88cc7c Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Fri, 20 Sep 2013 16:48:10 +0200 Subject: Change paths storage to std::string. (bzr r12481.1.12) --- src/file.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 12373a2e5..b6063e5cd 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -74,6 +74,8 @@ #include #include +#include + using Inkscape::DocumentUndo; #ifdef WITH_GNOME_VFS @@ -124,7 +126,7 @@ static void sp_file_add_recent(gchar const *uri) /** * Create a blank document and add it to the desktop */ -SPDesktop *sp_file_new(const Glib::ustring &templ) +SPDesktop *sp_file_new(const std::string &templ) { SPDocument *doc = SPDocument::createNewDoc( !templ.empty() ? templ.c_str() : 0 , TRUE, true ); g_return_val_if_fail(doc != NULL, NULL); -- cgit v1.2.3 From 2df0abfd438d90edb6056f0197ed9d27ce2cd1f1 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sun, 22 Sep 2013 13:47:37 -0400 Subject: Fix adding viewBox to new documents. Fixed bugs: - https://launchpad.net/bugs/1228660 - https://launchpad.net/bugs/1228693 - https://launchpad.net/bugs/1228852 (bzr r12575) --- src/file.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index baa7b12b5..b19fe21ff 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -140,6 +140,11 @@ SPDesktop *sp_file_new(const std::string &templ) DocumentUndo::clearUndo(doc); } + // Set viewBox if it doesn't exist + if (!doc->getRoot()->viewBox_set) { + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + } + SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop) desktop->setWaitingCursor(); -- cgit v1.2.3 From 04966dbfbdc8b43e9a02fd939a511be93c6fe9f5 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 26 Sep 2013 21:25:44 +0200 Subject: Fix for Bug #1229605 (inkscape crashes when canceled import pdf). Fixed bugs: - https://launchpad.net/bugs/1229605 (bzr r12595) --- src/file.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index b19fe21ff..e0675e8cf 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1143,7 +1143,8 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - + bool cancelled = false; + //DEBUG_MESSAGE( fileImport, "file_import( in_doc:%p uri:[%s], key:%p", in_doc, uri, key ); SPDocument *doc; try { @@ -1152,6 +1153,9 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, doc = NULL; } catch (Inkscape::Extension::Input::open_failed &e) { doc = NULL; + } catch (Inkscape::Extension::Input::open_cancelled &e) { + doc = NULL; + cancelled = true; } if (doc != NULL) { @@ -1248,7 +1252,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, DocumentUndo::done(in_doc, SP_VERB_FILE_IMPORT, _("Import")); return new_obj; - } else { + } else if (!cancelled) { gchar *text = g_strdup_printf(_("Failed to load the requested file %s"), uri.c_str()); sp_ui_error_dialog(text); g_free(text); -- cgit v1.2.3 From 8e050f3d39cd87caabba365f55b43ede5947ee4e Mon Sep 17 00:00:00 2001 From: buliabyak <> Date: Thu, 3 Oct 2013 20:48:45 -0300 Subject: properly protect the undo stack from deleting templates and setting viewbox (bzr r12651) --- src/file.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index e0675e8cf..8a7b177c0 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -135,14 +135,17 @@ SPDesktop *sp_file_new(const std::string &templ) Inkscape::XML::Node *myRoot = doc->getReprRoot(); Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); if (nodeToRemove != NULL){ + DocumentUndo::setUndoSensitive(doc, false); sp_repr_unparent(nodeToRemove); delete nodeToRemove; - DocumentUndo::clearUndo(doc); + DocumentUndo::setUndoSensitive(doc, true); } // Set viewBox if it doesn't exist if (!doc->getRoot()->viewBox_set) { + DocumentUndo::setUndoSensitive(doc, false); doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + DocumentUndo::setUndoSensitive(doc, true); } SPDesktop *desktop = SP_ACTIVE_DESKTOP; -- cgit v1.2.3 From 651b367a2e01f918435d829394baff45537f6b91 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 24 Oct 2013 17:03:01 +0200 Subject: fix bug "some of the locale-based templates cause objects to be resized when default units are changed" #1236257 Fixed bugs: - https://launchpad.net/bugs/1236257 (bzr r12717) --- src/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 8a7b177c0..f978ec66e 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -144,7 +144,7 @@ SPDesktop *sp_file_new(const std::string &templ) // Set viewBox if it doesn't exist if (!doc->getRoot()->viewBox_set) { DocumentUndo::setUndoSensitive(doc, false); - doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit()))); DocumentUndo::setUndoSensitive(doc, true); } -- cgit v1.2.3 From c04e30df241a3ee039077425bab9b9c37abe2854 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 9 Nov 2013 23:36:13 +0100 Subject: Moved and renamed some tool-related files. (bzr r12785) --- src/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index f978ec66e..cec634c9b 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -36,7 +36,7 @@ #include "dir-util.h" #include "document-private.h" #include "document-undo.h" -#include "event-context.h" +#include "ui/tools/tool-base.h" #include "extension/db.h" #include "extension/input.h" #include "extension/output.h" -- cgit v1.2.3 From 747795541ccf5caf9164921a3fe0fa4534ec6e45 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Thu, 2 Jan 2014 18:22:21 +0100 Subject: memory leak fix (doc_title) + code readability (bzr r12867) --- src/file.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index cec634c9b..cd52d0b86 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -843,19 +843,16 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens if (extension) filename_extension = extension->get_extension(); - Glib::ustring save_path; - Glib::ustring save_loc; - - save_path = Inkscape::Extension::get_file_save_path(doc, save_method); + Glib::ustring save_path = Inkscape::Extension::get_file_save_path(doc, save_method); if (!Inkscape::IO::file_test(save_path.c_str(), (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) - save_path = ""; + save_path.clear(); - if (save_path.size()<1) + if (save_path.empty()) save_path = g_get_home_dir(); - save_loc = save_path; + Glib::ustring save_loc = save_path; save_loc.append(G_DIR_SEPARATOR_S); // TODO fixed buffer is bad: @@ -882,7 +879,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens // Inkscape::IO? Glib::ustring save_loc_local = Glib::filename_from_utf8(save_loc); - if ( save_loc_local.size() > 0) + if (!save_loc_local.empty()) save_loc = save_loc_local; //# Show the SaveAs dialog @@ -909,28 +906,27 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens bool success = saveDialog->show(); if (!success) { delete saveDialog; + if(doc_title) g_free(doc_title); return success; } // set new title here (call RDF to ensure metadata and title element are updated) rdf_set_work_entity(doc, rdf_find_entity("title"), saveDialog->getDocTitle().c_str()); - // free up old string - if(doc_title) g_free(doc_title); Glib::ustring fileName = saveDialog->getFilename(); Inkscape::Extension::Extension *selectionType = saveDialog->getSelectionType(); delete saveDialog; - saveDialog = 0; + if(doc_title) g_free(doc_title); - if (fileName.size() > 0) { + if (!fileName.empty()) { Glib::ustring newFileName = Glib::filename_to_utf8(fileName); - if ( newFileName.size()>0 ) + if (!newFileName.empty()) fileName = newFileName; else - g_warning( "Error converting save filename to UTF-8." ); + g_warning( "Error converting filename for saving to UTF-8." ); Inkscape::Extension::Output *omod = dynamic_cast(selectionType); if (omod) { -- cgit v1.2.3 From 1a3923ceee80f32e42c677381138723b99278e1b Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 6 Jan 2014 22:42:55 +0100 Subject: c-string buffer > Glib::ustring usage (bzr r12885) --- src/file.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index cd52d0b86..babc4df99 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -855,23 +855,18 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens Glib::ustring save_loc = save_path; save_loc.append(G_DIR_SEPARATOR_S); - // TODO fixed buffer is bad: - char formatBuf[256]; int i = 1; if ( !doc->getURI() ) { // We are saving for the first time; create a unique default filename - snprintf(formatBuf, 255, _("drawing%s"), filename_extension.c_str()); - save_loc.append(formatBuf); + save_loc = save_loc + Glib::ustring(_("drawing")) + filename_extension; while (Inkscape::IO::file_test(save_loc.c_str(), G_FILE_TEST_EXISTS)) { save_loc = save_path; save_loc.append(G_DIR_SEPARATOR_S); - snprintf(formatBuf, 255, _("drawing-%d%s"), i++, filename_extension.c_str()); - save_loc.append(formatBuf); + save_loc = save_loc + Glib::ustring::compose(_("drawing-%1"), i++) + filename_extension; } } else { - snprintf(formatBuf, 255, _("%s"), Glib::path_get_basename(doc->getURI()).c_str()); - save_loc.append(formatBuf); + save_loc.append(Glib::path_get_basename(doc->getURI())); } // convert save_loc from utf-8 to locale -- cgit v1.2.3 From 5105f4e289edeb4d0528dff54dbd8e33f98b6cad Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sat, 11 Jan 2014 12:08:00 +0100 Subject: gtkmmification (seems there is more margin in desktop-widget.cpp) (bzr r12915) --- src/file.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index babc4df99..35039fed3 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -360,11 +360,8 @@ void sp_file_revert_dialog() bool do_revert = true; if (doc->isModifiedSinceSave()) { - gchar *text = g_strdup_printf(_("Changes will be lost! Are you sure you want to reload document %s?"), uri); - - bool response = desktop->warnDialog (text); - g_free(text); - + Glib::ustring tmpString = Glib::ustring::compose(_("Changes will be lost! Are you sure you want to reload document %1?"), uri); + bool response = desktop->warnDialog (tmpString); if (!response) { do_revert = false; } -- cgit v1.2.3 From 827547374b8a0a7e0ab10a9ecec19930fa875f58 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Fri, 14 Mar 2014 22:05:27 +0100 Subject: string class usage (bzr r13150) --- src/file.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 35039fed3..55892fffe 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1385,8 +1385,6 @@ sp_file_export_dialog(Gtk::Window &parentWindow) if (doc->uri == NULL) { - char formatBuf[256]; - Glib::ustring filename_extension = ".svg"; extension = dynamic_cast (Inkscape::Extension::db.get(default_extension.c_str())); @@ -1400,15 +1398,14 @@ sp_file_export_dialog(Gtk::Window &parentWindow) if (!Inkscape::IO::file_test(export_path.c_str(), (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) - export_path = ""; + export_path = Glib::ustring(""); - if (export_path.size()<1) + if (export_path.empty()) export_path = g_get_home_dir(); export_loc = export_path; export_loc.append(G_DIR_SEPARATOR_S); - snprintf(formatBuf, 255, _("drawing%s"), filename_extension.c_str()); - export_loc.append(formatBuf); + export_loc += Glib::ustring(_("drawing")) + filename_extension; } else @@ -1420,7 +1417,7 @@ sp_file_export_dialog(Gtk::Window &parentWindow) // is this needed any more, now that everything is handled in // Inkscape::IO? Glib::ustring export_path_local = Glib::filename_from_utf8(export_path); - if ( export_path_local.size() > 0) + if (!export_path_local.empty()) export_path = export_path_local; //# Show the Export dialog -- cgit v1.2.3 From 550eaa7214327d19dcdb0aefdce367e25490021e Mon Sep 17 00:00:00 2001 From: penginsbacon <> Date: Sat, 15 Mar 2014 08:24:37 +0100 Subject: Saving. Fix for Bug #529843 (save a copy reverts to save as) by Tomasz Boczkowski. Fixed bugs: - https://launchpad.net/bugs/529843 (bzr r13154) --- src/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 55892fffe..6c8c5ff85 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -690,7 +690,7 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved.")); return FALSE; } catch (Inkscape::Extension::Output::no_overwrite &e) { - return sp_file_save_dialog(parentWindow, doc, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS); + return sp_file_save_dialog(parentWindow, doc, save_method); } catch (...) { SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved.")); return FALSE; -- cgit v1.2.3 From d952905a04ce27d521e7ae42a3c167259913553f Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sun, 16 Mar 2014 13:03:34 +0100 Subject: string class usage (bzr r13157) --- src/file.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 6c8c5ff85..51e629c7d 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -855,7 +855,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens int i = 1; if ( !doc->getURI() ) { // We are saving for the first time; create a unique default filename - save_loc = save_loc + Glib::ustring(_("drawing")) + filename_extension; + save_loc = save_loc + _("drawing") + filename_extension; while (Inkscape::IO::file_test(save_loc.c_str(), G_FILE_TEST_EXISTS)) { save_loc = save_path; @@ -922,9 +922,9 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens Inkscape::Extension::Output *omod = dynamic_cast(selectionType); if (omod) { - Glib::ustring save_extension = (std::string)omod->get_extension(); - if ( !hasEnding(fileName, save_extension.c_str()) ) { - fileName += save_extension.c_str(); + Glib::ustring save_extension = (omod->get_extension()) ? (omod->get_extension()) : ""; + if ( !hasEnding(fileName, save_extension) ) { + fileName += save_extension; } } @@ -1403,9 +1403,7 @@ sp_file_export_dialog(Gtk::Window &parentWindow) if (export_path.empty()) export_path = g_get_home_dir(); - export_loc = export_path; - export_loc.append(G_DIR_SEPARATOR_S); - export_loc += Glib::ustring(_("drawing")) + filename_extension; + export_loc = export_path + G_DIR_SEPARATOR_S + _("drawing") + filename_extension; } else -- cgit v1.2.3