[nautilus: 3/3] Eliminate accessible name-changed event flood during initial load



commit f0c26cb17562a20a651aa8c42c0360cd6552a91d
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Apr 23 14:25:17 2018 -0400

    Eliminate accessible name-changed event flood during initial load
    
    Accessible name-changed events should not be emitted during the
    initial load of the icon container. They should only be emitted when
    a user-triggered action such as renaming the file causes the change.
    
    This event is being emitted when the editable_text property is being
    set. During the initial load the value is null, so check for that
    condition and only emit the event when the original value is non-null.

 src/nautilus-canvas-item.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-canvas-item.c b/src/nautilus-canvas-item.c
index 4609ad3cf..7f90d1cb3 100644
--- a/src/nautilus-canvas-item.c
+++ b/src/nautilus-canvas-item.c
@@ -276,6 +276,7 @@ nautilus_canvas_item_set_property (GObject      *object,
     NautilusCanvasItem *item;
     NautilusCanvasItemDetails *details;
     AtkObject *accessible;
+    gboolean is_rename;
 
     item = NAUTILUS_CANVAS_ITEM (object);
     accessible = atk_gobject_accessible_for_object (G_OBJECT (item));
@@ -291,13 +292,15 @@ nautilus_canvas_item_set_property (GObject      *object,
                 return;
             }
 
+            is_rename = details->editable_text != NULL;
             g_free (details->editable_text);
             details->editable_text = g_strdup (g_value_get_string (value));
             if (details->text_util)
             {
                 gail_text_util_text_setup (details->text_util,
                                            details->editable_text);
-                g_object_notify (G_OBJECT (accessible), "accessible-name");
+                if (is_rename)
+                    g_object_notify (G_OBJECT (accessible), "accessible-name");
             }
 
             nautilus_canvas_item_invalidate_label_size (item);


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