From 423889dcf4471dc6fb75bd65e64e270c64971e71 Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Fri, 31 Oct 2014 21:34:03 +0300 Subject: [PATCH] Check for thumbnails in the new location 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. --- thunar/thunar-file.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index c45cf81..a49c19b 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -3351,8 +3351,27 @@ 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); + } g_free (basename); } -- 2.1.2