From 64c19b7ebc28e0bd08ee2a07105e1edccb60291f Mon Sep 17 00:00:00 2001 From: Nick Schermer <nick@xfce.org> Date: Sun, 25 Nov 2012 13:21:54 +0100 Subject: [PATCH] Test if the application generated a thumbnail if not supported. Thunar refused to show thumbs if not supported by tumbler, but in various cases the application generated its own thumb (gimp for example). --- thunar/thunar-thumbnailer.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/thunar/thunar-thumbnailer.c b/thunar/thunar-thumbnailer.c index eae082526..8e2faaf21 100644 --- a/thunar/thunar-thumbnailer.c +++ b/thunar/thunar-thumbnailer.c @@ -869,6 +869,7 @@ thunar_thumbnailer_queue_files (ThunarThumbnailer *thumbnailer, guint n; guint n_items = 0; ThunarFileThumbState thumb_state; + const gchar *thumbnail_path; #endif _thunar_return_val_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer), FALSE); @@ -895,7 +896,10 @@ thunar_thumbnailer_queue_files (ThunarThumbnailer *thumbnailer, { /* the icon factory only loads icons for regular files */ if (!thunar_file_is_regular (lp->data)) - goto unsupported_type; + { + thunar_file_set_thumb_state (lp->data, THUNAR_FILE_THUMB_STATE_NONE); + continue; + } /* get the current thumb state */ thumb_state = thunar_file_get_thumb_state (lp->data); @@ -918,11 +922,15 @@ thunar_thumbnailer_queue_files (ThunarThumbnailer *thumbnailer, } else { - unsupported_type: + /* still a regular file, but the type is now known to tumbler but + * maybe the application created a thumbnail */ + thumbnail_path = thunar_file_get_thumbnail_path (lp->data); - /* we have no thumb for this mime-type / scheme combination, - * so don't both in the future */ - thunar_file_set_thumb_state (lp->data, THUNAR_FILE_THUMB_STATE_NONE); + /* test if a thumbnail can be found */ + if (g_file_test (thumbnail_path, G_FILE_TEST_EXISTS)) + thunar_file_set_thumb_state (lp->data, THUNAR_FILE_THUMB_STATE_READY); + else + thunar_file_set_thumb_state (lp->data, THUNAR_FILE_THUMB_STATE_NONE); } } -- GitLab