[Xfce4-commits] <postler:master> Live search based on a timeout

Christian Dywan noreply at xfce.org
Thu Jul 7 05:02:03 CEST 2011


Updating branch refs/heads/master
         to 9fd01a460ea3876978e3cb4d98416024ea7eab70 (commit)
       from aa98a4d0c01eab119024cda450d5efb229756dcd (commit)

commit 9fd01a460ea3876978e3cb4d98416024ea7eab70
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Jul 7 00:47:48 2011 +0200

    Live search based on a timeout

 postler/postler-bureau.vala |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 0cca419..38f8b2a 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -22,6 +22,7 @@ public class Postler.Bureau : Gtk.Window {
     Gtk.Toolbar toolbar;
     Elementary.SearchEntry search;
     Gtk.Toolbar search_options;
+    uint search_timeout = 0;
     public Postler.Folders folders;
     Gtk.ToolItem statusitem;
     Gtk.ProgressBar progressbar;
@@ -166,7 +167,6 @@ public class Postler.Bureau : Gtk.Window {
     }
 
     void search_entry_activated () {
-        search_apply ();
         messages.grab_focus ();
     }
 
@@ -650,6 +650,14 @@ public class Postler.Bureau : Gtk.Window {
         toolbar.insert (toolitem, -1);
         search = new Elementary.SearchEntry (_("Type To Search..."));
         search.activate.connect (search_entry_activated);
+        search.changed.connect ( () => {
+            if (search_timeout > 0)
+                GLib.Source.remove (search_timeout);
+            search_timeout = Timeout.add (150, () => {
+                search_apply ();
+                return false;
+            });
+        });
         search.icon_press.connect_after ((position, event) => {
             search_apply ();
         } );



More information about the Xfce4-commits mailing list