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



commit 760fa98e88c69ea916f6b15f723f88d611c494e3
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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781032

 src/documents.js |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 1b0d6f1..93c8e8f 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]