[totem] main: Handle Ctrl+F toggling the search mode



commit ad8c97260bd28838668a17111ca24287d9849b36
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Feb 6 14:18:03 2014 +0100

    main: Handle Ctrl+F toggling the search mode

 src/totem-grilo.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/totem-grilo.c b/src/totem-grilo.c
index 5450a06..c40dee5 100644
--- a/src/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -1515,13 +1515,24 @@ totem_grilo_back_button_clicked (TotemGrilo *self)
 }
 
 static gboolean
-window_key_press_event_cb (GtkWidget        *win,
-                          GdkEvent         *event,
-                          TotemGrilo *self)
+window_key_press_event_cb (GtkWidget   *win,
+                          GdkEventKey *event,
+                          TotemGrilo  *self)
 {
        /* Check whether we're in the browse panel */
        if (!g_str_equal (totem_object_get_main_page (self->priv->totem), "grilo"))
-               return FALSE;
+               return GDK_EVENT_PROPAGATE;
+
+       /* Handle Ctrl+F */
+       if (event->state != 0 &&
+           (event->state & GDK_CONTROL_MASK)) {
+               if (event->keyval == GDK_KEY_F ||
+                   event->keyval == GDK_KEY_f) {
+                       gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (self->priv->search_bar),
+                                                       !gtk_search_bar_get_search_mode (GTK_SEARCH_BAR 
(self->priv->search_bar)));
+                       return GDK_EVENT_STOP;
+               }
+       }
 
        return gtk_search_bar_handle_event (GTK_SEARCH_BAR (self->priv->search_bar), event);
 }


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