[glib] file-info: catch thumbnail files in large directory as well



commit d681b581ff059fdf258b6f91b62cf1e474f2cc71
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Apr 30 22:39:57 2012 -0400

    file-info: catch thumbnail files in large directory as well
    
    When building the file attribute table info for local files, use
    thumbnail paths in $XDG_CACHE_DIR/thumbnails/large in addition to
    $XDG_CACHE_DIR/thumbnails/normal.
    
    Failing to do this would cause an application that creates large
    thumbnails by default to never find any value for
    G_FILE_ATTRIBUTE_THUMBNAIL_PATH, with no
    G_FILE_ATTRIBUTE_THUMBNAILING_FAILED set, which might cause the
    application to either think thumbnailing is still in progress, or
    blindly requeue thumbnail operations in a loop.
    
    Large thumbnails are generally preferred, so we now default to the path
    of a large thumbnail (in case both are present).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686895

 gio/glocalfileinfo.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 1bff319..306fb58 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -1292,7 +1292,7 @@ get_thumbnail_attributes (const char *path,
   g_checksum_free (checksum);
 
   filename = g_build_filename (g_get_user_cache_dir (),
-                               "thumbnails", "normal", basename,
+                               "thumbnails", "large", basename,
                                NULL);
 
   if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
@@ -1301,13 +1301,22 @@ get_thumbnail_attributes (const char *path,
     {
       g_free (filename);
       filename = g_build_filename (g_get_user_cache_dir (),
-                                   "thumbnails", "fail",
-                                   "gnome-thumbnail-factory",
-                                   basename,
+                                   "thumbnails", "normal", basename,
                                    NULL);
 
       if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
-	_g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_THUMBNAILING_FAILED, TRUE);
+        _g_file_info_set_attribute_byte_string_by_id (info, G_FILE_ATTRIBUTE_ID_THUMBNAIL_PATH, filename);
+      else
+        {
+          filename = g_build_filename (g_get_user_cache_dir (),
+                                       "thumbnails", "fail",
+                                       "gnome-thumbnail-factory",
+                                       basename,
+                                       NULL);
+
+          if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
+            _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_THUMBNAILING_FAILED, TRUE);
+        }
     }
   g_free (basename);
   g_free (filename);



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