[gitg] Trigger search with Control+F



commit 14a44e3d5413b1e324195b8a8642abd40bcf6ab6
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sun Mar 17 12:14:17 2013 +0100

    Trigger search with Control+F

 gitg/gitg-application.vala       |    1 +
 gitg/gitg-window.vala            |    6 ++++++
 gitg/resources/ui/gitg-window.ui |    1 +
 3 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 22274c2..5a26d04 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -276,6 +276,7 @@ public class Application : Gtk.Application
                        }
                }
 
+               add_accelerator("<Control>F", "win.search", null);
                add_accelerator("F10", "win.gear-menu", null);
 
                // Use our own css provider
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 4b9f1fd..c117887 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -55,6 +55,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
        private GitgExt.NavigationTreeView d_navigation;
 
        private static const ActionEntry[] win_entries = {
+               {"search", on_search_activated, null, "false", null},
                {"gear-menu", on_gear_menu_activated, null, "false", null},
                {"close", on_close_activated},
        };
@@ -69,6 +70,11 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
                destroy();
        }
 
+       private void on_search_activated(SimpleAction action) {
+               var state = action.get_state().get_boolean();
+               action.set_state(new Variant.boolean(!state));
+       }
+
        private void on_gear_menu_activated(SimpleAction action) {
                var state = action.get_state().get_boolean();
                action.set_state(new Variant.boolean(!state));
diff --git a/gitg/resources/ui/gitg-window.ui b/gitg/resources/ui/gitg-window.ui
index 29a57e4..fd33f94 100644
--- a/gitg/resources/ui/gitg-window.ui
+++ b/gitg/resources/ui/gitg-window.ui
@@ -43,6 +43,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="symbolic_icon_name">edit-find-symbolic</property>
+                <property name="action_name">win.search</property>
               </object>
               <packing>
                 <property name="pack_type">end</property>


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