From: dooglus Date: Thu, 20 Sep 2007 20:53:22 +0000 (+0000) Subject: Fix 1796971: if the user tries to quit synfig or close a document when there's unsave... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=ab620bb940bf31053b0a31d108073375d4cdf663;p=synfig.git Fix 1796971: if the user tries to quit synfig or close a document when there's unsaved work, it will prompt whether to save or not. If the user says 'yes, save', then cancels the file selector, studio will now ask again "do you want to save", rather than closing it immediately. This seems more polite, and safer. git-svn-id: http://svn.voria.com/code@724 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/instance.cpp b/synfig-studio/trunk/src/gtkmm/instance.cpp index fc45528..81d692c 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.cpp +++ b/synfig-studio/trunk/src/gtkmm/instance.cpp @@ -626,14 +626,17 @@ Instance::safe_close() uim=find_canvas_view(get_canvas())->get_ui_interface(); if(get_action_count()) - { - 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) - save(); - if(answer==synfigapp::UIInterface::RESPONSE_CANCEL) - return false; - } + do + { + 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; + if(answer==synfigapp::UIInterface::RESPONSE_NO) + break; + if(answer==synfigapp::UIInterface::RESPONSE_CANCEL) + return false; + } while (true); if(is_modified()) {