diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2014-03-10 16:12:05 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2014-03-10 23:01:59 +0100 |
commit | d4d6968e1a7db86c12089ca0056e4d492d647e75 (patch) | |
tree | cbd0326fcd7590b9b499a10f99939d4cbf67a176 /gtk/a11y | |
parent | 9d54fee952460c84d6ea84a7e90942605484c07e (diff) | |
download | gtk+-d4d6968e1a7db86c12089ca0056e4d492d647e75.tar.gz |
a11y: Add private GtkContainerAccessible functions to add/remove a child
This may be useful in container implementations, or for internal children
that trigger no signal emission.
https://bugzilla.gnome.org/show_bug.cgi?id=725864
Diffstat (limited to 'gtk/a11y')
-rw-r--r-- | gtk/a11y/Makefile.am | 1 | ||||
-rw-r--r-- | gtk/a11y/gtkcontaineraccessible.c | 27 | ||||
-rw-r--r-- | gtk/a11y/gtkcontaineraccessibleprivate.h | 33 |
3 files changed, 56 insertions, 5 deletions
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am index b32099ef4c..b3c90a563b 100644 --- a/gtk/a11y/Makefile.am +++ b/gtk/a11y/Makefile.am @@ -115,6 +115,7 @@ gtka11y_private_h_sources = \ gtkaccessibilityutil.h \ gtkcellaccessibleprivate.h \ gtkcolorswatchaccessibleprivate.h \ + gtkcontaineraccessibleprivate.h \ gtkiconviewaccessibleprivate.h \ gtklabelaccessibleprivate.h \ gtkflowboxaccessibleprivate.h \ diff --git a/gtk/a11y/gtkcontaineraccessible.c b/gtk/a11y/gtkcontaineraccessible.c index fcc7301cbb..3db0165b2b 100644 --- a/gtk/a11y/gtkcontaineraccessible.c +++ b/gtk/a11y/gtkcontaineraccessible.c @@ -19,6 +19,7 @@ #include <gtk/gtk.h> #include "gtkcontaineraccessible.h" +#include "gtkcontaineraccessibleprivate.h" struct _GtkContainerAccessiblePrivate { @@ -118,11 +119,10 @@ gtk_container_accessible_real_add_gtk (GtkContainer *container, 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->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); + _gtk_container_accessible_add_child (accessible, atk_child, index); return 1; } @@ -143,12 +143,11 @@ gtk_container_accessible_real_remove_gtk (GtkContainer *container, return 1; accessible = GTK_CONTAINER_ACCESSIBLE (atk_parent); - g_object_notify (G_OBJECT (atk_child), "accessible-parent"); 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); + if (index >= 0) + _gtk_container_accessible_remove_child (accessible, atk_child, index); return 1; } @@ -200,3 +199,21 @@ gtk_container_accessible_init (GtkContainerAccessible *container) { container->priv = gtk_container_accessible_get_instance_private (container); } + +void +_gtk_container_accessible_add_child (GtkContainerAccessible *accessible, + AtkObject *child, + gint index) +{ + g_object_notify (G_OBJECT (child), "accessible-parent"); + g_signal_emit_by_name (accessible, "children-changed::add", index, child, NULL); +} + +void +_gtk_container_accessible_remove_child (GtkContainerAccessible *accessible, + AtkObject *child, + gint index) +{ + g_object_notify (G_OBJECT (child), "accessible-parent"); + g_signal_emit_by_name (accessible, "children-changed::remove", index, child, NULL); +} diff --git a/gtk/a11y/gtkcontaineraccessibleprivate.h b/gtk/a11y/gtkcontaineraccessibleprivate.h new file mode 100644 index 0000000000..fa692ce59e --- /dev/null +++ b/gtk/a11y/gtkcontaineraccessibleprivate.h @@ -0,0 +1,33 @@ +/* GTK+ - accessibility implementations + * Copyright 2001 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, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__ +#define __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__ + +#include <gtk/a11y/gtkcontaineraccessible.h> + +G_BEGIN_DECLS + +void _gtk_container_accessible_add_child (GtkContainerAccessible *accessible, + AtkObject *child, + gint index); +void _gtk_container_accessible_remove_child (GtkContainerAccessible *accessible, + AtkObject *child, + gint index); +G_END_DECLS + +#endif /* __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__ */ |