tomboy r1991 - in trunk: . Tomboy



Author: orph
Date: Wed Apr 30 21:12:23 2008
New Revision: 1991
URL: http://svn.gnome.org/viewvc/tomboy?rev=1991&view=rev

Log:
2008-04-30  Alex Graveley  <alex beatniksoftware com>

	* Tomboy/NoteWindow.cs: Mark Search, Link, and Text toolbar items
	as important, so labels are shown for them in text-beside-icons
	toolbar mode (bug #528844).

	* Tomboy/Tray.cs: Bump default title truncation to 100 from 45.
	Fixup indenting.

	* Tomboy/Tomboy.cs: Don't indent #if ENABLE_DBUS checks.



Modified:
   trunk/ChangeLog
   trunk/Tomboy/NoteWindow.cs
   trunk/Tomboy/Tomboy.cs
   trunk/Tomboy/Tray.cs

Modified: trunk/Tomboy/NoteWindow.cs
==============================================================================
--- trunk/Tomboy/NoteWindow.cs	(original)
+++ trunk/Tomboy/NoteWindow.cs	Wed Apr 30 21:12:23 2008
@@ -6,12 +6,13 @@
 using System.Text;
 using Mono.Unix;
 using Gtk;
+
 namespace Tomboy
 {
 	public class NoteWindow : ForcedPresentWindow
 	{
 		Note note;
-		
+
 		Gtk.AccelGroup accel_group;
 		Gtk.Toolbar toolbar;
 		Gtk.Tooltips toolbar_tips;
@@ -33,8 +34,8 @@
 		// and a Gtk.TextView as the body.
 		//
 
-public NoteWindow (Note note) :
-		base (note.Title)
+		public NoteWindow (Note note)
+			: base (note.Title)
 		{
 			this.note = note;
 			this.IconName = "tomboy";
@@ -106,7 +107,7 @@
 			// Don't set up Ctrl-W or Ctrl-N if Emacs is in use
 			bool using_emacs = false;
 			string gtk_key_theme = (string)
-			                       Preferences.Get ("/desktop/gnome/interface/gtk_key_theme");
+				Preferences.Get ("/desktop/gnome/interface/gtk_key_theme");
 			if (gtk_key_theme != null && gtk_key_theme.CompareTo ("Emacs") == 0)
 				using_emacs = true;
 
@@ -179,7 +180,6 @@
 			                            Gtk.AccelFlags.Visible);
 
 			this.Add (box);
-			
 		}
 
 		protected override bool OnDeleteEvent (Gdk.Event evnt)
@@ -201,7 +201,7 @@
 		}
 
 		void OnEscapeSettingChanged (object sender, GConf.NotifyEventArgs args)
-		{	
+		{
 			// enable escape key
 			if ((bool) args.Value)
 				KeyPressEvent += KeyPressed;
@@ -251,7 +251,7 @@
 				// Close windows on the same workspace, or all
 				// open windows if no workspace.
 				if (workspace < 0 ||
-				                tomboy_window_get_workspace (iter.Window.Handle) == workspace) {
+				    tomboy_window_get_workspace (iter.Window.Handle) == workspace) {
 					iter.Window.CloseWindowHandler (null, null);
 				}
 			}
@@ -284,7 +284,7 @@
 				return toolbar;
 			}
 		}
-		
+
 		/// <summary>
 		/// The Delete Toolbar Button
 		/// </summary>
