- {
- AtkObject *parent;
- gchar *path;
- gchar *bus_parent = NULL, *path_parent;
-
- /* Marshall object path */
- path = atk_dbus_object_to_path (obj, FALSE);
-
- role = spi_accessible_role_from_atk_role (atk_object_get_role (obj));
-
- /* Marshall parent */
- parent = atk_object_get_parent(obj);
- if (parent == NULL)
- {
- /* TODO: Support getting parent of an AtkPlug */
- if (role != Accessibility_ROLE_APPLICATION && !ATK_IS_PLUG (obj))
- path_parent = g_strdup (SPI_DBUS_PATH_NULL);
- else
- path_parent = atk_dbus_desktop_object_path ();
- }
- else
- {
- path_parent = atk_dbus_object_to_path (parent, FALSE);
- if (!path_parent)
- {
- /* This should only happen if a widget is re-parented to
- * an AtkObject that has not been registered and is then
- * updated. Ideally objects would be de-registered when
- * they are removed from a registered tree object, but
- * this would invalidate a huge amount of cache when
- * re-parenting.
- */
-#if SPI_ATK_DEBUG
- g_warning ("AT-SPI: Registered accessible marshalled when parent not registered");
-#endif
- path_parent = atk_dbus_desktop_object_path ();
- }
- }
-
- dbus_message_iter_open_container (iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct);
- dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
- spi_dbus_append_name_and_path_inner (&iter_struct, bus_parent, path_parent);
- g_free(path_parent);
- g_free (bus_parent);
-
- /* Marshall children */
- dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "(so)", &iter_sub_array);
- if (!atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS))
- {
- gint childcount, i;
-
- childcount = atk_object_get_n_accessible_children (obj);
- for (i = 0; i < childcount; i++)
- {
- AtkObject *child;
- gchar *child_path;