+ else if (role != Accessibility_ROLE_APPLICATION)
+#else
+ if (role != Accessibility_ROLE_APPLICATION)
+#endif
+ 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;
+
+ child = atk_object_ref_accessible_child (obj, i);
+ child_path = atk_dbus_object_to_path (child, FALSE);
+ if (child_path)
+ {
+ spi_dbus_append_name_and_path_inner (&iter_sub_array, NULL,
+ child_path);
+ g_free (child_path);
+ }
+ g_object_unref (G_OBJECT (child));
+ }
+ }