[gnome-documents] application: move miner ownership from TrackerController to Application
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] application: move miner ownership from TrackerController to Application
- Date: Mon, 12 Mar 2012 20:17:57 +0000 (UTC)
commit 97dcfb1e3700fdcec26e6953b2bbd87204e9d83a
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Mar 12 00:14:32 2012 -0400
application: move miner ownership from TrackerController to Application
We don't want to trigger a miner refresh every time we search from the
shell.
src/application.js | 24 ++++++++++++++++++++++++
src/trackerController.js | 23 -----------------------
2 files changed, 24 insertions(+), 23 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index d5dfee8..5ca910e 100644
--- a/src/application.js
+++ b/src/application.js
@@ -19,7 +19,9 @@
*
*/
+const DBus = imports.dbus;
const Lang = imports.lang;
+const Mainloop = imports.mainloop;
const Gettext = imports.gettext;
const _ = imports.gettext.gettext;
@@ -36,6 +38,7 @@ const ChangeMonitor = imports.changeMonitor;
const Documents = imports.documents;
const Error = imports.error;
const Format = imports.format;
+const GDataMiner = imports.gDataMiner;
const Global = imports.global;
const Main = imports.main;
const MainWindow = imports.mainWindow;
@@ -52,6 +55,8 @@ const Tweener = imports.util.tweener;
const Utils = imports.utils;
const WindowMode = imports.windowMode;
+const MINER_REFRESH_TIMEOUT = 60; /* seconds */
+
function Application() {
this._init();
}
@@ -137,6 +142,21 @@ Application.prototype = {
this.application.set_app_menu(menu);
},
+ _refreshMinerNow: function() {
+ this._miner.RefreshDBRemote(DBus.CALL_FLAG_START, Lang.bind(this,
+ function(res, error) {
+ if (error) {
+ log('Error updating the GData cache: ' + error.toString());
+ return;
+ }
+
+ Mainloop.timeout_add_seconds(MINER_REFRESH_TIMEOUT,
+ Lang.bind(this, this._refreshMinerNow));
+ }));
+
+ return false;
+ },
+
_onStartup: function() {
String.prototype.format = Format.format;
@@ -178,6 +198,10 @@ Application.prototype = {
Global.modeController = new WindowMode.ModeController();
Global.notificationManager = new Notifications.NotificationManager();
+ // startup a refresh of the gdocs cache
+ this._miner = new GDataMiner.GDataMiner();
+ this._refreshMinerNow();
+
this._initMenus();
this._mainWindow = new MainWindow.MainWindow(this.application);
},
diff --git a/src/trackerController.js b/src/trackerController.js
index 18e8d8b..1605e95 100644
--- a/src/trackerController.js
+++ b/src/trackerController.js
@@ -19,12 +19,9 @@
*
*/
-const DBus = imports.dbus;
const Lang = imports.lang;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
-const GDataMiner = imports.gDataMiner;
const Global = imports.global;
const Query = imports.query;
const Utils = imports.utils;
@@ -32,8 +29,6 @@ const Utils = imports.utils;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
-const MINER_REFRESH_TIMEOUT = 60; /* seconds */
-
const QueryType = {
SELECT: 0,
UPDATE: 1,
@@ -124,9 +119,6 @@ TrackerController.prototype = {
this._queryQueued = false;
this._queryQueuedFlags = RefreshFlags.NONE;
this._querying = false;
- // startup a refresh of the gdocs cache
- this._miner = new GDataMiner.GDataMiner();
- this._refreshMinerNow();
// useful for debugging
this._lastQueryTime = 0;
@@ -157,21 +149,6 @@ TrackerController.prototype = {
this._refreshInternal(RefreshFlags.NONE);
},
- _refreshMinerNow: function() {
- this._miner.RefreshDBRemote(DBus.CALL_FLAG_START, Lang.bind(this,
- function(res, error) {
- if (error) {
- log('Error updating the GData cache: ' + error.toString());
- return;
- }
-
- Mainloop.timeout_add_seconds(MINER_REFRESH_TIMEOUT,
- Lang.bind(this, this._refreshMinerNow));
- }));
-
- return false;
- },
-
_setQueryStatus: function(status) {
if (this._querying == status)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]