[geary] Shortcut keys for nav to next/previous conversation: Bug #714434



commit f46f0d92aab5eccabec8cd9471537b012996cbc4
Author: Timo Kluck <tkluck infty nl>
Date:   Thu Mar 5 17:23:04 2015 -0800

    Shortcut keys for nav to next/previous conversation: Bug #714434

 src/client/application/geary-controller.vala |    9 +++++++++
 src/client/folder-list/folder-list-tree.vala |   16 ++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 740ee78..0105feb 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -52,6 +52,7 @@ public class GearyController : Geary.BaseObject {
     public const string ACTION_MOVE_MENU = "GearyMoveMenuButton";
     public const string ACTION_GEAR_MENU = "GearyGearMenuButton";
     public const string ACTION_SEARCH = "GearySearch";
+    public const string ACTION_CONVERSATION_LIST = "GearyConversationList";
     
     public const string PROP_CURRENT_CONVERSATION ="current-conversations";
     
@@ -497,6 +498,10 @@ public class GearyController : Geary.BaseObject {
         entries += search;
         add_accelerator("<Ctrl>S", ACTION_SEARCH);
         
+        Gtk.ActionEntry conversation_list = { ACTION_CONVERSATION_LIST, null, null, null, null, 
on_conversation_list };
+        entries += conversation_list;
+        add_accelerator("<Ctrl>B", ACTION_CONVERSATION_LIST);
+        
         return entries;
     }
     
@@ -2620,6 +2625,10 @@ public class GearyController : Geary.BaseObject {
         main_window.main_toolbar.give_search_focus();
     }
     
+    private void on_conversation_list() {
+        main_window.conversation_list_view.grab_focus();
+    }
+    
     private void on_sent(Geary.RFC822.Message rfc822) {
         Libnotify.play_sound("message-sent-email");
     }
diff --git a/src/client/folder-list/folder-list-tree.vala b/src/client/folder-list/folder-list-tree.vala
index 64eb69a..c9dbdc4 100644
--- a/src/client/folder-list/folder-list-tree.vala
+++ b/src/client/folder-list/folder-list-tree.vala
@@ -35,6 +35,22 @@ public class FolderList.Tree : Sidebar.Tree {
         unowned Gtk.BindingSet? binding_set = Gtk.BindingSet.find("GtkTreeView");
         assert(binding_set != null);
         Gtk.BindingEntry.remove(binding_set, Gdk.Key.N, Gdk.ModifierType.CONTROL_MASK);
+        // add j/k bindings for gmail or vim users
+        // The add_signal API is hard to use (need to pass variable arguments with
+        // type identifiers), so we might as well use this version that parses a
+        // string.
+        Gtk.BindingEntry.add_signal_from_string(
+            binding_set,
+            """
+                bind "j" { "move-cursor" (display-lines,  1) }
+            """
+        );
+        Gtk.BindingEntry.add_signal_from_string(
+            binding_set,
+            """
+                bind "k" { "move-cursor" (display-lines, -1) }
+            """
+        );
     }
     
     ~Tree() {


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