[nautilus/gnome-3-26] Eliminate accessible children-changed event flood during initial load



commit 05e21190c1961a578eead6c89f193cb028bedbac
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Apr 23 18:02:38 2018 +0200

    Eliminate accessible children-changed event flood during initial load
    
    Accessible children-changed events should not be emitted during the
    initial load of the icon container. They should only be emitted when
    a user-triggered action (creation of file, copying an item) causes
    an item to be added.
    
    User-triggered actions result in nautilus_canvas_container_layout_now
    being called, so set a flag there so that we can distinguish the two
    types of additions in the accessible icon-added callback.
    
    (cherry picked from commit a4c27ad2b3dfc03dfe41260206dd1684c3949139)

 src/nautilus-canvas-container.c | 6 ++++++
 src/nautilus-canvas-private.h   | 1 +
 2 files changed, 7 insertions(+)
---
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c
index b85a2adc2..fa28051ff 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -6965,6 +6965,7 @@ nautilus_canvas_container_add (NautilusCanvasContainer *container,
 void
 nautilus_canvas_container_layout_now (NautilusCanvasContainer *container)
 {
+    container->details->in_layout_now = TRUE;
     if (container->details->idle_id != 0)
     {
         unschedule_redo_layout (container);
@@ -6975,6 +6976,7 @@ nautilus_canvas_container_layout_now (NautilusCanvasContainer *container)
      * newly added files may trigger a change in the size allocation and
      * thus toggle scrollbars on */
     gtk_container_check_resize (GTK_CONTAINER (gtk_widget_get_parent (GTK_WIDGET (container))));
+    container->details->in_layout_now = FALSE;
 }
 
 /**
@@ -8241,6 +8243,10 @@ nautilus_canvas_container_accessible_icon_added_cb (NautilusCanvasContainer *con
     AtkObject *atk_parent;
     AtkObject *atk_child;
 
+    /* We don't want to emit children_changed signals during the initial load. */
+    if (!container->details->in_layout_now)
+        return;
+
     icon = g_hash_table_lookup (container->details->icon_set, icon_data);
     if (icon)
     {
diff --git a/src/nautilus-canvas-private.h b/src/nautilus-canvas-private.h
index 0f3ad706b..0a114ba5a 100644
--- a/src/nautilus-canvas-private.h
+++ b/src/nautilus-canvas-private.h
@@ -235,6 +235,7 @@ struct NautilusCanvasContainerDetails {
        guint a11y_item_action_idle_handler;
        GQueue* a11y_item_action_queue;
 
+       eel_boolean_bit in_layout_now : 1;
        eel_boolean_bit is_loading : 1;
        eel_boolean_bit needs_resort : 1;
        eel_boolean_bit selection_needs_resort : 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]