summaryrefslogtreecommitdiffstats
path: root/src/file.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2012-12-16 05:41:25 +0000
committer~suv <suv-sf@users.sourceforge.net>2012-12-16 05:41:25 +0000
commit7ec903c9898f872dbd9426ed7a62e1969fdb7be7 (patch)
treea306139e829118a83516af02279c9eafd3440eaa /src/file.cpp
parentHershey Text: whitespace; py: docstring, modeline; inx: fix attribute value (diff)
parentTranslations.Spanish translation update by Lucas Vieites. (diff)
downloadinkscape-7ec903c9898f872dbd9426ed7a62e1969fdb7be7.tar.gz
inkscape-7ec903c9898f872dbd9426ed7a62e1969fdb7be7.zip
merge from trunk (r11955)
(bzr r11687.1.3)
Diffstat (limited to 'src/file.cpp')
-rw-r--r--src/file.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/file.cpp b/src/file.cpp
index 778306d5d..14f70fc8c 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;
}
/**
@@ -669,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;
}
@@ -946,7 +957,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;
}