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



commit dc935f93eed32d6e41e547ac42c1ceee4cba68c4
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Apr 23 12:02:38 2018 -0400

    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 1b91f4f87..9a20ee3e8 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -5106,6 +5106,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);
@@ -5116,6 +5117,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;
 }
 
 /**
@@ -5994,6 +5996,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 e9ae3b638..887e95617 100644
--- a/src/nautilus-canvas-private.h
+++ b/src/nautilus-canvas-private.h
@@ -201,6 +201,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]