[nautilus/wip/corey/a11y: 15/15] listitemwidget hack




commit 1ba08effc3373635cae447586fc2da55499b07bb
Author: António Fernandes <antoniof gnome org>
Date:   Wed Aug 31 00:00:05 2022 +0000

    listitemwidget hack

 src/nautilus-grid-view.c |  4 ++++
 src/nautilus-list-view.c | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)
---
diff --git a/src/nautilus-grid-view.c b/src/nautilus-grid-view.c
index 74a80e1f5..cbeea42de 100644
--- a/src/nautilus-grid-view.c
+++ b/src/nautilus-grid-view.c
@@ -367,6 +367,10 @@ bind_cell (GtkSignalListItemFactory *factory,
         gtk_widget_set_margin_bottom (parent, 3);
         gtk_widget_set_margin_start (parent, 3);
         gtk_widget_set_margin_end (parent, 3);
+
+        gtk_accessible_update_relation (GTK_ACCESSIBLE (parent),
+                                        GTK_ACCESSIBLE_RELATION_LABELLED_BY, cell, NULL,
+                                        -1);
     }
 }
 
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index e2389eac3..4b7a5f2e1 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -945,11 +945,27 @@ bind_name_cell (GtkSignalListItemFactory *factory,
                 GtkListItem              *listitem,
                 gpointer                  user_data)
 {
+    GtkWidget *cell;
     NautilusViewItem *item;
 
+    cell = gtk_list_item_get_child (listitem);
     item = NAUTILUS_VIEW_ITEM (gtk_list_item_get_item (listitem));
 
     nautilus_view_item_set_item_ui (item, gtk_list_item_get_child (listitem));
+
+    if (nautilus_view_cell_once (NAUTILUS_VIEW_CELL (cell)))
+    {
+        GtkWidget *row_widget;
+
+        /* At the time of ::setup emission, the item ui has got no parent yet,
+         * that's why we need to complete the widget setup process here, on the
+         * first time ::bind is emitted. */
+        row_widget = gtk_widget_get_parent (gtk_widget_get_parent (cell));
+
+        gtk_accessible_update_relation (GTK_ACCESSIBLE (row_widget),
+                                        GTK_ACCESSIBLE_RELATION_LABELLED_BY, cell, NULL,
+                                        -1);
+    }
 }
 
 static void


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