diff options
Diffstat (limited to 'src/file.cpp')
| -rw-r--r-- | src/file.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/file.cpp b/src/file.cpp index 35039fed3..51e629c7d 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; @@ -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<Inkscape::Extension::Output *>(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; } } @@ -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::Output *> (Inkscape::Extension::db.get(default_extension.c_str())); @@ -1400,15 +1398,12 @@ 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 = export_path + G_DIR_SEPARATOR_S + _("drawing") + filename_extension; } else @@ -1420,7 +1415,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 |
