tomboy r2260 - in branches/gnome-2-24: . Tomboy Tomboy/Synchronization



Author: sharm
Date: Wed Dec 17 21:20:00 2008
New Revision: 2260
URL: http://svn.gnome.org/viewvc/tomboy?rev=2260&view=rev

Log:
* tomboy-gnome-2-24/Tomboy/Note.cs:
* tomboy-gnome-2-24/Tomboy/RemoteControl.cs:
* tomboy-gnome-2-24/Tomboy/Synchronization/SyncDialog.cs:
* tomboy-gnome-2-24/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.
  Backport from trunk r2255.

Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/Tomboy/Note.cs
   branches/gnome-2-24/Tomboy/RemoteControl.cs
   branches/gnome-2-24/Tomboy/Synchronization/SyncDialog.cs
   branches/gnome-2-24/Tomboy/Synchronization/SyncManager.cs

Modified: branches/gnome-2-24/Tomboy/Note.cs
==============================================================================
--- branches/gnome-2-24/Tomboy/Note.cs	(original)
+++ branches/gnome-2-24/Tomboy/Note.cs	Wed Dec 17 21:20:00 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: branches/gnome-2-24/Tomboy/RemoteControl.cs
==============================================================================
--- branches/gnome-2-24/Tomboy/RemoteControl.cs	(original)
+++ branches/gnome-2-24/Tomboy/RemoteControl.cs	Wed Dec 17 21:20:00 2008
@@ -246,7 +246,7 @@
 			note = note_manager.FindByUri (uri);
 			if (note == null)
 				return false;
-			note.LoadForeignNoteXml (xml_contents);
+			note.LoadForeignNoteXml (xml_contents, ChangeType.ContentChanged);
 			return true;
 		}
 

Modified: branches/gnome-2-24/Tomboy/Synchronization/SyncDialog.cs
==============================================================================
--- branches/gnome-2-24/Tomboy/Synchronization/SyncDialog.cs	(original)
+++ branches/gnome-2-24/Tomboy/Synchronization/SyncDialog.cs	Wed Dec 17 21:20:00 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: branches/gnome-2-24/Tomboy/Synchronization/SyncManager.cs
==============================================================================
--- branches/gnome-2-24/Tomboy/Synchronization/SyncManager.cs	(original)
+++ branches/gnome-2-24/Tomboy/Synchronization/SyncManager.cs	Wed Dec 17 21:20:00 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]