[gtk+/wip/a11y: 7/10] a11y: Call add/remove functions directly



commit bc907c14719d3560b9e1c2ef0b374ff0155e46ea
Author: Mike Gorse <mgorse suse com>
Date:   Sun Jan 13 17:51:39 2013 +0100

    a11y: Call add/remove functions directly
    
    ... instead of relying on signals. Signals shouldn't be used in the a11y
    <=> GTK interaction anyway, but more importantly, the signals in used
    don't get emitted reliably.

 gtk/a11y/Makefile.am                     |    1 +
 gtk/a11y/gtkcontaineraccessible.c        |   17 ++++++-----------
 gtk/a11y/gtkcontaineraccessibleprivate.h |   30 ++++++++++++++++++++++++++++++
 gtk/gtkwidget.c                          |    5 +++++
 4 files changed, 42 insertions(+), 11 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index c97cf92..6e93b3e 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -103,6 +103,7 @@ gtka11y_private_h_sources =		\
 	gtkaccessibilityutil.h		\
 	gtkcellaccessibleprivate.h	\
 	gtkcolorswatchaccessibleprivate.h \
+	gtkcontaineraccessibleprivate.h \
 	gtkiconviewaccessibleprivate.h	\
 	gtklockbuttonaccessibleprivate.h \
 	gtkrangeaccessibleprivate.h     \
diff --git a/gtk/a11y/gtkcontaineraccessible.c b/gtk/a11y/gtkcontaineraccessible.c
index d43f2f4..10e633a 100644
--- a/gtk/a11y/gtkcontaineraccessible.c
+++ b/gtk/a11y/gtkcontaineraccessible.c
@@ -73,10 +73,9 @@ gtk_container_accessible_ref_child (AtkObject *obj,
   return accessible;
 }
 
-static void
-gtk_container_accessible_add (GtkContainer *container,
-                              GtkWidget    *child,
-                              gpointer      data)
+void
+_gtk_container_accessible_add (GtkContainer *container,
+                               GtkWidget    *child)
 {
   GtkContainerAccessible *accessible;
   GtkContainerAccessibleClass *klass;
@@ -92,10 +91,9 @@ gtk_container_accessible_add (GtkContainer *container,
   klass->add (accessible, child);
 }
  
-static void
-gtk_container_accessible_remove (GtkContainer *container,
-                                 GtkWidget    *child,
-                                 gpointer      data)
+void
+_gtk_container_accessible_remove (GtkContainer *container,
+                                  GtkWidget    *child)
 {
   GtkContainerAccessible *accessible;
   GtkContainerAccessibleClass *klass;
@@ -160,9 +158,6 @@ gtk_container_accessible_real_initialize (AtkObject *obj,
 
   accessible->priv->children = gtk_container_get_children (GTK_CONTAINER (data));
 
-  g_signal_connect (data, "add", G_CALLBACK (gtk_container_accessible_add), obj);
-  g_signal_connect (data, "remove", G_CALLBACK (gtk_container_accessible_remove), obj);
-
   obj->role = ATK_ROLE_PANEL;
 }
 
diff --git a/gtk/a11y/gtkcontaineraccessibleprivate.h b/gtk/a11y/gtkcontaineraccessibleprivate.h
new file mode 100644
index 0000000..a1a8f25
--- /dev/null
+++ b/gtk/a11y/gtkcontaineraccessibleprivate.h
@@ -0,0 +1,30 @@
+/* GTK+ - accessibility implementations
+ * Copyright (C) 2002, 2004  Anders Carlsson <andersca gnu org>
+ *
+ * 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 (GtkContainer *container, GtkWidget *child);
+void _gtk_container_accessible_remove (GtkContainer *container, GtkWidget *child);
+
+G_END_DECLS
+
+#endif /* __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__ */
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c00cd25..82da7e5 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -62,6 +62,7 @@
 #include "gtkdebug.h"
 #include "gtkplug.h"
 #include "gtktypebuiltins.h"
+#include "a11y/gtkcontaineraccessibleprivate.h"
 #include "a11y/gtkwidgetaccessible.h"
 
 /**
@@ -3865,6 +3866,8 @@ gtk_widget_unparent (GtkWidget *widget)
 
   /* keep this function in sync with gtk_menu_detach() */
 
+  _gtk_container_accessible_remove (GTK_CONTAINER (priv->parent), widget);
+
   gtk_widget_push_verify_invariants (widget);
 
   g_object_freeze_notify (G_OBJECT (widget));
@@ -8079,6 +8082,8 @@ gtk_widget_set_parent (GtkWidget *widget,
     }
 
   gtk_widget_pop_verify_invariants (widget);
+
+  _gtk_container_accessible_add (GTK_CONTAINER (parent), widget);
 }
 
 /**



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