@@ -434,10 +434,13 @@
 		{
 			Gtk.Toolbar tb = new Gtk.Toolbar ();
 			tb.Tooltips = true;
-			
+
 			toolbar_tips = new Gtk.Tooltips ();
-			
-			Gtk.ToolButton search = new Gtk.ToolButton (new Gtk.Image (Gtk.Stock.Find, tb.IconSize), Catalog.GetString ("Search"));
+
+			Gtk.ToolButton search = new Gtk.ToolButton (
+				new Gtk.Image (Gtk.Stock.Find, tb.IconSize),
+				Catalog.GetString ("Search"));
+			search.IsImportant = true;
 			search.Clicked += SearchActivate;
 			toolbar_tips.SetTip (search, Catalog.GetString ("Search your notes (Ctrl-Shift-F)"), null);
 			search.AddAccelerator ("clicked",
@@ -448,11 +451,17 @@
 			                       Gtk.AccelFlags.Visible);
 			search.ShowAll ();
 			tb.Insert (search, -1);
-			
-			link_button = new Gtk.ToolButton (new Gtk.Image (Gtk.Stock.JumpTo, tb.IconSize), Catalog.GetString ("Link"));
+
+			link_button = new Gtk.ToolButton (
+				new Gtk.Image (Gtk.Stock.JumpTo, tb.IconSize),
+				Catalog.GetString ("Link"));
+			link_button.IsImportant = true;
 			link_button.Sensitive = (note.Buffer.Selection != null);
 			link_button.Clicked += LinkToNoteActivate;
-			toolbar_tips.SetTip (link_button, Catalog.GetString ("Link selected text to a new note (Ctrl-L)"), null);
+			toolbar_tips.SetTip (
+				link_button,
+				Catalog.GetString ("Link selected text to a new note (Ctrl-L)"),
+				null);
 			link_button.AddAccelerator ("clicked",
 			                            accel_group,
 			                            (uint) Gdk.Key.l,
@@ -460,16 +469,17 @@
 			                            Gtk.AccelFlags.Visible);
 			link_button.ShowAll ();
 			tb.Insert (link_button, -1);
-			
+
 			ToolMenuButton text_button =
 			        new ToolMenuButton (tb,
 			                            Gtk.Stock.SelectFont,
 			                            Catalog.GetString ("_Text"),
 			                            text_menu);
+			text_button.IsImportant = true;
 			text_button.ShowAll ();
 			tb.Insert (text_button, -1);
 			toolbar_tips.SetTip (text_button, Catalog.GetString ("Set properties of text"), null);
-			
+
 			ToolMenuButton plugin_button =
 			        new ToolMenuButton (tb,
 			                            Gtk.Stock.Execute,
@@ -478,28 +488,28 @@
 			plugin_button.ShowAll ();
 			tb.Insert (plugin_button, -1);
 			toolbar_tips.SetTip (plugin_button, Catalog.GetString ("Use tools on this note"), null);
-			
+
 			tb.Insert (new Gtk.SeparatorToolItem (), -1);
-			
+
 			delete = new Gtk.ToolButton (Gtk.Stock.Delete);
 			delete.Clicked += OnDeleteButtonClicked;
 			delete.ShowAll ();
 			tb.Insert (delete, -1);
 			toolbar_tips.SetTip (delete, Catalog.GetString ("Delete this note"), null);
-			
+
 			// Don't allow deleting the "Start Here" note...
 			if (note.IsSpecial)
 				delete.Sensitive = false;
 
 			tb.Insert (new Gtk.SeparatorToolItem (), -1);
-			
+
 			Gtk.ImageMenuItem item =
 			        new Gtk.ImageMenuItem (Catalog.GetString ("Synchronize Notes"));
 			item.Image = new Gtk.Image (Gtk.Stock.Convert, Gtk.IconSize.Menu);
 			item.Activated += SyncItemSelected;
 			item.Show ();
 			PluginMenu.Add (item);
-			
+
 			tb.ShowAll ();
 			return tb;
 		}
@@ -716,7 +726,8 @@
 
 		bool shift_key_pressed;
 
-public NoteFindBar (Note note) : base (false, 0)
+		public NoteFindBar (Note note)
+			: base (false, 0)
 		{
 			this.note = note;
 
@@ -1188,7 +1199,7 @@
 		public NoteTextMenu (Gtk.AccelGroup accel_group,
 		                     NoteBuffer     buffer,
 		                     UndoManager    undo_manager)
-: base ()
+			: base ()
 		{
 			this.buffer = buffer;
 			this.undo_manager = undo_manager;

Modified: trunk/Tomboy/Tomboy.cs
==============================================================================
--- trunk/Tomboy/Tomboy.cs	(original)
+++ trunk/Tomboy/Tomboy.cs	Wed Apr 30 21:12:23 2008
@@ -17,10 +17,10 @@
 		static bool is_panel_applet = false;
 		static PreferencesDialog prefs_dlg;
 		static SyncDialog sync_dlg;
-		#if ENABLE_DBUS
+#if ENABLE_DBUS
 		static RemoteControl remote_control;
-		#endif
-        static Gtk.IconTheme icon_theme = null;
+#endif
+		static Gtk.IconTheme icon_theme = null;
 
 		public static void Main (string [] args)
 		{
@@ -29,19 +29,19 @@
 
 			TomboyCommandLine cmd_line = new TomboyCommandLine (args);
 
-			#if ENABLE_DBUS // Run command-line earlier with DBus enabled
+#if ENABLE_DBUS // Run command-line earlier with DBus enabled
 			if (cmd_line.NeedsExecute) {
 				// Execute args at an existing tomboy instance...
 				cmd_line.Execute ();
 				return;
 			}
-			#endif // ENABLE_DBUS
+#endif // ENABLE_DBUS
 
 			Initialize ("tomboy", "Tomboy", "tomboy", args);
 
-            // Add private icon dir to search path
-            icon_theme = Gtk.IconTheme.Default;
-            icon_theme.AppendSearchPath (System.IO.Path.Combine (Defines.DATADIR, "tomboy/icons"));
+			// Add private icon dir to search path
+			icon_theme = Gtk.IconTheme.Default;
+			icon_theme.AppendSearchPath (System.IO.Path.Combine (Defines.DATADIR, "tomboy/icons"));
 
 //   PluginManager.CheckPluginUnloading = cmd_line.CheckPluginUnloading;
 
@@ -63,11 +63,11 @@
 				addin.Initialize ();
 			}
 
-			#if !ENABLE_DBUS
+#if !ENABLE_DBUS
 			if (cmd_line.NeedsExecute) {
 				cmd_line.Execute ();
 			}
-			#endif
+#endif
 
 			if (cmd_line.UsePanelApplet) {
 				tray_icon_showing = true;
@@ -92,8 +92,7 @@
 		static string GetNotePath (string override_path)
 		{
 			// Default note location, as specified in --note-path or $TOMBOY_PATH
-			string note_path =
-			        (override_path != null) ?
+			string note_path = (override_path != null) ?
 			        override_path :
 			        Environment.GetEnvironmentVariable ("TOMBOY_PATH");
 			if (note_path == null)
@@ -146,7 +145,7 @@
 
 		static void RegisterRemoteControl (NoteManager manager)
 		{
-			#if ENABLE_DBUS
+#if ENABLE_DBUS
 			try {
 				remote_control = RemoteControlProxy.Register (manager);
 				if (remote_control != null) {
@@ -168,7 +167,7 @@
 				Logger.Log ("Tomboy remote control disabled (DBus exception): {0}",
 				            e.Message);
 			}
-			#endif
+#endif
 		}
 
 		// These actions can be called from anywhere in Tomboy
@@ -418,7 +417,7 @@
 			                "  --search [text]\t\tOpen the search all notes window with " +
 			                "the search text.\n");
 
-			#if ENABLE_DBUS
+#if ENABLE_DBUS
 			usage +=
 			        Catalog.GetString (
 			                "  --new-note\t\t\tCreate and display a new note.\n" +
@@ -429,7 +428,7 @@
 			                "  --start-here\t\t\tDisplay the 'Start Here' note.\n" +
 			                "  --highlight-search [text]\tSearch and highlight text " +
 			                "in the opened note.\n");
-			#endif
+#endif
 
 // TODO: Restore this functionality with addins
 //   usage +=
@@ -437,9 +436,9 @@
 //     "  --check-plugin-unloading\tCheck if plugins are " +
 //     "unloaded properly.\n");
 
-			#if !ENABLE_DBUS
+#if !ENABLE_DBUS
 			usage += Catalog.GetString ("D-BUS remote control disabled.\n");
-			#endif
+#endif
 
 			Console.WriteLine (usage);
 		}
@@ -455,7 +454,7 @@
 				bool quit = false;
 
 				switch (args [idx]) {
-					#if ENABLE_DBUS
+#if ENABLE_DBUS
 				case "--new-note":
 					// Get optional name for new note...
 					if (idx + 1 < args.Length
@@ -509,7 +508,7 @@
 					++idx;
 					highlight_search = args [idx];
 					break;
-					#else
+#else
 				case "--new-note":
 				case "--open-note":
 				case "--start-here":
@@ -523,7 +522,7 @@
 					Console.WriteLine (unknown_opt, args [idx]);
 					quit = true;
 					break;
-					#endif // ENABLE_DBUS
+#endif // ENABLE_DBUS
 
 				case "--panel-applet":
 					panel_applet = true;
@@ -590,7 +589,7 @@
 
 		public void Execute ()
 		{
-			#if ENABLE_DBUS
+#if ENABLE_DBUS
 			RemoteControl remote = null;
 			try {
 				remote = RemoteControlProxy.GetInstance ();
@@ -683,7 +682,7 @@
 				else
 					remote.DisplaySearch ();
 			}
-			#else
+#else
 			if (open_search) {
 				NoteRecentChanges recent_changes =
 				        NoteRecentChanges.GetInstance (Tomboy.DefaultNoteManager);
@@ -695,7 +694,7 @@
 
 				recent_changes.Present ();
 			}
-			#endif // ENABLE_DBUS
+#endif // ENABLE_DBUS
 		}
 	}
 }

Modified: trunk/Tomboy/Tray.cs
==============================================================================
--- trunk/Tomboy/Tray.cs	(original)
+++ trunk/Tomboy/Tray.cs	Wed Apr 30 21:12:23 2008
@@ -30,7 +30,7 @@
 		}
 
 		public NoteMenuItem (Note note, bool show_pin)
-: base (GetDisplayName(note))
+                        : base (GetDisplayName(note))
 		{
 			this.note = note;
 			Image = new Gtk.Image (note_icon);
@@ -60,26 +60,26 @@
 		static string GetDisplayName (Note note)
 		{
 			string display_name = note.Title;
-            int max_length = 40;
+                        int max_length = 100;
 
 			if (note.IsNew) {
-                string new_string = Catalog.GetString(" (new)");
-                max_length -= new_string.Length;
+                                string new_string = Catalog.GetString(" (new)");
+                                max_length -= new_string.Length;
 				display_name = Ellipsify (display_name, max_length)
-                    + new_string;
-            } else {
-                display_name = Ellipsify (display_name, max_length);
-            }
+                                        + new_string;
+                        } else {
+                                display_name = Ellipsify (display_name, max_length);
+                        }
 
 			return FormatForLabel (display_name);
 		}
 
-        static string Ellipsify (string str, int max)
-        {
-            if(str.Length > max)
-                return str.Substring(0, max - 1) + "...";
-            return str;
-        }
+                static string Ellipsify (string str, int max)
+                {
+                        if(str.Length > max)
+                                return str.Substring(0, max - 1) + "...";
+                        return str;
+                }
 
 		protected override void OnActivated ()
 		{
@@ -147,7 +147,7 @@
 		int panel_size;
 
 		public TomboyTray (NoteManager manager)
-: base ()
+                        : base ()
 		{
 			this.manager = manager;
 			// Load a 16x16-sized icon to ensure we don't end up with a
@@ -316,12 +316,12 @@
 
 			// Assume menu opens downward, move common items to top of menu
 			Gtk.MenuItem newNoteItem = Tomboy.ActionManager.GetWidget (
-			                                   "/TrayIconMenu/TrayNewNotePlaceholder/TrayNewNote") as Gtk.MenuItem;
+				"/TrayIconMenu/TrayNewNotePlaceholder/TrayNewNote") as Gtk.MenuItem;
 			Gtk.MenuItem searchNotesItem = Tomboy.ActionManager.GetWidget (
-			                                       "/TrayIconMenu/ShowSearchAllNotes") as Gtk.MenuItem;
+				"/TrayIconMenu/ShowSearchAllNotes") as Gtk.MenuItem;
 			recent_menu.ReorderChild (newNoteItem, 0);
 			int insertion_point = 1; // If menu opens downward
-			
+
 			// Find all child widgets under the TrayNewNotePlaceholder
 			// element.  Make sure those added by add-ins are
 			// properly accounted for and reordered.
@@ -336,12 +336,12 @@
 					insertion_point++;
 				}
 			}
-			
+
 			recent_menu.ReorderChild (searchNotesItem, insertion_point);
 			insertion_point++;
 
 			DateTime days_ago = DateTime.Today.AddDays (-3);
-			
+
 			// Prevent template notes from appearing in the menu
 			Tag template_tag = TagManager.GetOrCreateSystemTag (TagManager.TemplateNoteSystemTag);
 
@@ -350,7 +350,7 @@
 			foreach (Note note in manager.Notes) {
 				if (note.IsSpecial)
 					continue;
-				
+
 				// Skip template notes
 				if (note.ContainsTag (template_tag))
 					continue;
@@ -392,7 +392,7 @@
 				list_size++;
 
 				bool enable_keybindings = (bool)
-				                          Preferences.Get (Preferences.ENABLE_KEYBINDINGS);
+					Preferences.Get (Preferences.ENABLE_KEYBINDINGS);
 				if (enable_keybindings)
 					GConfKeybindingToAccel.AddAccelerator (
 					        item,
@@ -617,24 +617,23 @@
 
 				return binding;
 			} catch {
-			return null;
+				return null;
+			}
 		}
-	}
 
