[g-a-devel]patch for AccessibleChildChangedEvent_getChildAccessible
- From: "Padraig O'Briain" <Padraig Obriain Sun COM>
- To: gnome-accessibility-devel gnome org
- Subject: [g-a-devel]patch for AccessibleChildChangedEvent_getChildAccessible
- Date: Fri, 7 Mar 2003 10:25:47 +0000 (GMT)
The attached patch gets AccessibleChildChangedEvent_getChildAccessible()
working.
OK to commit?
Padraig
Index: atk-bridge/bridge.c
===================================================================
RCS file: /cvs/gnome/at-spi/atk-bridge/bridge.c,v
retrieving revision 1.58
diff -u -p -r1.58 bridge.c
--- atk-bridge/bridge.c 14 Feb 2003 13:44:14 -0000 1.58
+++ atk-bridge/bridge.c 7 Mar 2003 10:25:07 -0000
@@ -61,7 +61,7 @@ static guint toplevel_handler;
*/
static guint atk_signal_text_changed;
-static guint atk_signal_child_changed;
+static guint atk_signal_children_changed;
static guint atk_signal_active_descendant_changed;
/* NOT YET USED
@@ -126,7 +126,7 @@ extern void gnome_accessibility_module_s
static void
spi_atk_bridge_init_event_type_consts ()
{
- atk_signal_child_changed = g_signal_lookup ("child_changed",
+ atk_signal_children_changed = g_signal_lookup ("children_changed",
ATK_TYPE_OBJECT);
atk_signal_text_changed = g_signal_lookup ("text_changed",
ATK_TYPE_TEXT);
@@ -752,6 +752,22 @@ spi_atk_bridge_signal_listener (GSignalI
detail1 = g_value_get_int (param_values + 1);
spi_init_any_nil (&any);
}
+ else if ((signal_query.signal_id == atk_signal_children_changed) && gobject)
+ {
+ ao = atk_object_ref_accessible_child (ATK_OBJECT (gobject),
+ detail1);
+ if (ao)
+ {
+ s_ao = spi_accessible_new (ao);
+ c_obj = BONOBO_OBJREF (s_ao);
+ spi_init_any_object (&any, &c_obj);
+ g_object_unref (ao);
+ }
+ else
+ {
+ spi_init_any_nil (&any);
+ }
+ }
else
{
if (G_VALUE_TYPE (param_values + 1) == G_TYPE_INT)
@@ -765,22 +781,6 @@ spi_atk_bridge_signal_listener (GSignalI
detail1,
detail1+detail2);
spi_init_any_string (&any, &sp);
- }
- else if ((signal_query.signal_id == atk_signal_child_changed) && gobject)
- {
- ao = atk_object_ref_accessible_child (ATK_OBJECT (gobject),
- detail1);
- if (ao)
- {
- s_ao = spi_accessible_new (ao);
- c_obj = BONOBO_OBJREF (s_ao);
- spi_init_any_object (&any, &c_obj);
- g_object_unref (ao);
- }
- else
- {
- spi_init_any_nil (&any);
- }
}
else
{
Index: test/event-listener-test.c
===================================================================
RCS file: /cvs/gnome/at-spi/test/event-listener-test.c,v
retrieving revision 1.16
diff -u -p -r1.16 event-listener-test.c
--- test/event-listener-test.c 5 Mar 2003 17:24:59 -0000 1.16
+++ test/event-listener-test.c 7 Mar 2003 10:25:08 -0000
@@ -31,6 +31,7 @@ static void report_event (const Accessi
static void report_detail_event (const AccessibleEvent *event, void *user_data);
static void report_detail1_event (const AccessibleEvent *event, void *user_data);
static void report_text_event (const AccessibleEvent *event, void *user_data);
+static void report_children_changed_event (const AccessibleEvent *event, void *user_data);
static void timing_test_event (const AccessibleEvent *event, void *user_data);
static SPIBoolean report_mouse_event (const AccessibleDeviceEvent *event, void *user_data);
@@ -39,6 +40,7 @@ static AccessibleEventListener *specific
static AccessibleEventListener *detail1_listener;
static AccessibleEventListener *test_listener;
static AccessibleEventListener *text_listener;
+static AccessibleEventListener *children_changed_listener;
static AccessibleDeviceListener *mouse_device_listener;
static gint n_elements_traversed = 0;
static GTimer *timer;
@@ -94,6 +96,8 @@ main (int argc, char **argv)
report_detail_event, NULL);
text_listener = SPI_createAccessibleEventListener (
report_text_event, NULL);
+ children_changed_listener = SPI_createAccessibleEventListener (
+ report_children_changed_event, NULL);
test_listener = SPI_createAccessibleEventListener (
timing_test_event, NULL);
mouse_device_listener = SPI_createAccessibleDeviceListener (
@@ -126,7 +130,7 @@ main (int argc, char **argv)
"object:state-changed:focused"); */
SPI_registerGlobalEventListener (generic_listener,
"object:selection-changed");
- SPI_registerGlobalEventListener (generic_listener,
+ SPI_registerGlobalEventListener (children_changed_listener,
"object:children-changed");
/* SPI_registerGlobalEventListener (specific_listener,
"object:children-changed:add"); */
@@ -289,10 +293,27 @@ report_text_event (const AccessibleEvent
char *s = Accessible_getName (event->source);
fprintf (stderr, "(detail) %s %s %d %d\n", event->type, s,
event->detail1, event->detail2);
- if (s) SPI_freeString (s);
+ SPI_freeString (s);
s = AccessibleTextChangedEvent_getChangeString (event);
fprintf (stderr, "context string %s\n", (s) ? s : "<nil>");
SPI_freeString (s);
+}
+
+void
+report_children_changed_event (const AccessibleEvent *event, void *user_data)
+{
+ char *s = Accessible_getName (event->source);
+ char *s1;
+ Accessible *ao;
+
+ ao = AccessibleChildChangedEvent_getChildAccessible (event);
+ s1 = Accessible_getName (ao);
+ fprintf (stderr, "(detail) %s parent: %s child: %s %d %d\n", event->type,
+ s ? s : "<null>", s1 ? s1 : "<null>",
+ event->detail1, event->detail2);
+ SPI_freeString (s);
+ SPI_freeString (s1);
+ Accessible_unref (ao);
}
SPIBoolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]