[Xfce4-commits] [xfce/thunar] 01/01: Check for thumbnails in the new location (Bug #11263)

noreply at xfce.org noreply at xfce.org
Sat Nov 1 19:53:33 CET 2014


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

ochosi pushed a commit to branch master
in repository xfce/thunar.

commit 4038bde80f2311fd888f6cb807b0f7eeb574a855
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Fri Oct 31 22:13:29 2014 +0300

    Check for thumbnails in the new location (Bug #11263)
    
    The thumbnail managing standard was updated to change the location
    where thumbnails are 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 Thunar look in both places when the thumbnail is created and
    reports the first one that's found.
    
    Signed-off-by: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
---
 thunar/thunar-file.c |   30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 0bfe166..7a75c06 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -3351,8 +3351,34 @@ thunar_file_get_thumbnail_path (ThunarFile *file)
           basename = g_strconcat (g_checksum_get_string (checksum), ".png", NULL);
           g_checksum_free (checksum);
 
-          file->thumbnail_path = g_build_filename (xfce_get_homedir (), ".thumbnails", 
-                                                   "normal", basename, NULL);
+          /* 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.
+           */
+
+          /* build and check if the thumbnail is in the new location */
+          file->thumbnail_path = g_build_path ("/", g_get_user_cache_dir(),
+                                               "thumbnails", "normal",
+                                               basename, NULL);
+
+          if (!g_file_test(file->thumbnail_path, G_FILE_TEST_EXISTS))
+            {
+              /* Fallback to old version */
+              g_free(file->thumbnail_path);
+
+              file->thumbnail_path = g_build_filename (xfce_get_homedir (), ".thumbnails",
+                                                       "normal", basename, NULL);
+
+              if(!g_file_test(file->thumbnail_path, G_FILE_TEST_EXISTS))
+              {
+                /* Thumbnail doesn't exist in either spot */
+                g_free(file->thumbnail_path);
+                file->thumbnail_path = NULL;
+              }
+            }
 
           g_free (basename);
         }

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


More information about the Xfce4-commits mailing list