tomboy r1754 - in trunk: . Tomboy/Notebooks



Author: btimothy
Date: Tue Jan  8 18:45:48 2008
New Revision: 1754
URL: http://svn.gnome.org/viewvc/tomboy?rev=1754&view=rev

Log:
2008-01-08  Boyd Timothy <btimothy gmail com> 

        * Tomboy/Notebooks/NotebookNoteAddin.cs: Moved the code
          that was running on the Note.Window.Shown event into
          the overridden OnNoteOpened () method so that we don't
          call Note.Window during shutdown (which is called when
          a note is deleted).  Fixes bug #508110.



Modified:
   trunk/ChangeLog
   trunk/Tomboy/Notebooks/NotebookNoteAddin.cs

Modified: trunk/Tomboy/Notebooks/NotebookNoteAddin.cs
==============================================================================
--- trunk/Tomboy/Notebooks/NotebookNoteAddin.cs	(original)
+++ trunk/Tomboy/Notebooks/NotebookNoteAddin.cs	Tue Jan  8 18:45:48 2008
@@ -33,8 +33,6 @@
 			Gtk.Tooltips toolbarTips = new Gtk.Tooltips ();
 			toolbarTips.SetTip (toolButton, Catalog.GetString ("Place this note into a notebook"), null);
 			
-			Note.Window.Shown += OnNoteWindowShown;
-
 			// Set the notebook submenu
 			menu.Shown += OnMenuShown;
 			toolButton.ShowAll ();
@@ -50,7 +48,6 @@
 			// Disconnect the event handlers so
 			// there aren't any memory leaks.
 			if (toolButton != null) {
-				Note.Window.Shown -= OnNoteWindowShown;
 				menu.Shown -= OnMenuShown;
 				NotebookManager.NoteAddedToNotebook -=
 					OnNoteAddedToNotebook;
@@ -61,8 +58,19 @@
 
 		public override void OnNoteOpened ()
 		{
-			if (toolButton == null)
+			if (toolButton == null) {
 				InitializeToolButton ();
+
+				// Disable the notebook button if this note is a template note
+				Tag templateTag = TagManager.GetOrCreateSystemTag (TagManager.TemplateNoteSystemTag);
+				if (Note.ContainsTag (templateTag) == true) {
+					toolButton.Sensitive = false;
+				
+					// Also prevent notebook templates from being deleted
+					if (NotebookManager.GetNotebookFromNote (Note) != null)
+						Note.Window.DeleteButton.Sensitive = false;
+				}
+			}
 		}
 		
 		void OnMenuShown (object sender, EventArgs args)
@@ -157,18 +165,5 @@
 			
 			return items;
 		}
-		
-		void OnNoteWindowShown (object sender, EventArgs args)
-		{
-			// Disable the notebook button if this note is a template note
-			Tag templateTag = TagManager.GetOrCreateSystemTag (TagManager.TemplateNoteSystemTag);
-			if (Note.ContainsTag (templateTag) == true) {
-				toolButton.Sensitive = false;
-			
-				// Also prevent notebook templates from being deleted
-				if (NotebookManager.GetNotebookFromNote (Note) != null)
-					Note.Window.DeleteButton.Sensitive = false;
-			}
-		}
 	}
 }



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