summaryrefslogtreecommitdiff
path: root/libnautilus-private
diff options
context:
space:
mode:
authorChristian Neumair <cneumair@gnome.org>2008-06-11 13:27:57 +0000
committerChristian Neumair <cneumair@src.gnome.org>2008-06-11 13:27:57 +0000
commit41a08e56825d7f8573afa28122921040a68d675b (patch)
treeb726f72a13aeab37a28c955a74623e6f0767c4f7 /libnautilus-private
parent90cb6baa9c5f694aa325fc9e1447baed0c716822 (diff)
downloadnautilus-41a08e56825d7f8573afa28122921040a68d675b.tar.gz
Fix thumbnail handling. Always request thumbnailing if a file without any
2008-06-11 Christian Neumair <cneumair@gnome.org> * libnautilus-private/nautilus-file.c (update_info_internal), (nautilus_file_get_icon): * libnautilus-private/nautilus-thumbnails.c (nautilus_has_valid_failed_thumbnail): * libnautilus-private/nautilus-thumbnails.h: Fix thumbnail handling. Always request thumbnailing if a file without any thumbnail changes its mtime, or if a failed thumbnail is not up to date (i.e. its mtime differs from the file's mtime). svn path=/trunk/; revision=14255
Diffstat (limited to 'libnautilus-private')
-rw-r--r--libnautilus-private/nautilus-file.c9
-rw-r--r--libnautilus-private/nautilus-thumbnails.c16
-rw-r--r--libnautilus-private/nautilus-thumbnails.h1
3 files changed, 24 insertions, 2 deletions
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index f837b5a30..e957cfe1e 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -1750,6 +1750,10 @@ update_info_internal (NautilusFile *file,
if (file->details->atime != atime ||
file->details->mtime != mtime ||
file->details->ctime != ctime) {
+ if (file->details->thumbnail == NULL) {
+ file->details->thumbnail_is_up_to_date = FALSE;
+ }
+
changed = TRUE;
}
file->details->atime = atime;
@@ -3424,8 +3428,9 @@ nautilus_file_get_icon (NautilusFile *file,
return icon;
} else if (file->details->thumbnail_path == NULL &&
file->details->can_read &&
- !file->details->thumbnailing_failed &&
- !file->details->is_thumbnailing) {
+ !file->details->is_thumbnailing &&
+ (!file->details->thumbnailing_failed ||
+ !nautilus_has_valid_failed_thumbnail (file))) {
if (nautilus_can_thumbnail (file)) {
nautilus_create_thumbnail (file);
}
diff --git a/libnautilus-private/nautilus-thumbnails.c b/libnautilus-private/nautilus-thumbnails.c
index 32e1bafc2..15166f5f3 100644
--- a/libnautilus-private/nautilus-thumbnails.c
+++ b/libnautilus-private/nautilus-thumbnails.c
@@ -790,6 +790,22 @@ nautilus_can_thumbnail (NautilusFile *file)
return res;
}
+gboolean
+nautilus_has_valid_failed_thumbnail (NautilusFile *file)
+{
+ GnomeThumbnailFactory *factory;
+ char *uri;
+ gboolean res;
+
+ factory = get_thumbnail_factory ();
+
+ uri = nautilus_file_get_uri (file);
+ res = gnome_thumbnail_factory_has_valid_failed_thumbnail (factory, uri, file->details->mtime);
+ g_free (uri);
+
+ return res;
+}
+
void
nautilus_create_thumbnail (NautilusFile *file)
{
diff --git a/libnautilus-private/nautilus-thumbnails.h b/libnautilus-private/nautilus-thumbnails.h
index bfe0724bb..82007bad5 100644
--- a/libnautilus-private/nautilus-thumbnails.h
+++ b/libnautilus-private/nautilus-thumbnails.h
@@ -46,6 +46,7 @@ typedef void (* NautilusThumbnailAsyncLoadFunc) (NautilusThumbnailAsyncLoadHandl
/* Returns NULL if there's no thumbnail yet. */
void nautilus_create_thumbnail (NautilusFile *file);
gboolean nautilus_can_thumbnail (NautilusFile *file);
+gboolean nautilus_has_valid_failed_thumbnail (NautilusFile *file);
gboolean nautilus_thumbnail_is_mimetype_limited_by_size
(const char *mime_type);
void nautilus_thumbnail_frame_image (GdkPixbuf **pixbuf);