X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fa11y%2Fgtkcontaineraccessible.c;h=6f32898c6a1be9b8429d78d10dfe34eed503e902;hb=10ead8a9d75386a7210f3e3fa6ae704721871e9e;hp=a8a1615d3cc1f5686b6c16f6321aab4fe9d2a527;hpb=e756b2e50dcee82855b0cbe7af6aa3873d1ecfa8;p=~andy%2Fgtk diff --git a/gtk/a11y/gtkcontaineraccessible.c b/gtk/a11y/gtkcontaineraccessible.c index a8a1615d3..6f32898c6 100644 --- a/gtk/a11y/gtkcontaineraccessible.c +++ b/gtk/a11y/gtkcontaineraccessible.c @@ -12,9 +12,7 @@ * 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. + * License along with this library. If not, see . */ #include "config.h" @@ -22,6 +20,10 @@ #include #include "gtkcontaineraccessible.h" +struct _GtkContainerAccessiblePrivate +{ + GList *children; +}; G_DEFINE_TYPE (GtkContainerAccessible, _gtk_container_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) @@ -36,7 +38,7 @@ gtk_container_accessible_get_n_children (AtkObject* obj) if (widget == NULL) return 0; - children = gtk_container_get_children (GTK_CONTAINER(widget)); + children = gtk_container_get_children (GTK_CONTAINER (widget)); count = g_list_length (children); g_list_free (children); @@ -117,9 +119,9 @@ gtk_container_accessible_real_add_gtk (GtkContainer *container, 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_list_free (accessible->priv->children); + accessible->priv->children = gtk_container_get_children (container); + index = g_list_index (accessible->priv->children, widget); g_signal_emit_by_name (atk_parent, "children-changed::add", index, atk_child, NULL); return 1; @@ -142,10 +144,10 @@ gtk_container_accessible_real_remove_gtk (GtkContainer *container, 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)) + index = g_list_index (accessible->priv->children, widget); + g_list_free (accessible->priv->children); + accessible->priv->children = gtk_container_get_children (container); + if (index >= 0 && index <= g_list_length (accessible->priv->children)) g_signal_emit_by_name (atk_parent, "children-changed::remove", index, atk_child, NULL); return 1; @@ -159,17 +161,12 @@ gtk_container_accessible_real_initialize (AtkObject *obj, ATK_OBJECT_CLASS (_gtk_container_accessible_parent_class)->initialize (obj, data); - accessible->children = gtk_container_get_children (GTK_CONTAINER (data)); + accessible->priv->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; + obj->role = ATK_ROLE_PANEL; } static void @@ -177,7 +174,7 @@ gtk_container_accessible_finalize (GObject *object) { GtkContainerAccessible *accessible = GTK_CONTAINER_ACCESSIBLE (object); - g_list_free (accessible->children); + g_list_free (accessible->priv->children); G_OBJECT_CLASS (_gtk_container_accessible_parent_class)->finalize (object); } @@ -196,10 +193,14 @@ _gtk_container_accessible_class_init (GtkContainerAccessibleClass *klass) klass->add_gtk = gtk_container_accessible_real_add_gtk; klass->remove_gtk = gtk_container_accessible_real_remove_gtk; + + g_type_class_add_private (klass, sizeof (GtkContainerAccessiblePrivate)); } static void _gtk_container_accessible_init (GtkContainerAccessible *container) { + container->priv = G_TYPE_INSTANCE_GET_PRIVATE (container, + GTK_TYPE_CONTAINER_ACCESSIBLE, + GtkContainerAccessiblePrivate); } -