[gtk/gtk-4-2: 62/91] a11y: Set state on the GtkTreeExpander widget




commit 4baec1ef22ab0711d198cae7632aeb604728b591
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Apr 21 11:14:28 2021 +0100

    a11y: Set state on the GtkTreeExpander widget
    
    Instead of setting it on its internal child.

 gtk/gtktreeexpander.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtktreeexpander.c b/gtk/gtktreeexpander.c
index 8bad1f5e5b..fb23f6433d 100644
--- a/gtk/gtktreeexpander.c
+++ b/gtk/gtktreeexpander.c
@@ -151,6 +151,8 @@ gtk_tree_expander_update_for_list_row (GtkTreeExpander *self)
           gtk_widget_unparent (child);
         }
       self->expander = NULL;
+
+      gtk_accessible_reset_state (GTK_ACCESSIBLE (self), GTK_ACCESSIBLE_STATE_EXPANDED);
     }
   else
     {
@@ -192,26 +194,27 @@ gtk_tree_expander_update_for_list_row (GtkTreeExpander *self)
               gtk_accessible_update_property (GTK_ACCESSIBLE (self->expander),
                                               GTK_ACCESSIBLE_PROPERTY_LABEL, _("Expand"),
                                               -1);
-              gtk_accessible_update_relation (GTK_ACCESSIBLE (self->expander),
-                                              GTK_ACCESSIBLE_RELATION_LABELLED_BY, self->child, NULL,
-                                              -1);
             }
 
           if (gtk_tree_list_row_get_expanded (self->list_row))
             {
               gtk_widget_set_state_flags (self->expander, GTK_STATE_FLAG_CHECKED, FALSE);
-              gtk_accessible_update_state (GTK_ACCESSIBLE (self->expander),
+              gtk_accessible_update_state (GTK_ACCESSIBLE (self),
                                            GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
                                            -1);
             }
           else
             {
               gtk_widget_unset_state_flags (self->expander, GTK_STATE_FLAG_CHECKED);
-              gtk_accessible_update_state (GTK_ACCESSIBLE (self->expander),
+              gtk_accessible_update_state (GTK_ACCESSIBLE (self),
                                            GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
                                            -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


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