tomboy r1872 - in trunk: . Tomboy data



Author: jtickle
Date: Fri Feb 22 17:51:50 2008
New Revision: 1872
URL: http://svn.gnome.org/viewvc/tomboy?rev=1872&view=rev

Log:
Fixed bug 417145


Modified:
   trunk/ChangeLog
   trunk/Tomboy/Preferences.cs
   trunk/Tomboy/Tray.cs
   trunk/data/tomboy.schemas.in

Modified: trunk/Tomboy/Preferences.cs
==============================================================================
--- trunk/Tomboy/Preferences.cs	(original)
+++ trunk/Tomboy/Preferences.cs	Fri Feb 22 17:51:50 2008
@@ -20,6 +20,7 @@
 		public const string CUSTOM_FONT_FACE = "/apps/tomboy/custom_font_face";
 		public const string MENU_NOTE_COUNT = "/apps/tomboy/menu_note_count";
 		public const string MENU_PINNED_NOTES = "/apps/tomboy/menu_pinned_notes";
+        public const string MENU_ITEM_MAX_LENGTH = "/apps/tomboy/tray_menu_item_max_length";
 
 		public const string KEYBINDING_SHOW_NOTE_MENU = "/apps/tomboy/global_keybindings/show_note_menu";
 		public const string KEYBINDING_OPEN_START_HERE = "/apps/tomboy/global_keybindings/open_start_here";
@@ -91,6 +92,9 @@
 			case MENU_PINNED_NOTES:
 				return string.Empty;
 
+            case MENU_ITEM_MAX_LENGTH:
+                return 40;
+
 			case KEYBINDING_SHOW_NOTE_MENU:
 				return "<Alt>F12";
 

Modified: trunk/Tomboy/Tray.cs
==============================================================================
--- trunk/Tomboy/Tray.cs	(original)
+++ trunk/Tomboy/Tray.cs	Fri Feb 22 17:51:50 2008
@@ -60,11 +60,27 @@
 		static string GetDisplayName (Note note)
 		{
 			string display_name = note.Title;
-			if (note.IsNew)
-				display_name += Catalog.GetString (" (new)");
+            int max_length = (int) Preferences.Get (Preferences.MENU_ITEM_MAX_LENGTH);
+
+			if (note.IsNew) {
+                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);
+            }
+
 			return FormatForLabel (display_name);
 		}
 
+        static string Ellipsify (string str, int max)
+        {
+            if(str.Length > max)
+                return str.Substring(0, max - 1) + Catalog.GetString("...");
+            return str;
+        }
+
 		protected override void OnActivated ()
 		{
 			if (!inhibit_activate) {

Modified: trunk/data/tomboy.schemas.in
==============================================================================
--- trunk/data/tomboy.schemas.in	(original)
+++ trunk/data/tomboy.schemas.in	Fri Feb 22 17:51:50 2008
@@ -420,6 +420,20 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/tomboy/tray_menu_item_max_length</key>
+      <applyto>/apps/tomboy/tray_menu_item_max_length</applyto>
+      <owner>tomboy</owner>
+      <type>int</type>
+      <default>40</default>
+      <locale name="C">
+        <short>Maximum length for tray menu items</short>
+        <long>
+      Any tray menu items longer than this will be truncated and have an ellipse added.  0 disables truncation.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/desktop/gnome/url-handlers/note/command</key>
       <applyto>/desktop/gnome/url-handlers/note/command</applyto>
       <owner>tomboy</owner>



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