[gnome-documents/wip/rishi/onedrive: 8/11] documents: Specify uriToLoad for GoogleDocument



commit 804a0d43e2dd19ba0f7fcfda2828d71361e154df
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Apr 5 17:03:04 2017 +0200

    documents: Specify uriToLoad for GoogleDocument
    
    This will let us use the new JavaScript-based download and caching
    implementation and reduce our reliance on GdPdfLoader.

 src/documents.js |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 4daaf03..c95abeb 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -1037,6 +1037,15 @@ const GoogleDocument = new Lang.Class({
         this.shared = cursor.get_boolean(Query.QueryColumns.SHARED);
 
         this.parent(cursor);
+
+        let localDir = GLib.build_filenamev([GLib.get_user_cache_dir(), "gnome-documents", "google"]);
+
+        let identifierHash = GLib.compute_checksum_for_string(GLib.ChecksumType.SHA1, this.identifier, -1);
+        let localFilename = identifierHash + ".pdf";
+
+        let localPath = GLib.build_filenamev([localDir, localFilename]);
+        let localFile = Gio.File.new_for_path(localPath);
+        this.uriToLoad = localFile.get_uri();
     },
 
     canEdit: function() {


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