[nautilus] Eliminate accessible children-changed event flood during initial load



commit a4c27ad2b3dfc03dfe41260206dd1684c3949139
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.

 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 85d769d62..cdfb3fda5 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -5155,6 +5155,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);
@@ -5165,6 +5166,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;
 }
 
 /**
@@ -6043,6 +6045,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 d79354c6d..526e1ad6e 100644
--- a/src/nautilus-canvas-private.h
+++ b/src/nautilus-canvas-private.h
@@ -200,6 +200,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]