[Xfce4-commits] <thunar:master> Use previous thumb state instead of mime check.

Nick Schermer noreply at xfce.org
Tue Sep 25 19:02:03 CEST 2012


Updating branch refs/heads/master
         to aa3e22ffa21d8f0f6836df51450c95d9e466fa0f (commit)
       from 98c944530cd9cb64ea2b63767a99fe60c1ecee04 (commit)

commit aa3e22ffa21d8f0f6836df51450c95d9e466fa0f
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Sep 25 18:59:36 2012 +0200

    Use previous thumb state instead of mime check.
    
    If a thumb previously was generated without problems,
    try it again without checking the scheme/uri combination.
    
    Same for files with the thumb state set to none; don't
    both and skip them.
    
    This saves a lot of checking when resizing or scrolling a
    view.

 thunar/thunar-thumbnailer.c |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/thunar/thunar-thumbnailer.c b/thunar/thunar-thumbnailer.c
index eeba176..4c53159 100644
--- a/thunar/thunar-thumbnailer.c
+++ b/thunar/thunar-thumbnailer.c
@@ -839,14 +839,15 @@ thunar_thumbnailer_queue_files (ThunarThumbnailer *thumbnailer,
                                 GList             *files,
                                 guint             *request)
 {
-  gboolean      success = FALSE;
+  gboolean               success = FALSE;
 #ifdef HAVE_DBUS
-  const gchar **mime_hints;
-  gchar       **uris;
-  GList        *lp;
-  GList        *supported_files = NULL;
-  guint         n;
-  guint         n_items = 0;
+  const gchar          **mime_hints;
+  gchar                **uris;
+  GList                 *lp;
+  GList                 *supported_files = NULL;
+  guint                  n;
+  guint                  n_items = 0;
+  ThunarFileThumbState   thumb_state;
 #endif
 
   _thunar_return_val_if_fail (THUNAR_IS_THUMBNAILER (thumbnailer), FALSE);
@@ -871,11 +872,28 @@ thunar_thumbnailer_queue_files (ThunarThumbnailer *thumbnailer,
    * processed (and awaiting to be refreshed) */
   for (lp = g_list_last (files); lp != NULL; lp = lp->prev)
     {
-      if (thunar_thumbnailer_file_is_supported (thumbnailer, lp->data))
+      /* get the current thumb state */
+      thumb_state = thunar_file_get_thumb_state (lp->data);
+
+      /* if previously this failed, don't both to check. this saves a
+       * lot of check when resizing a window */
+      if (thumb_state == THUNAR_FILE_THUMB_STATE_NONE)
+        continue;
+
+      /* if the state is unknown of there previously was a thumb, add
+       * to the supported list */
+      if (thumb_state == THUNAR_FILE_THUMB_STATE_READY
+          || thunar_thumbnailer_file_is_supported (thumbnailer, lp->data))
         {
           supported_files = g_list_prepend (supported_files, lp->data);
           n_items++;
         }
+      else
+        {
+          /* 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);
+        }
     }
 
   /* release the thumbnailer lock */


More information about the Xfce4-commits mailing list