tomboy r2050 - in trunk: . Tomboy



Author: sharm
Date: Sat Aug  2 14:54:43 2008
New Revision: 2050
URL: http://svn.gnome.org/viewvc/tomboy?rev=2050&view=rev

Log:
* Tomboy/Note.cs: Don't crash if there's an error saving note data. 
  Show the user an irritating dialog to let them know their data
  isn't getting saved.  Should only happen in bizarre situations like
  running out of disk space or messing up home directory permissions.
   Fixes bug #460642.

Modified:
   trunk/ChangeLog
   trunk/Tomboy/Note.cs

Modified: trunk/Tomboy/Note.cs
==============================================================================
--- trunk/Tomboy/Note.cs	(original)
+++ trunk/Tomboy/Note.cs	Sat Aug  2 14:54:43 2008
@@ -496,7 +496,13 @@
 
 			Logger.Log ("Saving '{0}'...", data.Data.Title);
 
-			NoteArchiver.Write (filepath, data.GetDataSynchronized ());
+			try {
+				NoteArchiver.Write (filepath, data.GetDataSynchronized ());
+			} catch (Exception e) {
+				// Probably IOException or UnauthorizedAccessException?
+				Logger.Error ("Exception while saving note: " + e.ToString ());
+				NoteUtils.ShowIOErrorDialog (window);
+			}
 
 			if (Saved != null)
 				Saved (this);
@@ -1465,5 +1471,23 @@
 
 			dialog.Destroy();
 		}
+		
+		public static void ShowIOErrorDialog (Gtk.Window parent)
+		{
+			HIGMessageDialog dialog =
+				new HIGMessageDialog (
+				                      parent,
+				                      Gtk.DialogFlags.DestroyWithParent,
+				                      Gtk.MessageType.Error,
+				                      Gtk.ButtonsType.Ok,
+				                      Catalog.GetString ("Error saving note data."),
+				                      Catalog.GetString ("An error occurred while saving your notes. " +
+				                                         "Please check that you have sufficient disk " +
+				                                         "space, and that you have appropriate rights " +
+				                                         "on ~/.tomboy. Error details can be found in " +
+				                                         "~/.tomboy.log."));
+			dialog.Run ();
+			dialog.Destroy ();
+		}
 	}
 }



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