[tomboy] Add --uninstalled option, modeled after Banshee



commit 656f9cd86ebe93b3f307bccfda0b0255e8d3dc64
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Sat Jun 26 07:01:15 2010 -0700

    Add --uninstalled option, modeled after Banshee
    
    https://bugzilla.gnome.org/show_bug.cgi?id=431833

 Tomboy/AddinManager.cs |    7 ++++---
 Tomboy/Tomboy.cs       |   16 ++++++++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/Tomboy/AddinManager.cs b/Tomboy/AddinManager.cs
index d784c36..9576dd1 100644
--- a/Tomboy/AddinManager.cs
+++ b/Tomboy/AddinManager.cs
@@ -59,7 +59,8 @@ namespace Tomboy
 				}
 			}
 
-			string addins_dir = Path.Combine (tomboy_conf_dir, "addins");
+			string addins_dir = Tomboy.Uninstalled ? ".":
+				Path.Combine (tomboy_conf_dir, "addins");
 			if (!Directory.Exists (addins_dir))
 				Directory.CreateDirectory (addins_dir);
 
@@ -83,13 +84,13 @@ namespace Tomboy
 				                                      "<Addins>\n" +
 				                                      "\t<Directory>{0}</Directory>\n" +
 				                                      "</Addins>\n",
-				                                      Defines.SYS_ADDINS_DIR);
+				                                      Tomboy.Uninstalled ? "./addins" : Defines.SYS_ADDINS_DIR);
 				sw.Write (addins_file_contents);
 			}
 
 			Mono.Addins.AddinManager.AddinLoaded += OnAddinLoaded;
 			Mono.Addins.AddinManager.AddinUnloaded += OnAddinUnloaded;
-			Mono.Addins.AddinManager.Initialize (tomboy_conf_dir);
+			Mono.Addins.AddinManager.Initialize (Tomboy.Uninstalled ? "." : tomboy_conf_dir);
 			UpgradeOldAddinConfig ();
 			if (Tomboy.Debugging) {
 				Mono.Addins.AddinManager.Registry.Rebuild (null);
diff --git a/Tomboy/Tomboy.cs b/Tomboy/Tomboy.cs
index efd204e..3b2b099 100644
--- a/Tomboy/Tomboy.cs
+++ b/Tomboy/Tomboy.cs
@@ -11,6 +11,7 @@ namespace Tomboy
 	public class Tomboy : Application
 	{
 		static bool debugging;
+		static bool uninstalled;
 		static NoteManager manager;
 		static TomboyTrayIcon tray_icon;
 		static TomboyTray tray = null;
@@ -57,6 +58,7 @@ namespace Tomboy
 
 			TomboyCommandLine cmd_line = new TomboyCommandLine (args);
 			debugging = cmd_line.Debug;
+			uninstalled = cmd_line.Uninstalled;
 
 			if (!RemoteControlProxy.FirstInstance) {
 				if (!cmd_line.NeedsExecute)
@@ -159,6 +161,11 @@ namespace Tomboy
 			get { return debugging; }
 		}
 
+		public static bool Uninstalled
+		{
+			get { return uninstalled; }
+		}
+
 		static string GetNotePath (string override_path)
 		{
 			// Default note location, as specified in --note-path or $TOMBOY_PATH
@@ -505,6 +512,12 @@ namespace Tomboy
 			get { return debug; }
 		}
 
+		// TODO: Document this option
+		public bool Uninstalled
+		{
+			get; private set;
+		}
+
 		public bool UsePanelApplet
 		{
 			get {
@@ -583,6 +596,9 @@ namespace Tomboy
 				case "--debug":
 					debug = true;
 					break;
+				case "--uninstalled":
+					Uninstalled = true;
+					break;
 				case "--new-note":
 					// Get optional name for new note...
 					if (idx + 1 < args.Length



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