[Xfce4-commits] [xfce/xfdesktop] 10/19: Check for thumbnails in the new location

noreply at xfce.org noreply at xfce.org
Sun Nov 9 15:36:52 CET 2014


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch xfce-4.10
in repository xfce/xfdesktop.

commit 9b697895d5012bcd88ceeb4ae41e7c2a67bd4add
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sun Feb 9 20:01:33 2014 +0300

    Check for thumbnails in the new location
    
    The thumbnail managing standard was updated to change the location
    where thumbnails are sometimes stored. This has been changed to
    $XDG_CACHE_HOME/thumbnails/ unless $XDG_CACHE_HOME isn't defined,
    at which point it's back to $HOME/.cache/thumbnails . This patch
    has xfdesktop look in both places when the thumbnail is created
    and reports the first one that's found.
---
 common/xfdesktop-thumbnailer.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/common/xfdesktop-thumbnailer.c b/common/xfdesktop-thumbnailer.c
index 8f39fe9..daba7f2 100644
--- a/common/xfdesktop-thumbnailer.c
+++ b/common/xfdesktop-thumbnailer.c
@@ -517,7 +517,11 @@ xfdesktop_thumbnailer_thumbnail_ready_dbus(DBusGProxy *proxy,
 
         if(strcmp (uri[x], f_uri) == 0) {
             /* The thumbnail is in the format/location
+             * $XDG_CACHE_HOME/thumbnails/(nromal|large)/MD5_Hash_Of_URI.png
+             * for version 0.8.0 if XDG_CACHE_HOME is defined, otherwise
              * /homedir/.thumbnails/(normal|large)/MD5_Hash_Of_URI.png
+             * will be used, which is also always used for versions prior
+             * to 0.7.0.
              */
             f_uri_checksum = g_compute_checksum_for_string(G_CHECKSUM_MD5,
                                                            f_uri, strlen (f_uri));
@@ -529,10 +533,20 @@ xfdesktop_thumbnailer_thumbnail_ready_dbus(DBusGProxy *proxy,
 
             filename = g_strconcat(f_uri_checksum, ".png", NULL);
 
-            thumbnail_location = g_build_path("/", g_get_home_dir(),
-                                              ".thumbnails", thumbnail_flavor,
+            /* build and check if the thumbnail is in the new location */
+            thumbnail_location = g_build_path("/", g_get_user_cache_dir(),
+                                              "thumbnails", thumbnail_flavor,
                                               filename, NULL);
 
+            if(!g_file_test(thumbnail_location, G_FILE_TEST_EXISTS)) {
+                /* Fallback to old version */
+                g_free(thumbnail_location);
+
+                thumbnail_location = g_build_path("/", g_get_home_dir(),
+                                                  ".thumbnails", thumbnail_flavor,
+                                                  filename, NULL);
+            }
+
             DBG("thumbnail-ready src: %s thumbnail: %s",
                     (char*)iter->data,
                     thumbnail_location);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list