[gnome-software/gnome-3-22] Show the search bar when the user does ctrl+f



commit 7211ef890ee714d5f7563532961be5760a710d51
Author: Richard Hughes <richard hughsie com>
Date:   Wed Oct 12 11:43:55 2016 +0100

    Show the search bar when the user does ctrl+f
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=772358
    (cherry picked from commit 7f61062f2fa398266e2ca15151577d19f38ec8c0)

 src/gs-shell.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index cfd23b7..53a199f 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -486,6 +486,17 @@ window_keypress_handler (GtkWidget *window, GdkEvent *event, GsShell *shell)
        GsShellPrivate *priv = gs_shell_get_instance_private (shell);
        GtkWidget *widget;
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "search_bar"));
+
+       /* handle ctrl+f shortcut */
+       if (event->type == GDK_KEY_PRESS) {
+               GdkEventKey *e = (GdkEventKey *) event;
+               if ((e->state & GDK_CONTROL_MASK) > 0 &&
+                   e->keyval == GDK_KEY_f) {
+                       gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (widget), TRUE);
+                       return GDK_EVENT_PROPAGATE;
+               }
+       }
+
        return gtk_search_bar_handle_event (GTK_SEARCH_BAR (widget), event);
 }
 


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