[tracker/tracker-needle-model] needle: Ensure operations are cancelled on a new search term
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-needle-model] needle: Ensure operations are cancelled on a new search term
- Date: Mon, 21 Mar 2011 15:18:50 +0000 (UTC)
commit d2b2cf97ee00c41c3bfde064fd6d9916f525b1e7
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Mar 21 16:18:29 2011 +0100
needle: Ensure operations are cancelled on a new search term
src/tracker-needle/tracker-result-store.vala | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-needle/tracker-result-store.vala b/src/tracker-needle/tracker-result-store.vala
index 5e5c5a3..43ec11d 100644
--- a/src/tracker-needle/tracker-result-store.vala
+++ b/src/tracker-needle/tracker-result-store.vala
@@ -76,7 +76,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
query.limit = 100;
query.offset = op.offset;
- cursor = yield query.perform_async (op.node.type, op.node.args);
+ cursor = yield query.perform_async (op.node.type, op.node.args, cancellable);
for (i = op.offset; i < op.offset + 100; i++) {
ResultNode *result;
@@ -86,7 +86,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
int j;
try {
- b = yield cursor.next_async ();
+ b = yield cursor.next_async (cancellable);
} catch (GLib.Error ge) {
warning ("Could not fetch row: %s\n", ge.message);
}
@@ -180,7 +180,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
Tracker.Query query = new Tracker.Query ();
query.criteria = _search_term;
- count = yield query.get_count_async (cat.type);
+ count = yield query.get_count_async (cat.type, cancellable);
} catch (GLib.IOError ie) {
warning ("Could not get count: %s\n", ie.message);
return;
@@ -271,11 +271,16 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
if (cancellable != null) {
cancellable.cancel ();
+ cancellable = null;
}
+ cancellable = new Cancellable ();
+
clear_results ();
this.active = true;
+ running_operations = new GenericArray<Operation?> ();
+ delayed_operations = new GenericArray<Operation?> ();
this.timestamp++;
for (i = 0; i < categories.length; i++) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]