[gnome-music/gnome-3-12] Don't search immideately - wait for 0.5 second



commit 40b68d531c9c8d5b8635d6c6ee3b9395657f45f9
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Tue Apr 8 12:38:46 2014 +0200

    Don't search immideately - wait for 0.5 second

 gnomemusic/searchbar.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/searchbar.py b/gnomemusic/searchbar.py
index a511593..b369d31 100644
--- a/gnomemusic/searchbar.py
+++ b/gnomemusic/searchbar.py
@@ -9,6 +9,7 @@ class Searchbar(Gd.Revealer):
     @log
     def __init__(self, stack_switcher, search_button):
         Gd.Revealer.__init__(self)
+        self.timeout = None
         self.stack_switcher = stack_switcher
         self._search_button = search_button
         toolbar = Gtk.Toolbar()
@@ -51,6 +52,11 @@ class Searchbar(Gd.Revealer):
             self.view.filter.set_visible_func(self.set_view_filter)
             self.view.filter.visible_function_set = True
 
+    def search_entry_timeout(self, widget):
+        if self.timeout:
+            GObject.source_remove(self.timeout)
+        self.timeout = GObject.timeout_add(500, self.search_entry_changed, widget)
+
     @log
     def search_entry_changed(self, widget):
         self.search_term = self._search_entry.get_text()


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