[gnome-documents] tracker-controller: don't start automatically at construction



commit 46c38d853c043404a3b91410418bafa0fd633b7d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 12 21:16:51 2012 -0400

    tracker-controller: don't start automatically at construction
    
    Since we might be started in preview mode, avoid starting up
    immediately. The View object will fire it up when it's constructed
    (which is as soon as the WindowMode is OVERVIEW).

 src/trackerController.js |   13 ++++++++++---
 src/view.js              |    2 ++
 2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/trackerController.js b/src/trackerController.js
index 1605e95..968a184 100644
--- a/src/trackerController.js
+++ b/src/trackerController.js
@@ -119,6 +119,7 @@ TrackerController.prototype = {
         this._queryQueued = false;
         this._queryQueuedFlags = RefreshFlags.NONE;
         this._querying = false;
+        this._isStarted = false;
 
         // useful for debugging
         this._lastQueryTime = 0;
@@ -144,9 +145,6 @@ TrackerController.prototype = {
 
         Global.searchMatchManager.connect('active-changed',
                                           Lang.bind(this, this._onSearchMatchChanged));
-
-        // perform initial query
-        this._refreshInternal(RefreshFlags.NONE);
     },
 
     _setQueryStatus: function(status) {
@@ -224,6 +222,8 @@ TrackerController.prototype = {
     },
 
     _refreshInternal: function(flags) {
+        this._isStarted = true;
+
         if (flags & RefreshFlags.RESET_OFFSET)
             Global.offsetController.resetOffset();
 
@@ -261,6 +261,13 @@ TrackerController.prototype = {
         if (this._currentQuery.activeSource &&
             this._currentQuery.activeSource.id == 'all')
             this._refreshInternal(RefreshFlags.NONE);
+    },
+
+    start: function() {
+        if (this._isStarted)
+            return;
+
+        this._refreshInternal(RefreshFlags.NONE);
     }
 };
 Signals.addSignalMethods(TrackerController.prototype);
diff --git a/src/view.js b/src/view.js
index 3756783..47721ca 100644
--- a/src/view.js
+++ b/src/view.js
@@ -138,6 +138,8 @@ View.prototype = {
         this._queryId =
             Global.trackerController.connect('query-status-changed',
                                              Lang.bind(this, this._onQueryStatusChanged));
+        // ensure the tracker controller is started
+        Global.trackerController.start();
 
         // this will create the model if we're done querying
         this._onQueryStatusChanged();



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