[gnome-software/wip/kalev/gnome-3-22-prep: 31/52] trivial: Toggle the search bar on ctrl+f



commit 9e24b8a054651bbe5c460474e9eff72e2953ce7f
Author: Richard Hughes <richard hughsie com>
Date:   Wed Oct 12 14:26:05 2016 +0100

    trivial: Toggle the search bar on ctrl+f
    
    (cherry picked from commit 28ed51dc75d267921a4ac1419e48676e184aa7ad)

 src/gs-shell.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 44181f5..e56507d 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -492,9 +492,14 @@ window_keypress_handler (GtkWidget *window, GdkEvent *event, GsShell *shell)
                if ((e->state & GDK_CONTROL_MASK) > 0 &&
                    e->keyval == GDK_KEY_f) {
                        w = GTK_WIDGET (gtk_builder_get_object (priv->builder, "search_bar"));
-                       gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (w), TRUE);
-                       w = GTK_WIDGET (gtk_builder_get_object (priv->builder, "entry_search"));
-                       gtk_widget_grab_focus (w);
+                       if (!gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (w))) {
+                               gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (w), TRUE);
+                               w = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+                                                                       "entry_search"));
+                               gtk_widget_grab_focus (w);
+                       } else {
+                               gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (w), FALSE);
+                       }
                        return GDK_EVENT_PROPAGATE;
                }
        }


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