[tracker/tracker-needle-model: 2/6] needle: Connect to search.activate to trigger query immediately.



commit 7655323a7dbc5060b6c335e17581fc9bc5c9b3d9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Mar 17 18:43:09 2011 +0100

    needle: Connect to search.activate to trigger query immediately.

 src/tracker-needle/tracker-needle.vala |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 174643f..e5b515f 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -143,6 +143,7 @@ public class Tracker.Needle {
 		search_list = builder.get_object ("comboboxentry_search") as ComboBoxEntry;
 		search = search_list.get_child () as Entry;
 		search.changed.connect (search_changed);
+		search.activate.connect (search_activated);
 		search_history_insert (history.get ());
 
 		spinner = new Spinner ();
@@ -219,6 +220,15 @@ public class Tracker.Needle {
 		last_search_id = Timeout.add_seconds (1, search_run);
 	}
 
+	private void search_activated (Entry entry) {
+		if (last_search_id != 0) {
+			Source.remove (last_search_id);
+			last_search_id = 0;
+		}
+
+		search_run ();
+	}
+
 	private async void search_simple (ListStore store) requires (store != null) {
 		/*
 		Tracker.Query query = new Tracker.Query ();
@@ -330,8 +340,6 @@ public class Tracker.Needle {
 			query.limit = 1000;
 			query.criteria = search.get_text ();
 
-			print (search.get_text ());
-
 			try {
 				cursor = yield query.perform_async (type, null);
 



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