[tomboy] adding sync from main menu, Bug 468459



commit 58b437287814eda3711c5b5bf89cfb69ebc4cee6
Author: Buchner Johannes <buchner johannes gmx at>
Date:   Wed Jul 22 03:54:33 2009 +1200

    adding sync from main menu, Bug 468459

 Tomboy/Tray.cs |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/Tomboy/Tray.cs b/Tomboy/Tray.cs
index 62e6cdd..2c67847 100644
--- a/Tomboy/Tray.cs
+++ b/Tomboy/Tray.cs
@@ -137,6 +137,7 @@ namespace Tomboy
 		TomboyTray tray;
 		TomboyPrefsKeybinder keybinder;
 		Gtk.Menu context_menu;
+		Gtk.ImageMenuItem sync_menu_item;
 
 		public TomboyTrayIcon (NoteManager manager)
 		{
@@ -222,7 +223,21 @@ namespace Tomboy
 				Logger.Error ("Exception in GetTrayMenuPosition: " + e.ToString ());
 			}
 		}
-		
+
+		void Preferences_SettingChanged (object sender, EventArgs args)
+		{
+			// Update items based on configuration.
+			UpdateMenuItems ();
+		}
+
+		void UpdateMenuItems ()
+		{
+			// Is synchronization configured and active?
+			string sync_addin_id = Preferences.Get (Preferences.SYNC_SELECTED_SERVICE_ADDIN)
+				as string;
+			sync_menu_item.Sensitive = !string.IsNullOrEmpty (sync_addin_id);
+		}
+
 		Gtk.Menu GetRightClickMenu ()
 		{
 			if (tray.TomboyTrayMenu != null)
@@ -240,6 +255,15 @@ namespace Tomboy
 
 			Gtk.ImageMenuItem item;
 
+			sync_menu_item = new Gtk.ImageMenuItem (Catalog.GetString ("S_ynchronize Notes"));
+			sync_menu_item.Image = new Gtk.Image (Gtk.Stock.Convert, Gtk.IconSize.Menu);
+			UpdateMenuItems();
+			Preferences.SettingChanged += Preferences_SettingChanged;
+			sync_menu_item.Activated += SyncNotes;
+			context_menu.Append (sync_menu_item);
+
+			context_menu.Append (new Gtk.SeparatorMenuItem ());
+
 			item = new Gtk.ImageMenuItem (Catalog.GetString ("_Preferences"));
 			item.Image = new Gtk.Image (Gtk.Stock.Preferences, Gtk.IconSize.Menu);
 			item.Activated += ShowPreferences;
@@ -271,6 +295,11 @@ namespace Tomboy
 			Tomboy.ActionManager ["ShowPreferencesAction"].Activate ();
 		}
 
+		void SyncNotes (object sender, EventArgs args)
+		{
+			Tomboy.ActionManager ["NoteSynchronizationAction"].Activate ();
+		}
+
 		void ShowHelpContents (object sender, EventArgs args)
 		{
 			Tomboy.ActionManager ["ShowHelpAction"].Activate ();



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