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