[gnome-documents/rhel-7.4: 1/16] documents: Simplify calculation of thumbnail paths for GoogleDocuments



commit 4ba7db7a91de431134c23bd2b43ca4e5e63e2bac
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Mar 29 16:04:08 2017 +0200

    documents: Simplify calculation of thumbnail paths for GoogleDocuments
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780718

 src/documents.js |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 50cfbda..2071882 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -30,6 +30,7 @@ const GdPrivate = imports.gi.GdPrivate;
 const Gdk = imports.gi.Gdk;
 const GData = imports.gi.GData;
 const GLib = imports.gi.GLib;
+const GnomeDesktop = imports.gi.GnomeDesktop;
 const Gtk = imports.gi.Gtk;
 const Zpj = imports.gi.Zpj;
 const _ = imports.gettext.gettext;
@@ -916,12 +917,10 @@ const GoogleDocument = new Lang.Class({
                                                              authorization_domain: authorizationDomain,
                                                              download_uri: uri });
 
-                let checksum = new GLib.Checksum(GLib.ChecksumType.MD5);
-                checksum.update(this.uri, -1);
-                let dirPath = GLib.build_filenamev([GLib.get_user_cache_dir(), "thumbnails", "normal"]);
+                let path = GnomeDesktop.desktop_thumbnail_path_for_uri (this.uri,
+                                                                        
GnomeDesktop.DesktopThumbnailSize.NORMAL);
+                let dirPath = GLib.path_get_dirname(path);
                 GLib.mkdir_with_parents(dirPath, 448);
-                let basename = checksum.get_string() + '.png';
-                let path = GLib.build_filenamev([dirPath, basename])
 
                 let downloadFile = Gio.File.new_for_path(path);
                 downloadFile.replace_async


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