[gnome-software] trivial: Toggle the search bar on ctrl+f



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

    trivial: Toggle the search bar on ctrl+f

 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 1b7a51c..34b59a0 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -549,9 +549,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]