[gnome-documents] documents: don't call addLoadError directly from load()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] documents: don't call addLoadError directly from load()
- Date: Tue, 28 Feb 2012 00:41:39 +0000 (UTC)
commit 6d0076b8c10edda12b1fbba4954632e89e0e181b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Feb 26 16:00:16 2012 -0500
documents: don't call addLoadError directly from load()
Let the caller decide whether the error is fatal (i.e. show an error in
the view) or not.
src/documents.js | 12 ++++++------
src/embed.js | 10 +++++++---
2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 8d2bb29..a7b29e7 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -635,9 +635,9 @@ LocalDocument.prototype = {
function(source, res) {
try {
let document = Gd.pdf_loader_load_uri_finish(res);
- callback(document);
+ callback(this, document, null);
} catch (e) {
- Global.errorHandler.addLoadError(this, e);
+ callback(this, null, e);
}
}));
},
@@ -720,10 +720,10 @@ GoogleDocument.prototype = {
function(source, res) {
try {
let document = Gd.pdf_loader_load_uri_finish(res);
- callback(document);
+ callback(this, document, null);
} catch (e) {
// report the outmost error only
- Global.errorHandler.addLoadError(this, exception);
+ callback(this, null, exception);
return;
}
}));
@@ -736,9 +736,9 @@ GoogleDocument.prototype = {
function(source, res) {
try {
let document = Gd.pdf_loader_load_entry_finish(res);
- callback(document);
+ callback(this, document, null);
} catch (e) {
- Global.errorHandler.addLoadError(this, e);
+ callback(this, null, e);
}
}));
}));
diff --git a/src/embed.js b/src/embed.js
index 773cc4c..4397b09 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -234,9 +234,13 @@ ViewEmbed.prototype = {
doc.loadPreview(this._loaderCancellable, Lang.bind(this, this._onDocumentLoaded));
},
- _onDocumentLoaded: function(document) {
- this._loaderCancellable = null;
- this._docModel = EvView.DocumentModel.new_with_document(document);
+ _onDocumentLoaded: function(doc, evDoc, error) {
+ if (!evDoc) {
+ Global.errorHandler.addLoadError(doc, error);
+ return;
+ }
+
+ this._docModel = EvView.DocumentModel.new_with_document(evDoc);
this._spinnerBox.moveOut();
Global.modeController.setCanFullscreen(true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]