From: dooglus Date: Fri, 21 Sep 2007 22:00:04 +0000 (+0000) Subject: 'quit -> "want to save?" -> yes -> cancel' should go back to working on the unsaved... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=b08d1e8f61500392efbe15e599245d3b68e55594;p=synfig.git 'quit -> "want to save?" -> yes -> cancel' should go back to working on the unsaved document immediately. git-svn-id: http://svn.voria.com/code@732 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/instance.cpp b/synfig-studio/trunk/src/gtkmm/instance.cpp index 2b3cf90..2eb4762 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.cpp +++ b/synfig-studio/trunk/src/gtkmm/instance.cpp @@ -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) diff --git a/synfig-studio/trunk/src/gtkmm/instance.h b/synfig-studio/trunk/src/gtkmm/instance.h index b7cc495..4c23d38 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.h +++ b/synfig-studio/trunk/src/gtkmm/instance.h @@ -55,6 +55,13 @@ class Instance : public synfigapp::Instance public: typedef std::list< etl::handle > 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(); diff --git a/synfig-studio/trunk/src/gtkmm/toolbox.cpp b/synfig-studio/trunk/src/gtkmm/toolbox.cpp index 22ba151..6764b88 100644 --- a/synfig-studio/trunk/src/gtkmm/toolbox.cpp +++ b/synfig-studio/trunk/src/gtkmm/toolbox.cpp @@ -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"); }