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



commit 8ea8427d6788ec97e6c422bf25bac2418fe1f6e1
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Apr 23 20:25:17 2018 +0200

    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.
    
    (cherry picked from commit 0c80a84576a143d76388499d27f0d6d8e21b54da)

 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 97672001f..d1c781705 100644
--- a/src/nautilus-canvas-item.c
+++ b/src/nautilus-canvas-item.c
@@ -286,6 +286,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));
@@ -301,13 +302,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]