[Xfce4-commits] <thunar:master> Don't request thumbnails twice when entering a folder.

Nick Schermer noreply at xfce.org
Mon Sep 24 19:54:03 CEST 2012


Updating branch refs/heads/master
         to 1e23b9a0675d4eaa2b75e7e7dadab293b456f7ac (commit)
       from 62b1d1000c420d3dc5af9667e73148fd5e410a30 (commit)

commit 1e23b9a0675d4eaa2b75e7e7dadab293b456f7ac
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Sep 24 18:36:38 2012 +0200

    Don't request thumbnails twice when entering a folder.
    
    Both in set_dir and size_allocate the images were requested,
    resuling in doubling the traffic between tumbler and thunar.

 thunar/thunar-standard-view.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 451fa6f..c60d508 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -1240,7 +1240,7 @@ thunar_standard_view_set_current_directory (ThunarNavigator *navigator,
   gtk_action_set_visible (standard_view->priv->action_restore, trashed);
 
   /* schedule a thumbnail timeout */
-  thunar_standard_view_schedule_thumbnail_timeout (standard_view);
+  /* NOTE: quickly after this we always trigger a size allocate wich will handle this */
 
   /* notify all listeners about the new/old current directory */
   g_object_notify (G_OBJECT (standard_view), "current-directory");
@@ -3592,8 +3592,16 @@ thunar_standard_view_size_allocate (ThunarStandardView *standard_view,
 {
   _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
 
-  /* reschedule a thumbnail request timeout */
-  thunar_standard_view_schedule_thumbnail_timeout (standard_view);
+  /* ignore size changes when the view is still loading */
+  if (thunar_view_get_loading (THUNAR_VIEW (standard_view)))
+    return;
+
+  /* to avoid a flow of updates, don't update if there is already a request pending */
+  if (standard_view->priv->thumbnail_source_id == 0)
+    {
+      /* reschedule a thumbnail request timeout */
+      thunar_standard_view_schedule_thumbnail_timeout (standard_view);
+    }
 }
 
 


More information about the Xfce4-commits mailing list