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
This commit is contained in:
Cosimo Cecchi 2012-04-30 22:39:57 -04:00
parent 36bf25371c
commit d681b581ff

View File

@ -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);