Commit f59cb0e0 authored by Benjamin Otte's avatar Benjamin Otte Committed by Matthias Clasen
Browse files

a11y: Keep the gail notebook in the notebook page

We used to keep the GtkNotebook, but that causes issues at creation time
of the GailNotebook, when the GtkNotebook does not yet have an
accessible set and so it can't be queried.
parent 790d8e32
......@@ -402,7 +402,7 @@ create_notebook_page_accessible (GailNotebook *gail_notebook,
{
AtkObject *obj;
obj = gail_notebook_page_new (notebook, child);
obj = gail_notebook_page_new (gail_notebook, child);
g_hash_table_insert (gail_notebook->pages,
child,
obj);
......
......@@ -167,20 +167,21 @@ notify_child_added (gpointer data)
}
AtkObject*
gail_notebook_page_new (GtkNotebook *notebook,
GtkWidget *child)
gail_notebook_page_new (GailNotebook *notebook,
GtkWidget *child)
{
GObject *object;
AtkObject *atk_object;
GailNotebookPage *page;
GtkWidget *label;
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL);
g_return_val_if_fail (GAIL_IS_NOTEBOOK (notebook), NULL);
g_return_val_if_fail (GTK_WIDGET (child), NULL);
object = g_object_new (GAIL_TYPE_NOTEBOOK_PAGE, NULL);
page = GAIL_NOTEBOOK_PAGE (object);
page->notebook = notebook;
page->notebook = GTK_ACCESSIBLE (notebook);
page->child = child;
page->textutil = NULL;
......@@ -325,10 +326,7 @@ gail_notebook_page_get_parent (AtkObject *accessible)
page = GAIL_NOTEBOOK_PAGE (accessible);
if (!page->notebook)
return NULL;
return gtk_widget_get_accessible (GTK_WIDGET (page->notebook));
return ATK_OBJECT (page->notebook);
}
static gint
......@@ -352,7 +350,7 @@ gail_notebook_page_ref_child (AtkObject *accessible,
return NULL;
page = GAIL_NOTEBOOK_PAGE (accessible);
if (!page->notebook)
if (!page->child)
return NULL;
child_obj = gtk_widget_get_accessible (page->child);
......@@ -366,10 +364,11 @@ gail_notebook_page_get_index_in_parent (AtkObject *accessible)
GailNotebookPage *page;
page = GAIL_NOTEBOOK_PAGE (accessible);
if (!page->notebook || !page->child)
if (!page->child)
return -1;
return gtk_notebook_page_num (page->notebook, page->child);
return gtk_notebook_page_num (GTK_NOTEBOOK (gtk_accessible_get_widget (page->notebook)),
page->child);
}
static AtkStateSet*
......@@ -778,7 +777,7 @@ get_label_from_notebook_page (GailNotebookPage *page)
GtkWidget *child;
GtkNotebook *notebook;
notebook = page->notebook;
notebook = GTK_NOTEBOOK (gtk_accessible_get_widget (page->notebook));
if (!notebook)
return NULL;
......
......@@ -39,7 +39,7 @@ struct _GailNotebookPage
{
AtkObject parent;
GtkNotebook *notebook;
GtkAccessible *notebook;
GtkWidget *child;
guint notify_child_added_id;
......@@ -54,7 +54,7 @@ struct _GailNotebookPageClass
AtkObjectClass parent_class;
};
AtkObject *gail_notebook_page_new(GtkNotebook *notebook, GtkWidget *child);
AtkObject *gail_notebook_page_new (GailNotebook *notebook, GtkWidget *child);
void gail_notebook_page_invalidate (GailNotebookPage *page);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment