[gtk/gtk-4-2: 63/91] a11y: Update the labelled-by relation of GtkTreeExpander




commit ca405f1060cd6a61515d8c0f02eab3c2a368b0ff
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Apr 21 11:43:16 2021 +0100

    a11y: Update the labelled-by relation of GtkTreeExpander
    
    Whenever we change the :child property, we need to update the
    labelled-by relation.

 gtk/gtktreeexpander.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtktreeexpander.c b/gtk/gtktreeexpander.c
index fb23f6433d..4ebc072236 100644
--- a/gtk/gtktreeexpander.c
+++ b/gtk/gtktreeexpander.c
@@ -211,10 +211,6 @@ gtk_tree_expander_update_for_list_row (GtkTreeExpander *self)
                                            -1);
             }
 
-          gtk_accessible_update_relation (GTK_ACCESSIBLE (self),
-                                          GTK_ACCESSIBLE_RELATION_LABELLED_BY, self->child, NULL,
-                                          -1);
-
           child = gtk_widget_get_prev_sibling (self->expander);
         }
       else
@@ -728,6 +724,14 @@ gtk_tree_expander_set_child (GtkTreeExpander *self,
     {
       self->child = child;
       gtk_widget_set_parent (child, GTK_WIDGET (self));
+
+      gtk_accessible_update_relation (GTK_ACCESSIBLE (self),
+                                      GTK_ACCESSIBLE_RELATION_LABELLED_BY, self->child, NULL,
+                                      -1);
+    }
+  else
+    {
+      gtk_accessible_reset_relation (GTK_ACCESSIBLE (self), GTK_ACCESSIBLE_RELATION_LABELLED_BY);
     }
 
   g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CHILD]);


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