[glom/feature_backup2: 4/6] Save as Example: Reset the old file URI and allow auto-saving again.



commit 8efa33aa1132055bc40618a1db041972865d79ef
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jul 2 10:28:34 2010 +0200

    Save as Example: Reset the old file URI and allow auto-saving again.
    
    	* glom/application.cc: on_menu_file_save_as_example(): reset the old file
    	URI and turn auto-saving back on again, because it makes no sense to leave
    	the user editing an example document. This is really an export anyway.
    	This allows the user to close the window again after saving as an example.

 ChangeLog           |   17 +++++++++++++++++
 glom/application.cc |    7 ++++---
 2 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3262e33..53f459e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-02  Murray Cumming  <murrayc murrayc com>
+
+	Save as Example: Reset the old file URI and allow auto-saving again.
+
+	* glom/application.cc: on_menu_file_save_as_example(): reset the old file 
+	URI and turn auto-saving back on again, because it makes no sense to leave 
+	the user editing an example document. This is really an export anyway.
+	This allows the user to close the window again after saving as an example.
+
+2010-07-02  Murray Cumming  <murrayc murrayc com>
+
+	Document: Avoid a crash when creating the parent directory.
+	
+	* glom/libglom/docment/bakery/document.cc: write_to_disk(): Check the 
+	result of Gio::File::get_parent() for null, because that happens if we 
+	provide a path instead of a URI.
+
 2010-07-01  Murray Cumming  <murrayc murrayc com>
 
 	Add Save Backup menu item.
diff --git a/glom/application.cc b/glom/application.cc
index 1235575..4150641 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -2169,13 +2169,14 @@ void Application::on_menu_file_save_as_example()
         document->set_table_example_data(table_name, example_rows);
       }
 
+      const bool bTest = document->save();
+      document->set_is_example_file(false);
+      document->set_file_uri(file_uriOld);
       document->set_allow_autosave(true);
 
-      bool bTest = document->save();
-
       if(!bTest)
       {
-        ui_warning(_("Save failed."), _("There was an error while saving the file. Your changes have not been saved."));
+        ui_warning(_("Save failed."), _("There was an error while saving the example file."));
       }
       else
       {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]