'quit -> "want to save?" -> yes -> cancel' should go back to working on the unsaved...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 21 Sep 2007 22:00:04 +0000 (22:00 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 21 Sep 2007 22:00:04 +0000 (22:00 +0000)
git-svn-id: http://svn.voria.com/code@732 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/instance.cpp
synfig-studio/trunk/src/gtkmm/instance.h
synfig-studio/trunk/src/gtkmm/toolbox.cpp

index 2b3cf90..2eb4762 100644 (file)
@@ -199,16 +199,22 @@ studio::Instance::save_as(const synfig::String &file_name)
        return false;
 }
 
-bool
+Instance::Status
 studio::Instance::save()
 {
        // the filename will be set to "Synfig Animation 1" or some such when first created
        // and will be changed to an absolute path once it has been saved
        // so if it still begins with "Synfig Animation " then we need to ask where to save it
        if(get_file_name().find(DEFAULT_FILENAME_PREFIX)==0)
-               return dialog_save_as();
+               if (dialog_save_as())
+                       return STATUS_OK;
+               else
+                       return STATUS_CANCEL;
 
-       return synfigapp::Instance::save();
+       if (synfigapp::Instance::save())
+               return STATUS_OK;
+       else
+               return STATUS_ERROR;
 }
 
 bool
@@ -635,7 +641,11 @@ Instance::safe_close()
                        string str=strprintf(_("Would you like to save your changes to %s?"),basename(get_file_name()).c_str() );
                        int answer=uim->yes_no_cancel(get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES);
                        if(answer==synfigapp::UIInterface::RESPONSE_YES)
-                               if (save()) break;
+                       {
+                               enum Status status = save();
+                               if (status == STATUS_OK) break;
+                               else if (status == STATUS_CANCEL) return false;
+                       }
                        if(answer==synfigapp::UIInterface::RESPONSE_NO)
                                break;
                        if(answer==synfigapp::UIInterface::RESPONSE_CANCEL)
index b7cc495..4c23d38 100644 (file)
@@ -55,6 +55,13 @@ class Instance : public synfigapp::Instance
 public:
        typedef std::list< etl::handle<CanvasView> > CanvasViewList;
 
+       enum Status
+       {
+               STATUS_OK,
+               STATUS_ERROR,
+               STATUS_CANCEL
+       };
+
        class CanvasTreeModel : public Gtk::TreeModel::ColumnRecord
        {
        public:
@@ -174,7 +181,7 @@ public:
        //! returns true if the save was successful
        bool dialog_save_as();
 
-       bool save();
+       Status save();
 
        void dialog_cvs_commit();
 
index 22ba151..6764b88 100644 (file)
@@ -131,7 +131,7 @@ save_selected_instance()
                return;
        }
 
-       if(!studio::App::get_selected_instance()->save())
+       if(studio::App::get_selected_instance()->save() == studio::Instance::STATUS_ERROR)
                App::dialog_error_blocking("Save - Error","Unable to save file");
 }