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.
This commit is contained in:
committed by
Matthias Clasen
parent
790d8e324b
commit
f59cb0e05d
@ -402,7 +402,7 @@ create_notebook_page_accessible (GailNotebook *gail_notebook,
|
|||||||
{
|
{
|
||||||
AtkObject *obj;
|
AtkObject *obj;
|
||||||
|
|
||||||
obj = gail_notebook_page_new (notebook, child);
|
obj = gail_notebook_page_new (gail_notebook, child);
|
||||||
g_hash_table_insert (gail_notebook->pages,
|
g_hash_table_insert (gail_notebook->pages,
|
||||||
child,
|
child,
|
||||||
obj);
|
obj);
|
||||||
|
|||||||
@ -167,20 +167,21 @@ notify_child_added (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
AtkObject*
|
AtkObject*
|
||||||
gail_notebook_page_new (GtkNotebook *notebook,
|
gail_notebook_page_new (GailNotebook *notebook,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
GObject *object;
|
GObject *object;
|
||||||
AtkObject *atk_object;
|
AtkObject *atk_object;
|
||||||
GailNotebookPage *page;
|
GailNotebookPage *page;
|
||||||
GtkWidget *label;
|
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);
|
object = g_object_new (GAIL_TYPE_NOTEBOOK_PAGE, NULL);
|
||||||
|
|
||||||
page = GAIL_NOTEBOOK_PAGE (object);
|
page = GAIL_NOTEBOOK_PAGE (object);
|
||||||
page->notebook = notebook;
|
page->notebook = GTK_ACCESSIBLE (notebook);
|
||||||
page->child = child;
|
page->child = child;
|
||||||
page->textutil = NULL;
|
page->textutil = NULL;
|
||||||
|
|
||||||
@ -325,10 +326,7 @@ gail_notebook_page_get_parent (AtkObject *accessible)
|
|||||||
|
|
||||||
page = GAIL_NOTEBOOK_PAGE (accessible);
|
page = GAIL_NOTEBOOK_PAGE (accessible);
|
||||||
|
|
||||||
if (!page->notebook)
|
return ATK_OBJECT (page->notebook);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return gtk_widget_get_accessible (GTK_WIDGET (page->notebook));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@ -352,7 +350,7 @@ gail_notebook_page_ref_child (AtkObject *accessible,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
page = GAIL_NOTEBOOK_PAGE (accessible);
|
page = GAIL_NOTEBOOK_PAGE (accessible);
|
||||||
if (!page->notebook)
|
if (!page->child)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
child_obj = gtk_widget_get_accessible (page->child);
|
child_obj = gtk_widget_get_accessible (page->child);
|
||||||
@ -366,10 +364,11 @@ gail_notebook_page_get_index_in_parent (AtkObject *accessible)
|
|||||||
GailNotebookPage *page;
|
GailNotebookPage *page;
|
||||||
|
|
||||||
page = GAIL_NOTEBOOK_PAGE (accessible);
|
page = GAIL_NOTEBOOK_PAGE (accessible);
|
||||||
if (!page->notebook || !page->child)
|
if (!page->child)
|
||||||
return -1;
|
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*
|
static AtkStateSet*
|
||||||
@ -778,7 +777,7 @@ get_label_from_notebook_page (GailNotebookPage *page)
|
|||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GtkNotebook *notebook;
|
GtkNotebook *notebook;
|
||||||
|
|
||||||
notebook = page->notebook;
|
notebook = GTK_NOTEBOOK (gtk_accessible_get_widget (page->notebook));
|
||||||
if (!notebook)
|
if (!notebook)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ struct _GailNotebookPage
|
|||||||
{
|
{
|
||||||
AtkObject parent;
|
AtkObject parent;
|
||||||
|
|
||||||
GtkNotebook *notebook;
|
GtkAccessible *notebook;
|
||||||
|
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
guint notify_child_added_id;
|
guint notify_child_added_id;
|
||||||
@ -54,7 +54,7 @@ struct _GailNotebookPageClass
|
|||||||
AtkObjectClass parent_class;
|
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);
|
void gail_notebook_page_invalidate (GailNotebookPage *page);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user