diff options
author | Marcin Szalowicz <mszalowicz@mailplus.pl> | 2017-11-23 15:00:26 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2020-10-17 16:58:36 +0100 |
commit | 207865c7b69ff6d1f162c4c0e181a49a1b43af78 (patch) | |
tree | 96838b3f051fe36049713871beb4c93692e9d468 | |
parent | c5d39c3582e504870caeb46399075235793ae1f7 (diff) | |
download | gtk+-ebassi/issue-902.tar.gz |
Fix accessibility handling of child elementsebassi/issue-902
notebook tab can have more than label widget which should be reflected in the accessibility tree
-rw-r--r-- | gtk/a11y/gtknotebookpageaccessible.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/gtk/a11y/gtknotebookpageaccessible.c b/gtk/a11y/gtknotebookpageaccessible.c index 0f57c737b8..be3b3e31d5 100644 --- a/gtk/a11y/gtknotebookpageaccessible.c +++ b/gtk/a11y/gtknotebookpageaccessible.c @@ -115,7 +115,8 @@ gtk_notebook_page_accessible_get_parent (AtkObject *accessible) static gint gtk_notebook_page_accessible_get_n_children (AtkObject *accessible) { - return 1; + /* A tab label widget can either be a GtkLabel or any container widget */ + return 2; } static AtkObject * @@ -123,19 +124,32 @@ gtk_notebook_page_accessible_ref_child (AtkObject *accessible, gint i) { AtkObject *child_obj; - GtkNotebookPageAccessible *page = NULL; + GtkNotebookPageAccessible *page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible); + GtkWidget *label = NULL; + GtkNotebook *notebook = NULL; - if (i != 0) + notebook = GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook)); + if (notebook == NULL) return NULL; - page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible); - if (!page->priv->child) - return NULL; + if (i == 0) + { + /* First will be always the label or the component that contains the label */ + label = gtk_notebook_get_tab_label (notebook, page->priv->child); + child_obj = gtk_widget_get_accessible (label); + return g_object_ref (child_obj); + } + else if (i == 1) + { + page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible); + if (page->priv->child == NULL) + return NULL; - child_obj = gtk_widget_get_accessible (page->priv->child); - g_object_ref (child_obj); + child_obj = gtk_widget_get_accessible (page->priv->child); + return g_object_ref (child_obj); + } - return child_obj; + return NULL; } static AtkStateSet * |