[Xfce4-commits] <thunar:master> Test if the application generated a thumbnail if not supported.

Nick Schermer noreply at xfce.org
Sun Nov 25 13:24:01 CET 2012


Updating branch refs/heads/master
         to 64c19b7ebc28e0bd08ee2a07105e1edccb60291f (commit)
       from feaddf4a547225805a9c21624eeaa77a8e2a100e (commit)

commit 64c19b7ebc28e0bd08ee2a07105e1edccb60291f
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Nov 25 13:21:54 2012 +0100

    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 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/thunar/thunar-thumbnailer.c b/thunar/thunar-thumbnailer.c
index eae0825..8e2faaf 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);
         }
     }
 


More information about the Xfce4-commits mailing list