[tracker/tracker-0.10] needle: Cancel operations on hidden views.



commit 8931d06a442852f2cebb1e6b47d7c7f6770afcca
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Apr 4 11:52:23 2011 +0200

    needle: Cancel operations on hidden views.

 src/tracker-needle/tracker-result-store.vala |    9 +++++++++
 src/tracker-needle/tracker-view.vala         |    8 ++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-needle/tracker-result-store.vala b/src/tracker-needle/tracker-result-store.vala
index 1d5d0b8..34a264b 100644
--- a/src/tracker-needle/tracker-result-store.vala
+++ b/src/tracker-needle/tracker-result-store.vala
@@ -803,4 +803,13 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 	public bool has_results () {
 		return filled_categories_count () > 0;
 	}
+
+	public void cancel_search () {
+		if (cancellable != null) {
+			cancellable.cancel ();
+			cancellable = null;
+		}
+
+		clear_results ();
+	}
 }
diff --git a/src/tracker-needle/tracker-view.vala b/src/tracker-needle/tracker-view.vala
index 686377e..124c9eb 100644
--- a/src/tracker-needle/tracker-view.vala
+++ b/src/tracker-needle/tracker-view.vala
@@ -81,6 +81,14 @@ public class Tracker.View : ScrolledWindow {
 		return true;
 	}
 
+	public override void unmap () {
+		if (store != null) {
+			store.cancel_search ();
+		}
+
+		base.unmap ();
+	}
+
 	public View (Display? _display = Display.NO_RESULTS, ResultStore? store) {
 		set_policy (PolicyType.NEVER, PolicyType.AUTOMATIC);
 



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