[tomboy] Fixed note deletion when Del is hit in the search box or Notebooks pane



commit 3fcf788bbd91336cd75eebbc31c9faabe3e5f56e
Author: Alex Tereschenko <frozen and blue gmail com>
Date:   Wed Dec 5 22:06:09 2012 +0100

    Fixed note deletion when Del is hit in the search box or Notebooks pane
    
    Also fixed regression introduced by one of the earlier proposed
    solutions ("Delete" context menu item is always grayed out), that was
    checked in as 7274ebd68216e7956b84804f61de22e0809e59d0.
    
    Signed-off-by: Jared Jennings <jared jaredjennings org>

 Tomboy/RecentChanges.cs |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/Tomboy/RecentChanges.cs b/Tomboy/RecentChanges.cs
index 8977f63..ca384be 100644
--- a/Tomboy/RecentChanges.cs
+++ b/Tomboy/RecentChanges.cs
@@ -105,6 +105,7 @@ namespace Tomboy
 			find_combo.Changed += OnEntryChanged;
 			find_combo.Entry.ActivatesDefault = false;
 			find_combo.Entry.Activated += OnEntryActivated;
+			find_combo.Entry.FocusInEvent += OnEntryFocusIn;
 			if (previous_searches != null) {
 				foreach (string prev in previous_searches) {
 					find_combo.AppendText (prev);
@@ -296,6 +297,7 @@ namespace Tomboy
 			notebooksTree.Selection.Changed += OnNotebookSelectionChanged;
 			notebooksTree.ButtonPressEvent += OnNotebooksTreeButtonPressed;
 			notebooksTree.KeyPressEvent += OnNotebooksKeyPressed;
+			notebooksTree.FocusInEvent += OnNotebooksFocusIn;
 
 			notebooksTree.Show ();
 			Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
@@ -337,8 +339,6 @@ namespace Tomboy
 			tree.MotionNotifyEvent += OnTreeViewMotionNotify;
 			tree.ButtonReleaseEvent += OnTreeViewButtonReleased;
 			tree.DragDataGet += OnTreeViewDragDataGet;
-			tree.FocusInEvent += OnTreeViewFocused;
-			tree.FocusOutEvent += OnTreeViewFocusedOut;
 
 			tree.EnableModelDragSource (Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
 						    targets,
@@ -952,20 +952,6 @@ namespace Tomboy
 				tree.Selection.SelectPath (path);
 			}
 		}
-		
-		// called when the user moves the focus into the notes TreeView
-		void OnTreeViewFocused (object sender, EventArgs args)
-		{
-			// enable the Delete Note option in the menu bar 
-			Tomboy.ActionManager ["DeleteNoteAction"].Sensitive = true;
-		}
-		
-		// called when the focus moves out of the notes TreeView
-		void OnTreeViewFocusedOut (object sender, EventArgs args)
-		{
-			// Disable the Delete Note option in the menu bar (bug #647462)
-			Tomboy.ActionManager ["DeleteNoteAction"].Sensitive = false;
-		}
 
 		void PopupContextMenuAtLocation (Gtk.Menu menu, int x, int y)
 		{
@@ -1263,6 +1249,13 @@ namespace Tomboy
 			EntryChangedTimeout (null, null);
 		}
 
+		void OnEntryFocusIn (object sender, EventArgs args)
+		{
+			// To make sure DeleteNoteAction gets disabled
+			// when we're not in the notes list (bgo647472)
+			tree.Selection.UnselectAll ();
+		}
+
 		void OnEntryChanged (object sender, EventArgs args)
 		{
 			if (entry_changed_timeout == null) {
@@ -1534,6 +1527,13 @@ namespace Tomboy
 			}
 		}
 
+		void OnNotebooksFocusIn (object sender, EventArgs args)
+		{
+			// To make sure DeleteNoteAction gets disabled
+			// when we're not in the notes list (bgo647472)
+			tree.Selection.UnselectAll ();
+		}
+
 		private void OnNoteAddedToNotebook (Note note, Notebooks.Notebook notebook)
 		{
 			RestoreMatchesWindow ();



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