[nautilus] Eliminate accessible children-changed event flood on container repopulation
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Eliminate accessible children-changed event flood on container repopulation
- Date: Thu, 3 May 2018 11:42:20 +0000 (UTC)
commit c8744eafc312ba89ebdc4f20d0aee73be3dcf1fc
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu May 3 07:27:11 2018 -0400
Eliminate accessible children-changed event flood on container repopulation
When the canvas container is repopulated (e.g. when using back/forward,
or pressing Esc while in a search), finish_adding_new_icons is called
leading to an accessible-children-changed event flood. We can distinguish
these unwanted notifications from desired notifications by comparing the
number of new icons to add with the size of the container's icon set.
Note that we cannot reliably identify this condition by monitoring the
is-loading property of the view: Loading officially can end while icons
are still being added. This is especially true in the case of very large
icon sets, which is the exact scenario we're trying to avoid.
src/nautilus-canvas-container.c | 6 ++++--
src/nautilus-canvas-private.h | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c
index cdfb3fda5..56a0d984a 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -5075,6 +5075,8 @@ finish_adding_new_icons (NautilusCanvasContainer *container)
new_icons = container->details->new_icons;
container->details->new_icons = NULL;
+ container->details->is_populating_container = g_list_length (new_icons) ==
+ g_hash_table_size (container->details->icon_set);
/* Position most icons (not unpositioned manual-layout icons). */
new_icons = g_list_reverse (new_icons);
@@ -6045,8 +6047,8 @@ 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)
+ /* We don't want to emit children_changed signals during any type of load. */
+ if (!container->details->in_layout_now || container->details->is_populating_container)
return;
icon = g_hash_table_lookup (container->details->icon_set, icon_data);
diff --git a/src/nautilus-canvas-private.h b/src/nautilus-canvas-private.h
index 526e1ad6e..dd5e79060 100644
--- a/src/nautilus-canvas-private.h
+++ b/src/nautilus-canvas-private.h
@@ -202,6 +202,7 @@ struct NautilusCanvasContainerDetails {
eel_boolean_bit in_layout_now : 1;
eel_boolean_bit is_loading : 1;
+ eel_boolean_bit is_populating_container : 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]