diff options
author | Matthias Clasen <mclasen@redhat.com> | 2011-07-01 23:29:06 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2011-07-05 16:08:57 -0400 |
commit | 89e57c6978822b9ebcd8565d9b271cc520f55766 (patch) | |
tree | 46e66c6f523608fecad3390d5db962f3a63b6c33 | |
parent | 64eec8a97a37e6c94ff1b0c3052b4b5e65440623 (diff) | |
download | gtk+-89e57c6978822b9ebcd8565d9b271cc520f55766.tar.gz |
Convert GailContainer to GtkContainerAccessible
37 files changed, 392 insertions, 449 deletions
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am index 031fb4956a..f960d43853 100644 --- a/gtk/a11y/Makefile.am +++ b/gtk/a11y/Makefile.am @@ -13,7 +13,7 @@ gail_c_sources = \ gtkcheckmenuitemaccessible.c \ gtkchecksubmenuitemaccessible.c \ gtkcomboboxaccessible.c \ - gailcontainer.c \ + gtkcontaineraccessible.c \ gailcontainercell.c \ gtkentryaccessible.c \ gtkexpanderaccessible.c \ @@ -64,8 +64,8 @@ gail_private_h_sources = \ gtkcheckmenuitemaccessible.h \ gtkchecksubmenuitemaccessible.h \ gtkcomboboxaccessible.h \ + gtkcontaineraccessible.h \ gailcontainercell.h \ - gailcontainer.h \ gtkentryaccessible.h \ gtkexpanderaccessible.h \ gailfactory.h \ diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c index 0011064153..fcf09f76f1 100644 --- a/gtk/a11y/gail.c +++ b/gtk/a11y/gail.c @@ -25,7 +25,6 @@ #include <gtk/gtkx.h> #include "gailbooleancell.h" #include "gailcell.h" -#include "gailcontainer.h" #include "gailcontainercell.h" #include "gailimagecell.h" #include "gailrenderercell.h" @@ -79,7 +78,6 @@ static guint focus_tracker_id = 0; static GQuark quark_focus_object = 0; GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WIDGET, GailWidget, gail_widget, GTK_TYPE_WIDGET) -GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_CONTAINER, GailContainer, gail_container, GTK_TYPE_CONTAINER) GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_RENDERER_CELL, GailRendererCell, gail_renderer_cell, GTK_TYPE_CELL_RENDERER, gail_renderer_cell_new) GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_BOOLEAN_CELL, GailBooleanCell, gail_boolean_cell, GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell_new) GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_IMAGE_CELL, GailImageCell, gail_image_cell, GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell_new) @@ -825,7 +823,6 @@ gail_accessibility_module_init (void) fprintf (stderr, "GTK Accessibility Module initialized\n"); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_WIDGET, gail_widget); - GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CONTAINER, gail_container); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TEXT, gail_text_cell); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell); diff --git a/gtk/a11y/gailcontainer.c b/gtk/a11y/gailcontainer.c deleted file mode 100644 index 81e0c0504b..0000000000 --- a/gtk/a11y/gailcontainer.c +++ /dev/null @@ -1,244 +0,0 @@ -/* GAIL - The GNOME Accessibility Implementation Library - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gailcontainer.h" - -static void gail_container_class_init (GailContainerClass *klass); -static void gail_container_init (GailContainer *container); - -static gint gail_container_get_n_children (AtkObject *obj); -static AtkObject* gail_container_ref_child (AtkObject *obj, - gint i); -static gint gail_container_add_gtk (GtkContainer *container, - GtkWidget *widget, - gpointer data); -static gint gail_container_remove_gtk (GtkContainer *container, - GtkWidget *widget, - gpointer data); -static gint gail_container_real_add_gtk (GtkContainer *container, - GtkWidget *widget, - gpointer data); -static gint gail_container_real_remove_gtk (GtkContainer *container, - GtkWidget *widget, - gpointer data); - -static void gail_container_real_initialize (AtkObject *obj, - gpointer data); - -static void gail_container_finalize (GObject *object); - -G_DEFINE_TYPE (GailContainer, gail_container, GAIL_TYPE_WIDGET) - -static void -gail_container_class_init (GailContainerClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - gobject_class->finalize = gail_container_finalize; - - class->get_n_children = gail_container_get_n_children; - class->ref_child = gail_container_ref_child; - class->initialize = gail_container_real_initialize; - - klass->add_gtk = gail_container_real_add_gtk; - klass->remove_gtk = gail_container_real_remove_gtk; -} - -static void -gail_container_init (GailContainer *container) -{ - container->children = NULL; -} - -static gint -gail_container_get_n_children (AtkObject* obj) -{ - GtkWidget *widget; - GList *children; - gint count = 0; - - g_return_val_if_fail (GAIL_IS_CONTAINER (obj), count); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return 0; - - children = gtk_container_get_children (GTK_CONTAINER(widget)); - count = g_list_length (children); - g_list_free (children); - - return count; -} - -static AtkObject* -gail_container_ref_child (AtkObject *obj, - gint i) -{ - GList *children, *tmp_list; - AtkObject *accessible; - GtkWidget *widget; - - g_return_val_if_fail (GAIL_IS_CONTAINER (obj), NULL); - g_return_val_if_fail ((i >= 0), NULL); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - children = gtk_container_get_children (GTK_CONTAINER (widget)); - tmp_list = g_list_nth (children, i); - if (!tmp_list) - { - g_list_free (children); - return NULL; - } - accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data)); - - g_list_free (children); - g_object_ref (accessible); - return accessible; -} - -static gint -gail_container_add_gtk (GtkContainer *container, - GtkWidget *widget, - gpointer data) -{ - GailContainer *gail_container = GAIL_CONTAINER (data); - GailContainerClass *klass; - - klass = GAIL_CONTAINER_GET_CLASS (gail_container); - - if (klass->add_gtk) - return klass->add_gtk (container, widget, data); - else - return 1; -} - -static gint -gail_container_remove_gtk (GtkContainer *container, - GtkWidget *widget, - gpointer data) -{ - GailContainer *gail_container = GAIL_CONTAINER (data); - GailContainerClass *klass; - - klass = GAIL_CONTAINER_GET_CLASS (gail_container); - - if (klass->remove_gtk) - return klass->remove_gtk (container, widget, data); - else - return 1; -} - -static gint -gail_container_real_add_gtk (GtkContainer *container, - GtkWidget *widget, - gpointer data) -{ - AtkObject* atk_parent = ATK_OBJECT (data); - AtkObject* atk_child = gtk_widget_get_accessible (widget); - GailContainer *gail_container = GAIL_CONTAINER (atk_parent); - gint index; - - g_object_notify (G_OBJECT (atk_child), "accessible_parent"); - - g_list_free (gail_container->children); - gail_container->children = gtk_container_get_children (container); - index = g_list_index (gail_container->children, widget); - g_signal_emit_by_name (atk_parent, "children_changed::add", - index, atk_child, NULL); - - return 1; -} - -static gint -gail_container_real_remove_gtk (GtkContainer *container, - GtkWidget *widget, - gpointer data) -{ - AtkPropertyValues values = { NULL }; - AtkObject* atk_parent; - AtkObject *atk_child; - GailContainer *gail_container; - gint index; - - atk_parent = ATK_OBJECT (data); - atk_child = gtk_widget_get_accessible (widget); - - if (atk_child) - { - g_value_init (&values.old_value, G_TYPE_POINTER); - g_value_set_pointer (&values.old_value, atk_parent); - - values.property_name = "accessible-parent"; - - g_object_ref (atk_child); - g_signal_emit_by_name (atk_child, - "property_change::accessible-parent", &values, NULL); - g_object_unref (atk_child); - } - gail_container = GAIL_CONTAINER (atk_parent); - index = g_list_index (gail_container->children, widget); - g_list_free (gail_container->children); - gail_container->children = gtk_container_get_children (container); - if (index >= 0 && index <= g_list_length (gail_container->children)) - g_signal_emit_by_name (atk_parent, "children_changed::remove", - index, atk_child, NULL); - - return 1; -} - -static void -gail_container_real_initialize (AtkObject *obj, - gpointer data) -{ - GailContainer *container = GAIL_CONTAINER (obj); - - ATK_OBJECT_CLASS (gail_container_parent_class)->initialize (obj, data); - - container->children = gtk_container_get_children (GTK_CONTAINER (data)); - - g_signal_connect (data, "add", - G_CALLBACK (gail_container_add_gtk), - obj); - g_signal_connect (data, "remove", - G_CALLBACK (gail_container_remove_gtk), - obj); - - if (GTK_IS_TOOLBAR (data)) - obj->role = ATK_ROLE_TOOL_BAR; - else if (GTK_IS_VIEWPORT (data)) - obj->role = ATK_ROLE_VIEWPORT; - else - obj->role = ATK_ROLE_PANEL; -} - -static void -gail_container_finalize (GObject *object) -{ - GailContainer *container = GAIL_CONTAINER (object); - - g_list_free (container->children); - G_OBJECT_CLASS (gail_container_parent_class)->finalize (object); -} diff --git a/gtk/a11y/gailcontainer.h b/gtk/a11y/gailcontainer.h deleted file mode 100644 index d5094f6e64..0000000000 --- a/gtk/a11y/gailcontainer.h +++ /dev/null @@ -1,60 +0,0 @@ -/* GAIL - The GNOME Accessibility Implementation Library - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GAIL_CONTAINER_H__ -#define __GAIL_CONTAINER_H__ - -#include "gailwidget.h" - -G_BEGIN_DECLS - -#define GAIL_TYPE_CONTAINER (gail_container_get_type ()) -#define GAIL_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CONTAINER, GailContainer)) -#define GAIL_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CONTAINER, GailContainerClass)) -#define GAIL_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CONTAINER)) -#define GAIL_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CONTAINER)) -#define GAIL_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CONTAINER, GailContainerClass)) - -typedef struct _GailContainer GailContainer; -typedef struct _GailContainerClass GailContainerClass; - -struct _GailContainer -{ - GailWidget parent; - - GList *children; -}; - -GType gail_container_get_type (void); - -struct _GailContainerClass -{ - GailWidgetClass parent_class; - - gint (*add_gtk) (GtkContainer *container, - GtkWidget *widget, - gpointer data); - gint (*remove_gtk) (GtkContainer *container, - GtkWidget *widget, - gpointer data); -}; - -G_END_DECLS - -#endif /* __GAIL_CONTAINER_H__ */ diff --git a/gtk/a11y/gtkboxaccessible.c b/gtk/a11y/gtkboxaccessible.c index 53526195fb..94aae411c0 100644 --- a/gtk/a11y/gtkboxaccessible.c +++ b/gtk/a11y/gtkboxaccessible.c @@ -22,7 +22,8 @@ #include <gtk/gtk.h> #include "gtkboxaccessible.h" -G_DEFINE_TYPE (GtkBoxAccessible, gtk_box_accessible, GAIL_TYPE_CONTAINER) + +G_DEFINE_TYPE (GtkBoxAccessible, gtk_box_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE) static void gtk_box_accessible_initialize (AtkObject *accessible, diff --git a/gtk/a11y/gtkboxaccessible.h b/gtk/a11y/gtkboxaccessible.h index 79598f52ee..ad0e7d4065 100644 --- a/gtk/a11y/gtkboxaccessible.h +++ b/gtk/a11y/gtkboxaccessible.h @@ -20,28 +20,28 @@ #ifndef __GTK_BOX_ACCESSIBLE_H__ #define __GTK_BOX_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS -#define GTK_TYPE_BOX_ACCESSIBLE (gtk_box_accessible_get_type ()) -#define GTK_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BOX_ACCESSIBLE, GtkBoxAccessible)) -#define GTK_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_BOX_ACCESSIBLE, GtkBoxAccessibleClass)) -#define GTK_IS_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BOX_ACCESSIBLE)) -#define GTK_IS_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOX_ACCESSIBLE)) -#define GTK_BOX_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BOX_ACCESSIBLE, GtkBoxAccessibleClass)) +#define GTK_TYPE_BOX_ACCESSIBLE (gtk_box_accessible_get_type ()) +#define GTK_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BOX_ACCESSIBLE, GtkBoxAccessible)) +#define GTK_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_BOX_ACCESSIBLE, GtkBoxAccessibleClass)) +#define GTK_IS_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BOX_ACCESSIBLE)) +#define GTK_IS_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOX_ACCESSIBLE)) +#define GTK_BOX_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BOX_ACCESSIBLE, GtkBoxAccessibleClass)) typedef struct _GtkBoxAccessible GtkBoxAccessible; typedef struct _GtkBoxAccessibleClass GtkBoxAccessibleClass; struct _GtkBoxAccessible { - GailContainer parent; + GtkContainerAccessible parent; }; struct _GtkBoxAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_box_accessible_get_type (void); diff --git a/gtk/a11y/gtkbuttonaccessible.c b/gtk/a11y/gtkbuttonaccessible.c index 64b6d251a3..1be1137d16 100644 --- a/gtk/a11y/gtkbuttonaccessible.c +++ b/gtk/a11y/gtkbuttonaccessible.c @@ -28,7 +28,7 @@ static void atk_action_interface_init (AtkActionIface *iface); static void atk_image_interface_init (AtkImageIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkButtonAccessible, gtk_button_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkButtonAccessible, gtk_button_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init) G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init)) @@ -226,7 +226,7 @@ static void gtk_button_accessible_class_init (GtkButtonAccessibleClass *klass) { AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - GailContainerClass *container_class = (GailContainerClass*)klass; + GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass; GailWidgetClass *widget_class = (GailWidgetClass*)klass; class->get_name = gtk_button_accessible_get_name; diff --git a/gtk/a11y/gtkbuttonaccessible.h b/gtk/a11y/gtkbuttonaccessible.h index 66986da94e..8142028b7d 100644 --- a/gtk/a11y/gtkbuttonaccessible.h +++ b/gtk/a11y/gtkbuttonaccessible.h @@ -20,8 +20,7 @@ #ifndef __GTK_BUTTON_ACCESSIBLE_H__ #define __GTK_BUTTON_ACCESSIBLE_H__ -#include "gailcontainer.h" -#include "gailtextutil.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -37,12 +36,12 @@ typedef struct _GtkButtonAccessibleClass GtkButtonAccessibleClass; struct _GtkButtonAccessible { - GailContainer parent; + GtkContainerAccessible parent; }; struct _GtkButtonAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_button_accessible_get_type (void); diff --git a/gtk/a11y/gtkcomboboxaccessible.c b/gtk/a11y/gtkcomboboxaccessible.c index 0e3c3f7674..58f8763630 100644 --- a/gtk/a11y/gtkcomboboxaccessible.c +++ b/gtk/a11y/gtkcomboboxaccessible.c @@ -26,7 +26,7 @@ static void atk_action_interface_init (AtkActionIface *iface); static void atk_selection_interface_init (AtkSelectionIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkComboBoxAccessible, gtk_combo_box_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkComboBoxAccessible, gtk_combo_box_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init) G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)) diff --git a/gtk/a11y/gtkcomboboxaccessible.h b/gtk/a11y/gtkcomboboxaccessible.h index d4228057c0..bb1142d5a5 100644 --- a/gtk/a11y/gtkcomboboxaccessible.h +++ b/gtk/a11y/gtkcomboboxaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_COMBO_BOX_ACCESSIBLE_H__ #define __GTK_COMBO_BOX_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -36,7 +36,7 @@ typedef struct _GtkComboBoxAccessibleClass GtkComboBoxAccessibleClass; struct _GtkComboBoxAccessible { - GailContainer parent; + GtkContainerAccessible parent; gchar *name; gint old_selection; @@ -45,7 +45,7 @@ struct _GtkComboBoxAccessible struct _GtkComboBoxAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_combo_box_accessible_get_type (void); diff --git a/gtk/a11y/gtkcontaineraccessible.c b/gtk/a11y/gtkcontaineraccessible.c new file mode 100644 index 0000000000..ad475a4187 --- /dev/null +++ b/gtk/a11y/gtkcontaineraccessible.c @@ -0,0 +1,202 @@ +/* GAIL - The GNOME Accessibility Implementation Library + * Copyright 2001, 2002, 2003 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include <gtk/gtk.h> +#include "gtkcontaineraccessible.h" + + +G_DEFINE_TYPE (GtkContainerAccessible, gtk_container_accessible, GAIL_TYPE_WIDGET) + +static void +gtk_container_accessible_init (GtkContainerAccessible *container) +{ +} + +static gint +gtk_container_accessible_get_n_children (AtkObject* obj) +{ + GtkWidget *widget; + GList *children; + gint count = 0; + + widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); + if (widget == NULL) + return 0; + + children = gtk_container_get_children (GTK_CONTAINER(widget)); + count = g_list_length (children); + g_list_free (children); + + return count; +} + +static AtkObject * +gtk_container_accessible_ref_child (AtkObject *obj, + gint i) +{ + GList *children, *tmp_list; + AtkObject *accessible; + GtkWidget *widget; + + widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); + if (widget == NULL) + return NULL; + + children = gtk_container_get_children (GTK_CONTAINER (widget)); + tmp_list = g_list_nth (children, i); + if (!tmp_list) + { + g_list_free (children); + return NULL; + } + accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data)); + + g_list_free (children); + g_object_ref (accessible); + + return accessible; +} + +static gint +gtk_container_accessible_add_gtk (GtkContainer *container, + GtkWidget *widget, + gpointer data) +{ + GtkContainerAccessible *accessible = GTK_CONTAINER_ACCESSIBLE (data); + GtkContainerAccessibleClass *klass; + + klass = GTK_CONTAINER_ACCESSIBLE_GET_CLASS (accessible); + + if (klass->add_gtk) + return klass->add_gtk (container, widget, data); + else + return 1; +} + +static gint +gtk_container_accessible_remove_gtk (GtkContainer *container, + GtkWidget *widget, + gpointer data) +{ + GtkContainerAccessible *accessible = GTK_CONTAINER_ACCESSIBLE (data); + GtkContainerAccessibleClass *klass; + + klass = GTK_CONTAINER_ACCESSIBLE_GET_CLASS (accessible); + + if (klass->remove_gtk) + return klass->remove_gtk (container, widget, data); + else + return 1; +} + +static gint +gtk_container_accessible_real_add_gtk (GtkContainer *container, + GtkWidget *widget, + gpointer data) +{ + AtkObject *atk_parent; + AtkObject *atk_child; + GtkContainerAccessible *accessible; + gint index; + + atk_parent = ATK_OBJECT (data); + atk_child = gtk_widget_get_accessible (widget); + accessible = GTK_CONTAINER_ACCESSIBLE (atk_parent); + + g_object_notify (G_OBJECT (atk_child), "accessible_parent"); + g_list_free (accessible->children); + accessible->children = gtk_container_get_children (container); + index = g_list_index (accessible->children, widget); + g_signal_emit_by_name (atk_parent, "children_changed::add", index, atk_child, NULL); + + return 1; +} + +static gint +gtk_container_accessible_real_remove_gtk (GtkContainer *container, + GtkWidget *widget, + gpointer data) +{ + AtkObject* atk_parent; + AtkObject *atk_child; + GtkContainerAccessible *accessible; + gint index; + + atk_parent = ATK_OBJECT (data); + atk_child = gtk_widget_get_accessible (widget); + accessible = GTK_CONTAINER_ACCESSIBLE (atk_parent); + + g_object_notify (G_OBJECT (atk_child), "accessible_parent"); + index = g_list_index (accessible->children, widget); + g_list_free (accessible->children); + accessible->children = gtk_container_get_children (container); + if (index >= 0 && index <= g_list_length (accessible->children)) + g_signal_emit_by_name (atk_parent, "children_changed::remove", index, atk_child, NULL); + + return 1; +} + +static void +gtk_container_accessible_real_initialize (AtkObject *obj, + gpointer data) +{ + GtkContainerAccessible *accessible = GTK_CONTAINER_ACCESSIBLE (obj); + + ATK_OBJECT_CLASS (gtk_container_accessible_parent_class)->initialize (obj, data); + + accessible->children = gtk_container_get_children (GTK_CONTAINER (data)); + + g_signal_connect (data, "add", G_CALLBACK (gtk_container_accessible_add_gtk), obj); + g_signal_connect (data, "remove", G_CALLBACK (gtk_container_accessible_remove_gtk), obj); + + if (GTK_IS_TOOLBAR (data)) + obj->role = ATK_ROLE_TOOL_BAR; + else if (GTK_IS_VIEWPORT (data)) + obj->role = ATK_ROLE_VIEWPORT; + else + obj->role = ATK_ROLE_PANEL; +} + +static void +gtk_container_accessible_finalize (GObject *object) +{ + GtkContainerAccessible *accessible = GTK_CONTAINER_ACCESSIBLE (object); + + g_list_free (accessible->children); + + G_OBJECT_CLASS (gtk_container_accessible_parent_class)->finalize (object); +} + +static void +gtk_container_accessible_class_init (GtkContainerAccessibleClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + AtkObjectClass *class = ATK_OBJECT_CLASS (klass); + + gobject_class->finalize = gtk_container_accessible_finalize; + + class->get_n_children = gtk_container_accessible_get_n_children; + class->ref_child = gtk_container_accessible_ref_child; + class->initialize = gtk_container_accessible_real_initialize; + + klass->add_gtk = gtk_container_accessible_real_add_gtk; + klass->remove_gtk = gtk_container_accessible_real_remove_gtk; +} diff --git a/gtk/a11y/gtkcontaineraccessible.h b/gtk/a11y/gtkcontaineraccessible.h new file mode 100644 index 0000000000..1e60c6d9e4 --- /dev/null +++ b/gtk/a11y/gtkcontaineraccessible.h @@ -0,0 +1,60 @@ +/* GAIL - The GNOME Accessibility Implementation Library + * Copyright 2001, 2002, 2003 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GTK_CONTAINER_ACCESSIBLE_H__ +#define __GTK_CONTAINER_ACCESSIBLE_H__ + +#include "gailwidget.h" + +G_BEGIN_DECLS + +#define GTK_TYPE_CONTAINER_ACCESSIBLE (gtk_container_accessible_get_type ()) +#define GTK_CONTAINER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER_ACCESSIBLE, GtkContainerAccessible)) +#define GTK_CONTAINER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER_ACCESSIBLE, GtkContainerAccessibleClass)) +#define GTK_IS_CONTAINER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER_ACCESSIBLE)) +#define GTK_IS_CONTAINER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER_ACCESSIBLE)) +#define GTK_CONTAINER_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER_ACCESSIBLE, GtkContainerAccessibleClass)) + +typedef struct _GtkContainerAccessible GtkContainerAccessible; +typedef struct _GtkContainerAccessibleClass GtkContainerAccessibleClass; + +struct _GtkContainerAccessible +{ + GailWidget parent; + + GList *children; +}; + +struct _GtkContainerAccessibleClass +{ + GailWidgetClass parent_class; + + gint (*add_gtk) (GtkContainer *container, + GtkWidget *widget, + gpointer data); + gint (*remove_gtk) (GtkContainer *container, + GtkWidget *widget, + gpointer data); +}; + +GType gtk_container_accessible_get_type (void); + +G_END_DECLS + +#endif /* __GTK_CONTAINER_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkexpanderaccessible.c b/gtk/a11y/gtkexpanderaccessible.c index 3ad5bd281d..10510f14cf 100644 --- a/gtk/a11y/gtkexpanderaccessible.c +++ b/gtk/a11y/gtkexpanderaccessible.c @@ -25,7 +25,7 @@ static void atk_action_interface_init (AtkActionIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkExpanderAccessible, gtk_expander_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkExpanderAccessible, gtk_expander_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) static const gchar * diff --git a/gtk/a11y/gtkexpanderaccessible.h b/gtk/a11y/gtkexpanderaccessible.h index 986a9b3895..27e2433c21 100644 --- a/gtk/a11y/gtkexpanderaccessible.h +++ b/gtk/a11y/gtkexpanderaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_EXPANDER_ACCESSIBLE_H__ #define __GTK_EXPANDER_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -36,12 +36,12 @@ typedef struct _GtkExpanderAccessibleClass GtkExpanderAccessibleClass; struct _GtkExpanderAccessible { - GailContainer parent; + GtkContainerAccessible parent; }; struct _GtkExpanderAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_expander_accessible_get_type (void); diff --git a/gtk/a11y/gtkframeaccessible.c b/gtk/a11y/gtkframeaccessible.c index 964ddb99dc..03d4f271b8 100644 --- a/gtk/a11y/gtkframeaccessible.c +++ b/gtk/a11y/gtkframeaccessible.c @@ -24,7 +24,7 @@ #include "gtkframeaccessible.h" -G_DEFINE_TYPE (GtkFrameAccessible, gtk_frame_accessible, GAIL_TYPE_CONTAINER) +G_DEFINE_TYPE (GtkFrameAccessible, gtk_frame_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE) static void gtk_frame_accessible_initialize (AtkObject *accessible, diff --git a/gtk/a11y/gtkframeaccessible.h b/gtk/a11y/gtkframeaccessible.h index 02e638eed2..78df07268c 100644 --- a/gtk/a11y/gtkframeaccessible.h +++ b/gtk/a11y/gtkframeaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_FRAME_ACCESSIBLE_H__ #define __GTK_FRAME_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -36,12 +36,12 @@ typedef struct _GtkFrameAccessibleClass GtkFrameAccessibleClass; struct _GtkFrameAccessible { - GailContainer parent; + GtkContainerAccessible parent; }; struct _GtkFrameAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_frame_accessible_get_type (void); diff --git a/gtk/a11y/gtkmenuitemaccessible.c b/gtk/a11y/gtkmenuitemaccessible.c index 3f8d908f8b..e0eb01a6f7 100644 --- a/gtk/a11y/gtkmenuitemaccessible.c +++ b/gtk/a11y/gtkmenuitemaccessible.c @@ -33,7 +33,7 @@ static gchar *get_text_from_label_widget (GtkWidget *widget); static void atk_action_interface_init (AtkActionIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkMenuItemAccessible, gtk_menu_item_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkMenuItemAccessible, gtk_menu_item_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) static void diff --git a/gtk/a11y/gtkmenuitemaccessible.h b/gtk/a11y/gtkmenuitemaccessible.h index 88470da1cc..2c13048280 100644 --- a/gtk/a11y/gtkmenuitemaccessible.h +++ b/gtk/a11y/gtkmenuitemaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_MENU_ITEM_ACCESSIBLE_H__ #define __GTK_MENU_ITEM_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -36,14 +36,14 @@ typedef struct _GtkMenuItemAccessibleClass GtkMenuItemAccessibleClass; struct _GtkMenuItemAccessible { - GailContainer parent; + GtkContainerAccessible parent; gchar *text; }; struct _GtkMenuItemAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_menu_item_accessible_get_type (void); diff --git a/gtk/a11y/gtkmenushellaccessible.c b/gtk/a11y/gtkmenushellaccessible.c index 1381523924..ba11ddce08 100644 --- a/gtk/a11y/gtkmenushellaccessible.c +++ b/gtk/a11y/gtkmenushellaccessible.c @@ -25,7 +25,7 @@ static void atk_selection_interface_init (AtkSelectionIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkMenuShellAccessible, gtk_menu_shell_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkMenuShellAccessible, gtk_menu_shell_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)) static void diff --git a/gtk/a11y/gtkmenushellaccessible.h b/gtk/a11y/gtkmenushellaccessible.h index 265b74eccb..b5392e9604 100644 --- a/gtk/a11y/gtkmenushellaccessible.h +++ b/gtk/a11y/gtkmenushellaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_MENU_SHELL_ACCESSIBLE_H__ #define __GTK_MENU_SHELL_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -36,12 +36,12 @@ typedef struct _GtkMenuShellAccessibleClass GtkMenuShellAccessibleClass; struct _GtkMenuShellAccessible { - GailContainer parent; + GtkContainerAccessible parent; }; struct _GtkMenuShellAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_menu_shell_accessible_get_type (void); diff --git a/gtk/a11y/gtknotebookaccessible.c b/gtk/a11y/gtknotebookaccessible.c index 6a3eae7130..0668e007f3 100644 --- a/gtk/a11y/gtknotebookaccessible.c +++ b/gtk/a11y/gtknotebookaccessible.c @@ -27,7 +27,7 @@ static void atk_selection_interface_init (AtkSelectionIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkNotebookAccessible, gtk_notebook_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkNotebookAccessible, gtk_notebook_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)) static gboolean @@ -310,7 +310,7 @@ gtk_notebook_accessible_class_init (GtkNotebookAccessibleClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); AtkObjectClass *class = ATK_OBJECT_CLASS (klass); GailWidgetClass *widget_class = (GailWidgetClass*)klass; - GailContainerClass *container_class = (GailContainerClass*)klass; + GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass; gobject_class->finalize = gtk_notebook_accessible_finalize; diff --git a/gtk/a11y/gtknotebookaccessible.h b/gtk/a11y/gtknotebookaccessible.h index 770c12b070..1164bb7749 100644 --- a/gtk/a11y/gtknotebookaccessible.h +++ b/gtk/a11y/gtknotebookaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_NOTEBOOK_ACCESSIBLE_H__ #define __GTK_NOTEBOOK_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -36,7 +36,7 @@ typedef struct _GtkNotebookAccessibleClass GtkNotebookAccessibleClass; struct _GtkNotebookAccessible { - GailContainer parent; + GtkContainerAccessible parent; /* * page_cache maintains a list of pre-ref'd Notebook Pages. @@ -52,7 +52,7 @@ struct _GtkNotebookAccessible struct _GtkNotebookAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_notebook_accessible_get_type (void); diff --git a/gtk/a11y/gtkpanedaccessible.c b/gtk/a11y/gtkpanedaccessible.c index 939087021c..40704fd441 100644 --- a/gtk/a11y/gtkpanedaccessible.c +++ b/gtk/a11y/gtkpanedaccessible.c @@ -25,7 +25,7 @@ static void atk_value_interface_init (AtkValueIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkPanedAccessible, gtk_paned_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkPanedAccessible, gtk_paned_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)) static void diff --git a/gtk/a11y/gtkpanedaccessible.h b/gtk/a11y/gtkpanedaccessible.h index e255ec2e19..5b73e3e67b 100644 --- a/gtk/a11y/gtkpanedaccessible.h +++ b/gtk/a11y/gtkpanedaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_PANED_ACCESSIBLE_H__ #define __GTK_PANED_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -36,12 +36,12 @@ typedef struct _GtkPanedAccessibleClass GtkPanedAccessibleClass; struct _GtkPanedAccessible { - GailContainer parent; + GtkContainerAccessible parent; }; struct _GtkPanedAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_paned_accessible_get_type (void); diff --git a/gtk/a11y/gtkscrolledwindowaccessible.c b/gtk/a11y/gtkscrolledwindowaccessible.c index 7cd4ab640c..d094909cec 100644 --- a/gtk/a11y/gtkscrolledwindowaccessible.c +++ b/gtk/a11y/gtkscrolledwindowaccessible.c @@ -24,7 +24,7 @@ #include "gtkscrolledwindowaccessible.h" -G_DEFINE_TYPE (GtkScrolledWindowAccessible, gtk_scrolled_window_accessible, GAIL_TYPE_CONTAINER) +G_DEFINE_TYPE (GtkScrolledWindowAccessible, gtk_scrolled_window_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE) static void visibility_changed (GObject *object, diff --git a/gtk/a11y/gtkscrolledwindowaccessible.h b/gtk/a11y/gtkscrolledwindowaccessible.h index c3f1ac573d..139c99d83c 100644 --- a/gtk/a11y/gtkscrolledwindowaccessible.h +++ b/gtk/a11y/gtkscrolledwindowaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_SCROLLED_WINDOW_ACCESSIBLE_H__ #define __GTK_SCROLLED_WINDOW_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -36,12 +36,12 @@ typedef struct _GtkScrolledWindowAccessibleClass GtkScrolledWindowAccessibleClas struct _GtkScrolledWindowAccessible { - GailContainer parent; + GtkContainerAccessible parent; }; struct _GtkScrolledWindowAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_scrolled_window_accessible_get_type (void); diff --git a/gtk/a11y/gtkstatusbaraccessible.c b/gtk/a11y/gtkstatusbaraccessible.c index 404b1fa827..4d92c0d64b 100644 --- a/gtk/a11y/gtkstatusbaraccessible.c +++ b/gtk/a11y/gtkstatusbaraccessible.c @@ -130,7 +130,7 @@ static void gtk_statusbar_accessible_class_init (GtkStatusbarAccessibleClass *klass) { AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - GailContainerClass *container_class = (GailContainerClass*)klass; + GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass; class->get_name = gtk_statusbar_accessible_get_name; class->get_n_children = gtk_statusbar_accessible_get_n_children; diff --git a/gtk/a11y/gtksubmenuitemaccessible.c b/gtk/a11y/gtksubmenuitemaccessible.c index cf879eb8c0..f9a0453a01 100644 --- a/gtk/a11y/gtksubmenuitemaccessible.c +++ b/gtk/a11y/gtksubmenuitemaccessible.c @@ -242,7 +242,7 @@ menu_item_add_gtk (GtkContainer *container, GtkWidget *parent_widget; AtkObject *atk_parent; AtkObject *atk_child; - GailContainer *gail_container; + GtkContainerAccessible *container_accessible; gint index; g_return_val_if_fail (GTK_IS_MENU (container), 1); @@ -254,10 +254,10 @@ menu_item_add_gtk (GtkContainer *container, atk_child = gtk_widget_get_accessible (widget); g_object_notify (G_OBJECT (atk_child), "accessible-parent"); - gail_container = GAIL_CONTAINER (atk_parent); - g_list_free (gail_container->children); - gail_container->children = gtk_container_get_children (container); - index = g_list_index (gail_container->children, widget); + container_accessible = GTK_CONTAINER_ACCESSIBLE (atk_parent); + g_list_free (container_accessible->children); + container_accessible->children = gtk_container_get_children (container); + index = g_list_index (container_accessible->children, widget); g_signal_emit_by_name (atk_parent, "children_changed::add", index, atk_child, NULL); } @@ -271,7 +271,7 @@ menu_item_remove_gtk (GtkContainer *container, GtkWidget *parent_widget; AtkObject *atk_parent; AtkObject *atk_child; - GailContainer *gail_container; + GtkContainerAccessible *container_accessible; gint index; gint list_length; @@ -285,11 +285,11 @@ menu_item_remove_gtk (GtkContainer *container, g_object_notify (G_OBJECT (atk_child), "accessible-parent"); - gail_container = GAIL_CONTAINER (atk_parent); - index = g_list_index (gail_container->children, widget); - list_length = g_list_length (gail_container->children); - g_list_free (gail_container->children); - gail_container->children = gtk_container_get_children (container); + container_accessible = GTK_CONTAINER_ACCESSIBLE (atk_parent); + index = g_list_index (container_accessible->children, widget); + list_length = g_list_length (container_accessible->children); + g_list_free (container_accessible->children); + container_accessible->children = gtk_container_get_children (container); if (index >= 0 && index <= list_length) g_signal_emit_by_name (atk_parent, "children_changed::remove", index, atk_child, NULL); diff --git a/gtk/a11y/gtktextviewaccessible.c b/gtk/a11y/gtktextviewaccessible.c index 7789fcdda9..f98021b7fe 100644 --- a/gtk/a11y/gtktextviewaccessible.c +++ b/gtk/a11y/gtktextviewaccessible.c @@ -53,7 +53,7 @@ static void atk_editable_text_interface_init (AtkEditableTextIface *if static void atk_text_interface_init (AtkTextIface *iface); static void atk_streamable_content_interface_init (AtkStreamableContentIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkTextViewAccessible, gtk_text_view_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkTextViewAccessible, gtk_text_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init) G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init) G_IMPLEMENT_INTERFACE (ATK_TYPE_STREAMABLE_CONTENT, atk_streamable_content_interface_init)) diff --git a/gtk/a11y/gtktextviewaccessible.h b/gtk/a11y/gtktextviewaccessible.h index 9e0dd60735..3f69fad3d8 100644 --- a/gtk/a11y/gtktextviewaccessible.h +++ b/gtk/a11y/gtktextviewaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_TEXT_VIEW_ACCESSIBLE_H__ #define __GTK_TEXT_VIEW_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -31,12 +31,12 @@ G_BEGIN_DECLS #define GTK_IS_TEXT_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_VIEW_ACCESSIBLE)) #define GTK_TEXT_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_VIEW_ACCESSIBLE, GtkTextViewAccessibleClass)) -typedef struct _GtkTextViewAccessible GtkTextViewAccessible; -typedef struct _GtkTextViewAccessibleClass GtkTextViewAccessibleClass; +typedef struct _GtkTextViewAccessible GtkTextViewAccessible; +typedef struct _GtkTextViewAccessibleClass GtkTextViewAccessibleClass; struct _GtkTextViewAccessible { - GailContainer parent; + GtkContainerAccessible parent; gint previous_insert_offset; gint previous_selection_bound; @@ -52,7 +52,7 @@ struct _GtkTextViewAccessible struct _GtkTextViewAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_text_view_accessible_get_type (void); diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c index 09e3e5702e..86ef72e45b 100644 --- a/gtk/a11y/gtktreeviewaccessible.c +++ b/gtk/a11y/gtktreeviewaccessible.c @@ -160,7 +160,7 @@ static void atk_selection_interface_init (AtkSelectionIface *iface); static void atk_component_interface_init (AtkComponentIface *iface); static void gail_cell_parent_interface_init (GailCellParentIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkTreeViewAccessible, gtk_tree_view_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkTreeViewAccessible, gtk_tree_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE, atk_table_interface_init) G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init) G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init) @@ -724,11 +724,11 @@ gtk_tree_view_accessible_class_init (GtkTreeViewAccessibleClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkAccessibleClass *accessible_class; GailWidgetClass *widget_class; - GailContainerClass *container_class; + GtkContainerAccessibleClass *container_class; accessible_class = (GtkAccessibleClass*)klass; widget_class = (GailWidgetClass*)klass; - container_class = (GailContainerClass*)klass; + container_class = (GtkContainerAccessibleClass*)klass; class->get_n_children = gtk_tree_view_accessible_get_n_children; class->ref_child = gtk_tree_view_accessible_ref_child; diff --git a/gtk/a11y/gtktreeviewaccessible.h b/gtk/a11y/gtktreeviewaccessible.h index 698a83bc28..64d9d6e241 100644 --- a/gtk/a11y/gtktreeviewaccessible.h +++ b/gtk/a11y/gtktreeviewaccessible.h @@ -21,7 +21,7 @@ #define __GTK_TREE_VIEW_ACCESSIBLE_H__ #include <gtk/gtk.h> -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" #include "gailcell.h" G_BEGIN_DECLS @@ -38,7 +38,7 @@ typedef struct _GtkTreeViewAccessibleClass GtkTreeViewAccessibleClass; struct _GtkTreeViewAccessible { - GailContainer parent; + GtkContainerAccessible parent; gint n_children_deleted; gint n_rows; @@ -58,7 +58,7 @@ struct _GtkTreeViewAccessible struct _GtkTreeViewAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_tree_view_accessible_get_type (void); diff --git a/gtk/a11y/gtkwindowaccessible.c b/gtk/a11y/gtkwindowaccessible.c index f07d35f550..e421093fc6 100644 --- a/gtk/a11y/gtkwindowaccessible.c +++ b/gtk/a11y/gtkwindowaccessible.c @@ -56,7 +56,7 @@ static guint gtk_window_accessible_signals [LAST_SIGNAL] = { 0, }; static void atk_component_interface_init (AtkComponentIface *iface); -G_DEFINE_TYPE_WITH_CODE (GtkWindowAccessible, gtk_window_accessible, GAIL_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkWindowAccessible, gtk_window_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)) diff --git a/gtk/a11y/gtkwindowaccessible.h b/gtk/a11y/gtkwindowaccessible.h index ee9cb82cf5..5c781b3f57 100644 --- a/gtk/a11y/gtkwindowaccessible.h +++ b/gtk/a11y/gtkwindowaccessible.h @@ -20,7 +20,7 @@ #ifndef __GTK_WINDOW_ACCESSIBLE_H__ #define __GTK_WINDOW_ACCESSIBLE_H__ -#include "gailcontainer.h" +#include "gtkcontaineraccessible.h" G_BEGIN_DECLS @@ -36,12 +36,12 @@ typedef struct _GtkWindowAccessibleClass GtkWindowAccessibleClass; struct _GtkWindowAccessible { - GailContainer parent; + GtkContainerAccessible parent; }; struct _GtkWindowAccessibleClass { - GailContainerClass parent_class; + GtkContainerAccessibleClass parent_class; }; GType gtk_window_accessible_get_type (void); diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 66e7a0c21d..e9ddd0fd07 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -47,7 +47,7 @@ #include "gtkwindow.h" #include "gtkintl.h" #include "gtktoolbar.h" - +#include "a11y/gtkcontaineraccessible.h" /** * SECTION:gtkcontainer @@ -512,6 +512,8 @@ gtk_container_class_init (GtkContainerClass *class) GTK_TYPE_WIDGET); g_type_class_add_private (class, sizeof (GtkContainerPrivate)); + + gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_CONTAINER_ACCESSIBLE); } static void diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index b395f43f46..3dd5d37a7c 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -47,6 +47,7 @@ #include "gtktreednd.h" #include "gtktypebuiltins.h" #include "gtkprivate.h" +#include "a11y/gtkcontaineraccessible.h" /** * SECTION:gtkiconview @@ -447,6 +448,7 @@ static void gtk_icon_view_buildable_custom_tag_end (GtkBuildable *buildab GObject *child, const gchar *tagname, gpointer *data); +static GType gtk_icon_view_accessible_get_type (void); static guint icon_view_signals[LAST_SIGNAL] = { 0 }; @@ -1046,6 +1048,8 @@ gtk_icon_view_class_init (GtkIconViewClass *klass) GTK_MOVEMENT_VISUAL_POSITIONS, 1); gtk_icon_view_add_move_binding (binding_set, GDK_KEY_KP_Left, 0, GTK_MOVEMENT_VISUAL_POSITIONS, -1); + + gtk_widget_class_set_accessible_type (widget_class, gtk_icon_view_accessible_get_type ()); } static void @@ -9216,13 +9220,13 @@ gtk_icon_view_accessible_get_type (void) { GTypeInfo tinfo = { - 0, /* class size */ + sizeof (GtkContainerAccessibleClass), /* class size */ (GBaseInitFunc) NULL, /* base init */ (GBaseFinalizeFunc) NULL, /* base finalize */ (GClassInitFunc) gtk_icon_view_accessible_class_init, (GClassFinalizeFunc) NULL, /* class finalize */ NULL, /* class data */ - 0, /* instance size */ + sizeof (GtkContainerAccessible), /* instance size */ 0, /* nb preallocs */ (GInstanceInitFunc) NULL, /* instance init */ NULL /* value table */ @@ -9240,26 +9244,8 @@ gtk_icon_view_accessible_get_type (void) NULL }; - /* - * Figure out the size of the class and instance - * we are deriving from - */ - AtkObjectFactory *factory; - GType derived_type; - GTypeQuery query; - GType derived_atk_type; - - derived_type = g_type_parent (GTK_TYPE_ICON_VIEW); - factory = atk_registry_get_factory (atk_get_default_registry (), - derived_type); - derived_atk_type = atk_object_factory_get_accessible_type (factory); - g_type_query (derived_atk_type, &query); - tinfo.class_size = query.class_size; - tinfo.instance_size = query.instance_size; - - type = g_type_register_static (derived_atk_type, - I_("GtkIconViewAccessible"), - &tinfo, 0); + type = g_type_register_static (GTK_TYPE_CONTAINER_ACCESSIBLE, + I_("GtkIconViewAccessible"), &tinfo, 0); g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info); g_type_add_interface_static (type, ATK_TYPE_SELECTION, diff --git a/tests/a11y/colorchooser.txt b/tests/a11y/colorchooser.txt index 84c82abbd1..b4455848bb 100644 --- a/tests/a11y/colorchooser.txt +++ b/tests/a11y/colorchooser.txt @@ -126,7 +126,7 @@ window1 <AtkComponent> layer: widget alpha: 1 - unnamed-GailContainer-12 + unnamed-GtkContainerAccessible-12 "panel" parent: unnamed-GtkBoxAccessible-11 index: 0 @@ -137,7 +137,7 @@ window1 alpha: 1 #FFFFFF "text" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 0 description: You can enter an HTML-style hexadecimal color value, or simply a color name such as 'orange' in this entry. labelled-by: Color name: @@ -180,7 +180,7 @@ window1 action 0 keybinding: <Alt>n Color name: "label" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 1 name: Color name: label-for: #FFFFFF @@ -220,7 +220,7 @@ window1 wrap-mode: word 255 "text" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 2 description: Transparency of the color. state: editable enabled focusable sensitive single-line @@ -261,7 +261,7 @@ window1 action 0 name: activate unnamed-GtkScaleAccessible-13 "slider" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 3 description: Transparency of the color. labelled-by: Opacity: @@ -280,7 +280,7 @@ window1 minimum increment: 1.000000 Opacity: "label" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 4 name: Opacity: label-for: unnamed-GtkScaleAccessible-13 @@ -320,7 +320,7 @@ window1 wrap-mode: word unnamed-GailWidget-14 "separator" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 5 state: enabled horizontal sensitive showing visible toolkit: gail @@ -329,7 +329,7 @@ window1 alpha: 1 255 "spin button" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 6 description: Amount of blue light in the color. controller-for: unnamed-GailWidget-4 @@ -378,7 +378,7 @@ window1 minimum increment: 1.000000 Blue: "label" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 7 name: Blue: label-for: 255 @@ -418,7 +418,7 @@ window1 wrap-mode: word 255 "spin button" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 8 description: Amount of green light in the color. controller-for: unnamed-GailWidget-4 @@ -467,7 +467,7 @@ window1 minimum increment: 1.000000 Green: "label" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 9 name: Green: label-for: 255 @@ -507,7 +507,7 @@ window1 wrap-mode: word 255 "spin button" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 10 description: Amount of red light in the color. controller-for: unnamed-GailWidget-4 @@ -556,7 +556,7 @@ window1 minimum increment: 1.000000 Red: "label" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 11 name: Red: label-for: 255 @@ -596,7 +596,7 @@ window1 wrap-mode: word 100 "spin button" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 12 description: Brightness of the color. controller-for: unnamed-GailWidget-4 @@ -645,7 +645,7 @@ window1 minimum increment: 1.000000 Value: "label" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 13 name: Value: label-for: 100 @@ -685,7 +685,7 @@ window1 wrap-mode: word 0 "spin button" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 14 description: Intensity of the color. controller-for: unnamed-GailWidget-4 @@ -734,7 +734,7 @@ window1 minimum increment: 1.000000 Saturation: "label" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 15 name: Saturation: label-for: 0 @@ -774,7 +774,7 @@ window1 wrap-mode: word 0 "spin button" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 16 description: Position on the color wheel. controller-for: unnamed-GailWidget-4 @@ -823,7 +823,7 @@ window1 minimum increment: 1.000000 Hue: "label" - parent: unnamed-GailContainer-12 + parent: unnamed-GtkContainerAccessible-12 index: 17 name: Hue: label-for: 0 @@ -910,7 +910,7 @@ window1 variant: <omitted> weight: <omitted> wrap-mode: word - unnamed-GailContainer-17 + unnamed-GtkContainerAccessible-17 "panel" parent: unnamed-GtkBoxAccessible-15 index: 1 @@ -921,7 +921,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-18 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 0 state: enabled sensitive visible toolkit: gail @@ -940,7 +940,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-20 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 1 state: enabled sensitive visible toolkit: gail @@ -959,7 +959,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-22 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 2 state: enabled sensitive visible toolkit: gail @@ -978,7 +978,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-24 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 3 state: enabled sensitive visible toolkit: gail @@ -997,7 +997,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-26 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 4 state: enabled sensitive visible toolkit: gail @@ -1016,7 +1016,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-28 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 5 state: enabled sensitive visible toolkit: gail @@ -1035,7 +1035,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-30 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 6 state: enabled sensitive visible toolkit: gail @@ -1054,7 +1054,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-32 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 7 state: enabled sensitive visible toolkit: gail @@ -1073,7 +1073,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-34 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 8 state: enabled sensitive visible toolkit: gail @@ -1092,7 +1092,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-36 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 9 state: enabled sensitive visible toolkit: gail @@ -1111,7 +1111,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-38 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 10 state: enabled sensitive visible toolkit: gail @@ -1130,7 +1130,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-40 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 11 state: enabled sensitive visible toolkit: gail @@ -1149,7 +1149,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-42 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 12 state: enabled sensitive visible toolkit: gail @@ -1168,7 +1168,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-44 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 13 state: enabled sensitive visible toolkit: gail @@ -1187,7 +1187,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-46 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 14 state: enabled sensitive visible toolkit: gail @@ -1206,7 +1206,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-48 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 15 state: enabled sensitive visible toolkit: gail @@ -1225,7 +1225,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-50 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 16 state: enabled sensitive visible toolkit: gail @@ -1244,7 +1244,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-52 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 17 state: enabled sensitive visible toolkit: gail @@ -1263,7 +1263,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-54 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 18 state: enabled sensitive visible toolkit: gail @@ -1282,7 +1282,7 @@ window1 alpha: 1 unnamed-GtkFrameAccessible-56 "panel" - parent: unnamed-GailContainer-17 + parent: unnamed-GtkContainerAccessible-17 index: 19 state: enabled sensitive visible toolkit: gail |