[Tracker] [PATCH 1/2] tracker-search-tool: delay 500ms before querying tracker
- From: "Juan A. Suarez Romero" <jasuarez igalia com>
- To: tracker-list gnome org
- Subject: [Tracker] [PATCH 1/2] tracker-search-tool: delay 500ms before querying tracker
- Date: Mon, 2 Nov 2009 16:02:20 +0100
Querying tracker happens everytime user types a letter.
To avoid it, waits for 500ms after user stops typing before asking tracker.
---
src/tracker-search-tool/tracker-entry.gs | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/tracker-search-tool/tracker-entry.gs b/src/tracker-search-tool/tracker-entry.gs
index 211f6d8..5f02004 100644
--- a/src/tracker-search-tool/tracker-entry.gs
+++ b/src/tracker-search-tool/tracker-entry.gs
@@ -25,7 +25,11 @@ uses
TrackerUtils
+const static RUN_DELAY : int = 500
+
class TrackerSearchEntry : Gtk.Entry
+ id_invoker : uint = 0
+
prop Query : TrackerQuery
init
@@ -43,12 +47,23 @@ class TrackerSearchEntry : Gtk.Entry
def private entry_changed (editable : Editable)
if Query is not null
if text is null
+ Query.SearchTerms = ""
+ if id_invoker != 0
+ Source.remove (id_invoker)
+ id_invoker = 0
+ set_icon_sensitive (EntryIconPosition.SECONDARY, false)
+ else
+ if id_invoker != 0
+ Source.remove (id_invoker)
+ id_invoker = Timeout.add (RUN_DELAY, run_query)
+
+ def private run_query () : bool
+ if Query is not null
+ if text is null
set_icon_sensitive (EntryIconPosition.SECONDARY, false)
Query.SearchTerms = ""
else
set_icon_sensitive (EntryIconPosition.SECONDARY, true)
Query.SearchTerms = EscapeSparql (text, true)
-
+ return false
-
-
--
1.6.0.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]