-	[DllImport("libtomboy")]
+		[DllImport("libtomboy")]
 		static extern bool egg_accelerator_parse_virtual (string keystring,
-			                out uint keysym,
-			                out uint virtual_mods);
+								  out uint keysym,
+								  out uint virtual_mods);
 
 		[DllImport("libtomboy")]
-		static extern void egg_keymap_resolve_virtual_modifiers (
-			        IntPtr keymap,
-			        uint virtual_mods,
-			        out Gdk.ModifierType real_mods);
+		static extern void egg_keymap_resolve_virtual_modifiers (IntPtr keymap,
+									 uint virtual_mods,
+									 out Gdk.ModifierType real_mods);
 
 		public static bool GetAccelKeys (string               gconf_path,
-		                                 out uint             keyval,
-		                                 out Gdk.ModifierType mods)
+						 out uint             keyval,
+						 out Gdk.ModifierType mods)
 		{
 			keyval = 0;
 			mods = 0;
@@ -642,38 +641,38 @@
 			try {
 				string binding = (string) Preferences.Get (gconf_path);
 				if (binding == null ||
-				                binding == String.Empty ||
-				                binding == "disabled")
+				    binding == String.Empty ||
+				    binding == "disabled")
 					return false;
 
 				uint virtual_mods = 0;
 				if (!egg_accelerator_parse_virtual (binding,
-				                                    out keyval,
-				                                    out virtual_mods))
+								    out keyval,
+								    out virtual_mods))
 					return false;
 
 				Gdk.Keymap keymap = Gdk.Keymap.Default;
 				egg_keymap_resolve_virtual_modifiers (keymap.Handle,
-				                                      virtual_mods,
-				                                      out mods);
+								      virtual_mods,
+								      out mods);
 
 				return true;
 			} catch {
-			return false;
+				return false;
+			}
 		}
-	}
 
-	public static void AddAccelerator (Gtk.MenuItem item, string gconf_path)
+		public static void AddAccelerator (Gtk.MenuItem item, string gconf_path)
 		{
 			uint keyval;
 			Gdk.ModifierType mods;
 
 			if (GetAccelKeys (gconf_path, out keyval, out mods))
 				item.AddAccelerator ("activate",
-				                     accel_group,
-				                     keyval,
-				                     mods,
-				                     Gtk.AccelFlags.Visible);
+						     accel_group,
+						     keyval,
+						     mods,
+						     Gtk.AccelFlags.Visible);
 		}
 	}
 }



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