[devhelp] window: Use new GtkSearchEntry feature



commit d3af685db469ae0277488c2387204a08b6243521
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Oct 22 12:20:05 2013 +0200

    window: Use new GtkSearchEntry feature
    
    Instead of using a timeout ourselves, listen on the search-changed
    signal, which emits after 300 msecs.
    
    Bump GTK+ reqs to be the minimum version with the new signal.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710622

 configure.ac    |    2 +-
 src/dh-window.c |   16 ++--------------
 2 files changed, 3 insertions(+), 15 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c4eba97..a330cdb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ AC_SUBST(LIBM)
 
 PKG_CHECK_MODULES(DEVHELP, [
   gthread-2.0 >= 2.10.0
-  gtk+-3.0 >= 3.9.8
+  gtk+-3.0 >= 3.9.10
   webkit2gtk-3.0 >= 2.0.0
   gio-2.0 >= 2.37.3
 ])
diff --git a/src/dh-window.c b/src/dh-window.c
index 0d3d332..2acfc28 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -58,7 +58,6 @@ typedef struct {
         GtkWidget      *go_down_button;
 
         DhLink         *selected_search_link;
-        guint           find_source_id;
         DhSettings     *settings;
         guint           fonts_changed_id;
 } DhWindowPrivate;
@@ -709,7 +708,7 @@ window_populate (DhWindow *window)
                           G_CALLBACK (on_search_mode_enabled_changed),
                           window);
         g_signal_connect (priv->search_entry,
-                          "changed",
+                          "search-changed",
                           G_CALLBACK (window_find_search_changed_cb),
                           window);
         g_signal_connect (priv->search_entry,
@@ -960,8 +959,6 @@ do_search (DhWindow *window)
         search_text = gtk_entry_get_text (GTK_ENTRY (priv->search_entry));
         webkit_find_controller_search (find_controller, search_text, find_options, G_MAXUINT);
 
-        priv->find_source_id = 0;
-
         return FALSE;
 }
 
@@ -969,16 +966,7 @@ static void
 window_find_search_changed_cb (GtkEntry *entry,
                                DhWindow *window)
 {
-        DhWindowPrivate *priv;
-
-        priv = dh_window_get_instance_private (window);
-
-        if (priv->find_source_id != 0) {
-                g_source_remove (priv->find_source_id);
-                priv->find_source_id = 0;
-        }
-
-        priv->find_source_id = g_timeout_add (300, (GSourceFunc)do_search, window);
+        do_search (window);
 }
 
 static void


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