[tomboy] Allow the user to open multiple notes via keypress or menu



commit 5c7941bccd17a0c1014bc9d06aca833f96543834
Author: Greg Poirier <gpoirier src gnome org>
Date:   Sun Apr 17 22:06:20 2011 -0500

    Allow the user to open multiple notes via keypress or menu
    
    bug 587499

 Tomboy/RecentChanges.cs |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/Tomboy/RecentChanges.cs b/Tomboy/RecentChanges.cs
index e89efcf..69ddf0e 100644
--- a/Tomboy/RecentChanges.cs
+++ b/Tomboy/RecentChanges.cs
@@ -730,7 +730,7 @@ namespace Tomboy
 			if (selected_notes == null || selected_notes.Count == 0) {
 				Tomboy.ActionManager ["OpenNoteAction"].Sensitive = false;
 				Tomboy.ActionManager ["DeleteNoteAction"].Sensitive = false;
-			} else if (selected_notes.Count == 1) {
+			} else if (selected_notes.Count > 0) {
 				Tomboy.ActionManager ["OpenNoteAction"].Sensitive = true;
 				Tomboy.ActionManager ["DeleteNoteAction"].Sensitive = true;
 			} else {
@@ -814,6 +814,7 @@ namespace Tomboy
 			}
 		}
 
+		[GLib.ConnectBefore]
 		void OnTreeViewKeyPressed (object sender, Gtk.KeyPressEventArgs args)
 		{
 			switch (args.Event.Key) {
@@ -824,9 +825,16 @@ namespace Tomboy
 						Gtk.Menu menu = Tomboy.ActionManager.GetWidget (
 						"/MainWindowContextMenu") as Gtk.Menu;
 					PopupContextMenuAtLocation (menu, 0, 0);
+					args.RetVal = true;
 				}
 
 				break;
+			case Gdk.Key.Return:
+			case Gdk.Key.KP_Enter:
+				// Open all selected notes
+				OnOpenNote (this, args);
+				args.RetVal = true;
+				break;
 			}
 		}
 
@@ -1007,10 +1015,9 @@ namespace Tomboy
 		void OnOpenNote (object sender, EventArgs args)
 		{
 			List<Note> selected_notes = GetSelectedNotes ();
-			if (selected_notes == null || selected_notes.Count != 1)
-				return;
-
-			selected_notes [0].Window.Present ();
+			if (selected_notes != null)
+				foreach (Note note in selected_notes)
+					note.Window.Present ();
 		}
 
 		void OnDeleteNote (object sender, EventArgs args)



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