[tomboy] Disable Delete action when note list not in focus



commit 7274ebd68216e7956b84804f61de22e0809e59d0
Author: Abhinav <er abhinav upadhyay gmail com>
Date:   Wed Apr 20 21:05:51 2011 -0700

    Disable Delete action when note list not in focus
    
    Add event handlers for TreeView focus in the Search All Notes window to
    disable Delete action.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=647462

 Tomboy/RecentChanges.cs |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/Tomboy/RecentChanges.cs b/Tomboy/RecentChanges.cs
index 72707a5..e89efcf 100644
--- a/Tomboy/RecentChanges.cs
+++ b/Tomboy/RecentChanges.cs
@@ -321,6 +321,8 @@ 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,
@@ -864,6 +866,20 @@ 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)
 		{



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