[gtk+/a11y] a11y: Keep the gail notebook in the notebook page



commit d9c8ff091a1567f0314efdb487a80beb2fd2d9c2
Author: Benjamin Otte <otte redhat com>
Date:   Wed Jun 29 16:17:07 2011 +0200

    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.

 gtk/a11y/gailnotebook.c     |    2 +-
 gtk/a11y/gailnotebookpage.c |   23 +++++++++++------------
 gtk/a11y/gailnotebookpage.h |    4 ++--
 3 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/gtk/a11y/gailnotebook.c b/gtk/a11y/gailnotebook.c
index f00283a..dd8a5ca 100644
--- a/gtk/a11y/gailnotebook.c
+++ b/gtk/a11y/gailnotebook.c
@@ -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);
diff --git a/gtk/a11y/gailnotebookpage.c b/gtk/a11y/gailnotebookpage.c
index 6b31280..b323d19 100644
--- a/gtk/a11y/gailnotebookpage.c
+++ b/gtk/a11y/gailnotebookpage.c
@@ -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;
 
diff --git a/gtk/a11y/gailnotebookpage.h b/gtk/a11y/gailnotebookpage.h
index 5f68b5f..9c8aba6 100644
--- a/gtk/a11y/gailnotebookpage.h
+++ b/gtk/a11y/gailnotebookpage.h
@@ -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);
 



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