Code

now that selection description includes style (filtered, clipped), we need to update...
[inkscape.git] / src / file.cpp
index d5700bb6e47186ada7a6c6307d9781ce802ba5e9..5c729eeeb65b1032a8c61cb0ca255d6bdbcad34a 100644 (file)
@@ -96,10 +96,14 @@ static void sp_file_add_recent(gchar const *uri)
 {
     GtkRecentManager *recent = gtk_recent_manager_get_default();
     gchar *fn = g_filename_from_utf8(uri, -1, NULL, NULL, NULL);
-    gchar *uri_to_add = g_filename_to_uri(fn, NULL, NULL);
-    gtk_recent_manager_add_item(recent, uri_to_add);
-    g_free(uri_to_add);
-    g_free(fn);
+    if (fn) {
+        gchar *uri_to_add = g_filename_to_uri(fn, NULL, NULL);
+        if (uri_to_add) {
+            gtk_recent_manager_add_item(recent, uri_to_add);
+            g_free(uri_to_add);
+        }
+        g_free(fn);
+    }
 }
 
 
@@ -194,6 +198,10 @@ sp_file_open(const Glib::ustring &uri,
              Inkscape::Extension::Extension *key,
              bool add_to_recent, bool replace_empty)
 {
+    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+    if (desktop)
+        desktop->setWaitingCursor();
+
     SPDocument *doc = NULL;
     try {
         doc = Inkscape::Extension::open(key, uri.c_str());
@@ -203,8 +211,10 @@ sp_file_open(const Glib::ustring &uri,
         doc = NULL;
     }
 
+    if (desktop)
+        desktop->clearWaitingCursor();
+
     if (doc) {
-        SPDesktop *desktop = SP_ACTIVE_DESKTOP;
         SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL;
 
         if (existing && existing->virgin && replace_empty) {
@@ -589,6 +599,9 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri,
         g_free(text);
         g_free(safeUri);
         return FALSE;
+    } catch (Inkscape::Extension::Output::save_cancelled &e) {
+        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);
     }
@@ -1003,7 +1016,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri,
                 bool const saved_pref = prefs->getBool("/options/transform/pattern", true);
                 prefs->setBool("/options/transform/pattern", true);
                 sp_document_ensure_up_to_date(sp_desktop_document(desktop));
-                boost::optional<Geom::Rect> sel_bbox = selection->bounds();
+                Geom::OptRect sel_bbox = selection->bounds();
                 if (sel_bbox) {
                     Geom::Point m( desktop->point() - sel_bbox->midpoint() );
                     sp_selection_move_relative(selection, m);