[gedit] search: use new GtkSearchEntry signals



commit 611d788b15c68722b7d5aeaf42634ada2e6ccd06
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Mon Mar 16 20:50:23 2015 +0100

    search: use new GtkSearchEntry signals
    
    We can now use new GtkSearchEntry
    next-match and previous-match signals
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746299

 gedit/gedit-view-frame.c |   40 ++++++++++++++++++++++++----------------
 1 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index 243e8cf..9d99e9a 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -572,8 +572,6 @@ search_widget_key_press_event (GtkWidget      *widget,
                                GdkEventKey    *event,
                                GeditViewFrame *frame)
 {
-       guint modifiers = gtk_accelerator_get_default_mod_mask ();
-
        /* Close window */
        if (event->keyval == GDK_KEY_Tab)
        {
@@ -597,13 +595,6 @@ search_widget_key_press_event (GtkWidget      *widget,
                return GDK_EVENT_STOP;
        }
 
-       if (((event->state & modifiers) == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) &&
-           (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G))
-       {
-               backward_search (frame);
-               return GDK_EVENT_STOP;
-       }
-
        /* select next matching iter */
        if (event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_KP_Down)
        {
@@ -611,13 +602,6 @@ search_widget_key_press_event (GtkWidget      *widget,
                return GDK_EVENT_STOP;
        }
 
-       if (((event->state & modifiers) == GDK_CONTROL_MASK) &&
-           (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G))
-       {
-               forward_search (frame);
-               return GDK_EVENT_STOP;
-       }
-
        return GDK_EVENT_PROPAGATE;
 }
 
@@ -905,6 +889,20 @@ search_entry_escaped (GtkSearchEntry *entry,
 }
 
 static void
+search_entry_previous_match (GtkSearchEntry *entry,
+                             GeditViewFrame *frame)
+{
+       backward_search (frame);
+}
+
+static void
+search_entry_next_match (GtkSearchEntry *entry,
+                         GeditViewFrame *frame)
+{
+       forward_search (frame);
+}
+
+static void
 search_entry_populate_popup (GtkEntry       *entry,
                              GtkMenu        *menu,
                              GeditViewFrame *frame)
@@ -1605,6 +1603,16 @@ gedit_view_frame_init (GeditViewFrame *frame)
                          G_CALLBACK (search_entry_escaped),
                          frame);
 
+       g_signal_connect (frame->priv->search_entry,
+                         "next-match",
+                         G_CALLBACK (search_entry_next_match),
+                         frame);
+
+       g_signal_connect (frame->priv->search_entry,
+                         "previous-match",
+                         G_CALLBACK (search_entry_previous_match),
+                         frame);
+
        frame->priv->search_entry_changed_id =
                g_signal_connect (frame->priv->search_entry,
                                  "changed",


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