Index: Tomboy/Tray.cs
===================================================================
RCS file: /cvs/gnome/tomboy/Tomboy/Tray.cs,v
retrieving revision 1.53
diff -u -r1.53 Tray.cs
--- Tomboy/Tray.cs	20 Nov 2006 22:57:55 -0000	1.53
+++ Tomboy/Tray.cs	21 Nov 2006 04:59:03 -0000
@@ -123,13 +123,17 @@
 		Gtk.Tooltips tips;
 		Gtk.Image image;
 		PreferencesDialog prefs_dlg;
-		int icon_size_last = -1;
+		int icon_size_last;
+		Gdk.Size icon_size_last_rect;
 
 		public TomboyTray (NoteManager manager) 
 			: base ()
 		{
 			this.manager = manager;
-			this.image = new Gtk.Image ("tomboy", Gtk.IconSize.Menu);
+			icon_size_last = 24;
+			this.image = new Gtk.Image (GuiUtils.GetIcon ("tomboy", icon_size_last));
+			icon_size_last_rect.Width = icon_size_last;
+			icon_size_last_rect.Height = icon_size_last;
 
 			this.CanFocus = true;
 			this.ButtonPressEvent += ButtonPress;
@@ -152,8 +156,6 @@
 			tips.Sink ();
 
 			SetupDragAndDrop ();
-
-			InitSomeStuff ();
 		}
 
 		void ButtonPress (object sender, Gtk.ButtonPressEventArgs args) 
@@ -461,52 +463,24 @@
 		{
 			base.OnSizeAllocated (rect);
 
-			int icon_size = Math.Min (rect.Height, rect.Width);
-			if (icon_size_last != icon_size) {
+			int icon_size = -1;
+			if (icon_size_last_rect.Width != rect.Width) {
+				icon_size = rect.Width;
+				icon_size_last_rect.Width = icon_size;
+			} else if (icon_size_last_rect.Height != rect.Height) {
+				icon_size = rect.Height;
+				icon_size_last_rect.Height = icon_size;
+			}
+			
+			// Only change it if it's greater than 20.  There are some cases
+			// where rect.Width ends up being 1.  In this case, the icon will
+			// be a 1x1 pixel.  Forcing it to be > 20 will ensure that the
+			// original size of 24 is at least loaded.
+			if (icon_size != icon_size_last && icon_size > 20) {
 				icon_size_last = icon_size;
-				image.Pixbuf = GuiUtils.GetIcon (GetIconName (), icon_size);
+				image.Pixbuf = GuiUtils.GetIcon ("tomboy", icon_size);
 			}
 		}
-
-		void ReloadIcon ()
-		{
-			icon_size_last = -1;
-			QueueResize ();
-		}
-
-		// NOTHING TO SEE HERE
-		void InitSomeStuff ()
-		{
-			manager.NoteDeleted += OnNoteDeletedUpdateIcon;
-			manager.NoteAdded += OnNoteAddedUpdateIcon;
-			manager.NoteRenamed += OnNoteRenamedUpdateIcon;
-		}
-
-		void OnNoteDeletedUpdateIcon (object sender, Note changed)
-		{
-			if (changed.Title == "Tintin")
-				ReloadIcon ();
-		}
-
-		void OnNoteAddedUpdateIcon (object sender, Note changed)
-		{
-			if (changed.Title == "Tintin")
-				ReloadIcon ();
-		}
-
-		void OnNoteRenamedUpdateIcon (Note note, string old_title)
-		{
-			if (note.Title == "Tintin" || old_title == "Tintin")
-				ReloadIcon ();
-		}
-
-		string GetIconName ()
-		{
-			if (manager.Find ("Tintin") != null)
-				return "tintin";
-			return "tomboy";
-		}
-		// GO ABOUT YOUR BUSINESS
 	}
 
 	// 
