[gtk+] a11y: Add private GtkContainerAccessible functions to add/remove a child
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] a11y: Add private GtkContainerAccessible functions to add/remove a child
- Date: Mon, 10 Mar 2014 22:05:45 +0000 (UTC)
commit d4d6968e1a7db86c12089ca0056e4d492d647e75
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Mar 10 16:12:05 2014 +0100
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
gtk/a11y/Makefile.am | 1 +
gtk/a11y/gtkcontaineraccessible.c | 27 ++++++++++++++++++++----
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 b32099e..b3c90a5 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 fcc7301..3db0165 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 0000000..fa692ce
--- /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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]