[gnome-documents/wip/rishi/onedrive: 10/11] documents: ...
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/wip/rishi/onedrive: 10/11] documents: ...
- Date: Wed, 5 Apr 2017 15:26:35 +0000 (UTC)
commit b6cd027d3370205d4221ca6c151394946b227cf9
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Apr 5 17:19:55 2017 +0200
documents: ...
src/documents.js | 51 +++++++++++++++++++++++++++------------------------
1 files changed, 27 insertions(+), 24 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index d2fed31..ca4dcc0 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -984,34 +984,37 @@ const GoogleDocument = new Lang.Class({
},
load: function(passwd, cancellable, callback) {
- this.createGDataEntry(cancellable, Lang.bind(this,
- function(entry, service, exception) {
- if (exception) {
- // try loading from the most recent cache, if any
- GdPrivate.pdf_loader_load_uri_async(this.identifier, passwd, cancellable, Lang.bind(this,
- function(source, res) {
- try {
- let docModel = GdPrivate.pdf_loader_load_uri_finish(res);
- callback(this, docModel, null);
- } catch (e) {
- // report the outmost error only
- callback(this, null, exception);
- }
- }));
-
+ this.download(true, cancellable, Lang.bind(this,
+ function(fromCache, error) {
+ if (error) {
+ callback(this, null, error);
return;
}
- GdPrivate.pdf_loader_load_gdata_entry_async
- (entry, service, cancellable, Lang.bind(this,
- function(source, res) {
- try {
- let docModel = GdPrivate.pdf_loader_load_uri_finish(res);
- callback(this, docModel, null);
- } catch (e) {
- callback(this, null, e);
+ this.loadLocal(passwd, cancellable, Lang.bind(this,
+ function(doc, docModel, error) {
+ if (error) {
+ if (error.matches(EvDocument.DocumentError, EvDocument.DocumentError.ENCRYPTED))
{
+ callback(this, null, error);
+ } else if (fromCache) {
+ this.download(false, cancellable, Lang.bind(this,
+ function(fromCache, error) {
+ if (error) {
+ callback(this, null, error);
+ return;
+ }
+
+ this.loadLocal(passwd, cancellable, callback);
+ }));
+ } else {
+ callback(this, null, error);
}
- }));
+
+ return;
+ }
+
+ callback(this, docModel, null);
+ }));
}));
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]