[gnome-documents] tracker-controller: fold query error emission in TrackerController
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] tracker-controller: fold query error emission in TrackerController
- Date: Tue, 17 Jul 2012 20:42:21 +0000 (UTC)
commit 53440cfe76440a759bd44385d45d07801e9f871b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Jul 17 15:44:11 2012 -0400
tracker-controller: fold query error emission in TrackerController
No need to have an ErrorHandler separate object anymore.
src/Makefile-js.am | 1 -
src/application.js | 2 --
src/embed.js | 19 ++++++-------------
src/error.js | 42 ------------------------------------------
src/global.js | 1 -
src/trackerController.js | 11 ++++++++++-
6 files changed, 16 insertions(+), 60 deletions(-)
---
diff --git a/src/Makefile-js.am b/src/Makefile-js.am
index 8e981d8..8900798 100644
--- a/src/Makefile-js.am
+++ b/src/Makefile-js.am
@@ -4,7 +4,6 @@ dist_js_DATA = \
changeMonitor.js \
documents.js \
embed.js \
- error.js \
errorBox.js \
gDataMiner.js \
global.js \
diff --git a/src/application.js b/src/application.js
index 4739f2f..18ecd44 100644
--- a/src/application.js
+++ b/src/application.js
@@ -36,7 +36,6 @@ const Tracker = imports.gi.Tracker;
const ChangeMonitor = imports.changeMonitor;
const Documents = imports.documents;
-const Error = imports.error;
const Format = imports.format;
const GDataMiner = imports.gDataMiner;
const Global = imports.global;
@@ -197,7 +196,6 @@ const Application = new Lang.Class({
Global.changeMonitor = new ChangeMonitor.TrackerChangeMonitor();
Global.documentManager = new Documents.DocumentManager();
- Global.errorHandler = new Error.ErrorHandler();
Global.trackerController = new TrackerController.TrackerController();
Global.selectionController = new Selections.SelectionController();
Global.modeController = new WindowMode.ModeController();
diff --git a/src/embed.js b/src/embed.js
index 3c69bf9..5373993 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -131,6 +131,8 @@ const Embed = new Lang.Class({
Lang.bind(this, this._onFullscreenChanged));
Global.trackerController.connect('query-status-changed',
Lang.bind(this, this._onQueryStatusChanged));
+ Global.trackerController.connect('query-error',
+ Lang.bind(this, this._onQueryError));
Global.documentManager.connect('active-changed',
Lang.bind(this, this._onActiveItemChanged));
@@ -155,6 +157,10 @@ const Embed = new Lang.Class({
}
},
+ _onQueryError: function(manager, message, exception) {
+ this._setError(message, exception.message);
+ },
+
_onFullscreenChanged: function(controller, fullscreen) {
if (fullscreen) {
this._previewFullscreen = new Preview.PreviewFullscreen(this._preview, this._overlayLayout, this._contentsActor);
@@ -233,23 +239,10 @@ const Embed = new Lang.Class({
this._spinnerBox.moveOut();
this._errorBox.moveOut();
- this._queryErrorId =
- Global.errorHandler.connect('query-error',
- Lang.bind(this, this._onQueryError));
-
this._notebook.set_current_page(this._viewPage);
},
- _onQueryError: function(manager, message, exception) {
- this._setError(message, exception.message);
- },
-
_prepareForPreview: function() {
- if (this._queryErrorId != 0) {
- Global.errorHandler.disconnect(this._queryErrorId);
- this._queryErrorId = 0;
- }
-
this._notebook.set_current_page(this._previewPage);
},
diff --git a/src/global.js b/src/global.js
index abb90e2..6beddc5 100644
--- a/src/global.js
+++ b/src/global.js
@@ -31,7 +31,6 @@ let collectionManager = null;
let connection = null;
let connectionQueue = null;
let documentManager = null;
-let errorHandler = null;
let goaClient = null;
let modeController = null;
let notificationManager = null;
diff --git a/src/trackerController.js b/src/trackerController.js
index 4dacb75..4f20073 100644
--- a/src/trackerController.js
+++ b/src/trackerController.js
@@ -28,6 +28,7 @@ const Utils = imports.utils;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
+const _ = imports.gettext.gettext;
const QueryType = {
SELECT: 0,
@@ -154,11 +155,19 @@ const TrackerController = new Lang.Class({
return this._querying;
},
+ _onQueryError: function(exception) {
+ if (exception.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
+ return;
+
+ let message = _("Unable to fetch the list of documents");
+ this.emit('query-error', message, exception);
+ },
+
_onQueryFinished: function(exception) {
this._setQueryStatus(false);
if (exception)
- Global.errorHandler.addQueryError(exception);
+ this._onQueryError(exception);
else
Global.offsetController.resetItemCount();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]