[gvfs/wip/goa: 1/4] daemon: Catch thumbnail files in large directory as well



commit b1747a00dae2d18eb89238d4211ae0e792bfbee6
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Nov 20 00:06:16 2012 +0100

    daemon: Catch thumbnail files in large directory as well
    
    When building the file attribute table info, 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).
    
    Fixes: https://bugzilla.gnome.org/688685

 daemon/gvfsbackend.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/daemon/gvfsbackend.c b/daemon/gvfsbackend.c
index 0c84c15..06195a6 100644
--- a/daemon/gvfsbackend.c
+++ b/daemon/gvfsbackend.c
@@ -527,7 +527,7 @@ get_thumbnail_attributes (const char *uri,
   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))
@@ -536,13 +536,23 @@ get_thumbnail_attributes (const char *uri,
     {
       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 (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED, TRUE);
+        g_file_info_set_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH, filename);
+      else
+        {
+          g_free (filename);
+          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 (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED, TRUE);
+        }
     }
   g_free (basename);
   g_free (filename);



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