2008-11-28 Mike Gorse <mgorse@novell.com>
authorMike Gorse <mgorse@boston.site>
Fri, 28 Nov 2008 23:07:00 +0000 (17:07 -0600)
committerMike Gorse <mgorse@boston.site>
Fri, 28 Nov 2008 23:07:00 +0000 (17:07 -0600)
* event.c: Only call atk_dbus_register_subtree on the child that was just added.

atk-adaptor/event.c

index ddc3536..73e13a0 100644 (file)
@@ -343,9 +343,31 @@ tree_update_children_listener (GSignalInvocationHint *signal_hint,
                               gpointer               data)
 {
   AtkObject *accessible;
+  const gchar *detail = NULL;
+  AtkObject *child;
+  gboolean child_needs_unref = FALSE;
+
+  if (signal_hint->detail)
+    detail = g_quark_to_string (signal_hint->detail);
 
   accessible = g_value_get_object (&param_values[0]);
-  atk_dbus_register_subtree(accessible);
+  if (!strcmp (detail, "add"))
+    {
+      gpointer child;
+      int index = g_value_get_uint (param_values + 1);
+      child = g_value_get_pointer (param_values + 2);
+      if (ATK_IS_OBJECT (child))
+       g_object_ref (child);
+      else
+       child = atk_object_ref_accessible_child (accessible, index);
+      if (ATK_IS_OBJECT (child))
+       {
+         atk_dbus_register_subtree (child);
+         g_object_unref (child);
+       }
+      else
+       atk_dbus_register_subtree(accessible);
+    }
   return TRUE;
 }