[tomboy] Add SyncManager.ResetClient, use instead of NukeSyncClientManifest



commit de1a890a851864f12e25b4976af3aec72b0210a3
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Mon Jun 29 08:23:51 2009 -0700

    Add SyncManager.ResetClient, use instead of NukeSyncClientManifest
    in PreferencesDialog.

 Tomboy/PreferencesDialog.cs           |   24 ++----------------------
 Tomboy/Synchronization/SyncManager.cs |   10 ++++++++++
 2 files changed, 12 insertions(+), 22 deletions(-)
---
diff --git a/Tomboy/PreferencesDialog.cs b/Tomboy/PreferencesDialog.cs
index 2c34c44..b5bb69f 100644
--- a/Tomboy/PreferencesDialog.cs
+++ b/Tomboy/PreferencesDialog.cs
@@ -1091,7 +1091,7 @@ namespace Tomboy
 			        Preferences.SYNC_CONFIGURED_CONFLICT_BEHAVIOR,
 			        Preferences.GetDefault (Preferences.SYNC_CONFIGURED_CONFLICT_BEHAVIOR));
 
-			NukeSyncClientManifest ();
+			SyncManager.ResetClient ();
 
 			syncAddinCombo.Sensitive = true;
 			resetSyncAddinButton.Sensitive = false;
@@ -1100,26 +1100,6 @@ namespace Tomboy
 				syncAddinPrefsWidget.Sensitive = true;
 		}
 
-		// TODO: This class shouldn't know about the manifest.
-		//       Abstract this out somehow (ie, SyncManager.ResetClient()
-		//       or something like that).
-		void NukeSyncClientManifest ()
-		{
-			// Nuke ~/.tomboy/manifest.xml
-			string clientManifestPath = System.IO.Path.Combine (
-			                                    Tomboy.DefaultNoteManager.NoteDirectoryPath,
-			                                    "manifest.xml");
-			if (System.IO.File.Exists (clientManifestPath) == true) {
-				try {
-					System.IO.File.Delete (clientManifestPath);
-				} catch (Exception e) {
-					Logger.Debug ("Error deleting \"{0}\" during reset: {1}",
-					              clientManifestPath,
-					              e.Message);
-				}
-			}
-		}
-
 		/// <summary>
 		/// Attempt to save/test the connection to the sync addin.
 		/// </summary>
@@ -1155,7 +1135,7 @@ namespace Tomboy
 				resetSyncAddinButton.Sensitive = true;
 				saveSyncAddinButton.Sensitive = false;
 
-				NukeSyncClientManifest ();
+				SyncManager.ResetClient ();
 
 				// Give the user a visual letting them know that connecting
 				// was successful.
diff --git a/Tomboy/Synchronization/SyncManager.cs b/Tomboy/Synchronization/SyncManager.cs
index e2d7924..901a995 100644
--- a/Tomboy/Synchronization/SyncManager.cs
+++ b/Tomboy/Synchronization/SyncManager.cs
@@ -209,6 +209,16 @@ namespace Tomboy.Sync
 			Tomboy.ActionManager["SyncNotesAction"].Sensitive = !string.IsNullOrEmpty (sync_addin_id);
 		}
 
+		public static void ResetClient ()
+		{
+			try {
+				client.Reset ();
+			} catch (Exception e) {
+				Logger.Debug ("Error deleting client manifest during reset: {1}",
+				              e.Message);
+			}
+		}
+
 		public static void PerformSynchronization ()
 		{
 			if (syncThread != null) {



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