Revision: 7476
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7476&view=rev
Author:   vadz
Date:     2008-05-13 13:03:08 -0700 (Tue, 13 May 2008)

Log Message:
-----------
propose to retry if saving the options fails on program exit; check error 
return value from Profile::FlushAll() in another place too

Modified Paths:
--------------
    trunk/M/src/classes/MApplication.cpp
    trunk/M/src/gui/wxMApp.cpp

Modified: trunk/M/src/classes/MApplication.cpp
===================================================================
--- trunk/M/src/classes/MApplication.cpp        2008-05-13 19:43:11 UTC (rev 
7475)
+++ trunk/M/src/classes/MApplication.cpp        2008-05-13 20:03:08 UTC (rev 
7476)
@@ -702,7 +702,30 @@
       // clean up
       MEventManager::DispatchPending();
       AdbManager::Delete();
-      Profile::FlushAll();
+
+      // if saving the options failed it could be because of some transient
+      // error (e.g. the user pulled out the USB removal disk which contains
+      // our configuration files), give him the opportunity to correct it as
+      // otherwise changes would be simply lost
+      for ( bool flushed = false; !flushed; )
+      {
+         flushed = Profile::FlushAll();
+
+         if ( !flushed )
+         {
+            // show the error messages which could have been generated at wx
+            // level
+            wxLog::FlushActive();
+
+            if ( !MDialog_YesNoDialog
+                 (
+                  _("Saving the program options failed, would you like to 
retry?\n"
+                    "\n"
+                    "Otherwise changes to the program configuration could be 
lost.")
+                 ) )
+               break;
+         }
+      }
    }
 
    if ( m_profile )

Modified: trunk/M/src/gui/wxMApp.cpp
===================================================================
--- trunk/M/src/gui/wxMApp.cpp  2008-05-13 19:43:11 UTC (rev 7475)
+++ trunk/M/src/gui/wxMApp.cpp  2008-05-13 20:03:08 UTC (rev 7476)
@@ -167,9 +167,9 @@
  */
 static int SaveAll()
 {
-   int rc = Composer::SaveAll();
+   bool rc = Composer::SaveAll() != -1;
 
-   Profile::FlushAll();
+   rc &= Profile::FlushAll();
 
    MfStatusCache::Flush();
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to