[devhelp] window: Allow Shift-Return to previous find



commit 22c0e751ce25748afb460e2421cc2c1b29ab239a
Author: Damián Nohales <damiannohales gmail com>
Date:   Sun May 25 12:40:22 2014 -0300

    window: Allow Shift-Return to previous find
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730723

 src/dh-window.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index b7a11b7..aab1c17 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -121,6 +121,9 @@ static void           on_search_mode_enabled_changed (GtkSearchBar    *search_ba
                                                       DhWindow        *window);
 static void           on_search_entry_activated      (GtkEntry        *entry,
                                                       DhWindow        *window);
+static gboolean      on_search_entry_key_press       (GtkEntry    *entry,
+                                                      GdkEventKey *event,
+                                                      DhWindow    *window);
 static GtkWidget *    window_new_tab_label           (DhWindow        *window,
                                                       const gchar     *label,
                                                       const GtkWidget *parent);
@@ -713,6 +716,10 @@ window_populate (DhWindow *window)
                           "activate",
                           G_CALLBACK (on_search_entry_activated),
                           window);
+        g_signal_connect (priv->search_entry,
+                          "key-press-event",
+                          G_CALLBACK (on_search_entry_key_press),
+                          window);
         g_signal_connect (priv->go_up_button,
                           "clicked",
                           G_CALLBACK (window_find_previous_cb),
@@ -1038,6 +1045,19 @@ on_search_entry_activated (GtkEntry *entry,
         findbar_find_next (window);
 }
 
+static gboolean
+on_search_entry_key_press (GtkEntry    *entry,
+                           GdkEventKey *event,
+                           DhWindow    *window)
+{
+        if (event->keyval == GDK_KEY_Return && event->state & GDK_SHIFT_MASK) {
+                findbar_find_previous (window);
+                return TRUE;
+        }
+
+        return FALSE;
+}
+
 #if 0
 static void
 window_web_view_open_new_tab_cb (WebKitWebView *web_view,


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