[gnome-documents/gnome-3-22] documents: Specify uriToLoad for GoogleDocument



commit 3e317d2711375a34e9abe99c2962e0293757ca05
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 63fa062..19bddac 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -1017,6 +1017,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]