tomboy r2255 - in trunk: . Tomboy Tomboy/Synchronization



Author: sharm
Date: Mon Dec 15 17:54:29 2008
New Revision: 2255
URL: http://svn.gnome.org/viewvc/tomboy?rev=2255&view=rev

Log:
* Tomboy/Note.cs:
* Tomboy/RemoteControl.cs:
* Tomboy/Synchronization/SyncDialog.cs:
* Tomboy/Synchronization/SyncManager.cs: Add QueueSave to the end of
Note.LoadForeignNoteXml. Callers can specify change type. Fixes a problem
in sync (hard to reproduce) where downloaded notes never got saved to a
note file, and on subsequent syncs they would appear to be deleted. This
would cause mass deletion of notes.

Modified:
   trunk/ChangeLog
   trunk/Tomboy/Note.cs
   trunk/Tomboy/RemoteControl.cs
   trunk/Tomboy/Synchronization/SyncDialog.cs
   trunk/Tomboy/Synchronization/SyncManager.cs

Modified: trunk/Tomboy/Note.cs
==============================================================================
--- trunk/Tomboy/Note.cs	(original)
+++ trunk/Tomboy/Note.cs	Mon Dec 15 17:54:29 2008
@@ -789,7 +789,7 @@
 
 		// Reload note data from a complete note XML string
 		// Should referesh note window, too
-		public void LoadForeignNoteXml (string foreignNoteXml)
+		public void LoadForeignNoteXml (string foreignNoteXml, ChangeType changeType)
 		{
 			if (foreignNoteXml == null)
 				throw new ArgumentNullException ("foreignNoteXml");
@@ -852,7 +852,8 @@
 
 			xml.Close ();
 
-			// TODO: Any reason to queue a save here?  Maybe not for sync but for others?
+			// Allow method caller to specify ChangeType (mostly needed by sync)
+			QueueSave (changeType);
 		}
 
 		// TODO: CODE DUPLICATION SUCKS

Modified: trunk/Tomboy/RemoteControl.cs
==============================================================================
--- trunk/Tomboy/RemoteControl.cs	(original)
+++ trunk/Tomboy/RemoteControl.cs	Mon Dec 15 17:54:29 2008
@@ -248,7 +248,7 @@
 			note = note_manager.FindByUri (uri);
 			if (note == null)
 				return false;
-			note.LoadForeignNoteXml (xml_contents);
+			note.LoadForeignNoteXml (xml_contents, ChangeType.ContentChanged);
 			return true;
 		}
 

Modified: trunk/Tomboy/Synchronization/SyncDialog.cs
==============================================================================
--- trunk/Tomboy/Synchronization/SyncDialog.cs	(original)
+++ trunk/Tomboy/Synchronization/SyncDialog.cs	Mon Dec 15 17:54:29 2008
@@ -471,7 +471,7 @@
 			Note renamedNote = Tomboy.DefaultNoteManager.Create (newTitle, newContent);
 			if (newCompleteContent != null) {// TODO: Anything to do if it is null?
 				try {
-					renamedNote.LoadForeignNoteXml (newCompleteContent);
+					renamedNote.LoadForeignNoteXml (newCompleteContent, ChangeType.OtherDataChanged);
 				} catch {} // TODO: Handle exception in case that newCompleteContent is invalid XML
 			}
 		if (noteOpen)

Modified: trunk/Tomboy/Synchronization/SyncManager.cs
==============================================================================
--- trunk/Tomboy/Synchronization/SyncManager.cs	(original)
+++ trunk/Tomboy/Synchronization/SyncManager.cs	Mon Dec 15 17:54:29 2008
@@ -571,8 +571,8 @@
 		private static void UpdateLocalNote (Note localNote, NoteUpdate serverNote, NoteSyncType syncType)
 		{
 			// In each case, update existingNote's content and revision
-			try {
-				localNote.LoadForeignNoteXml (serverNote.XmlContent);
+			try {
+				localNote.LoadForeignNoteXml (serverNote.XmlContent, ChangeType.OtherDataChanged);
 			} catch {} // TODO: Handle exception in case that serverNote.XmlContent is invalid XML
 			client.SetRevision (localNote, serverNote.LatestRevision);
 



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