g_return_val_if_fail (ATK_IS_OBJECT (user_data),
droute_not_yet_handled_error (message));
if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
- return spi_dbus_general_error (message);
+ {
+ return droute_invalid_arguments_error (message);
+ }
child = atk_object_ref_accessible_child (object, i);
return spi_dbus_return_object (message, child, TRUE, TRUE);
}
return reply;
}
+static DBusMessage *
+impl_Embedded (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
+{
+ AtkObject *object = (AtkObject *) user_data;
+ char *path;
+ gchar *id;
+
+ if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID))
+ {
+ return droute_invalid_arguments_error (message);
+ }
+ id = g_object_get_data (G_OBJECT (object), "dbus-plug-parent");
+ if (id)
+ g_free (id);
+ id = g_strconcat (dbus_message_get_sender (message), ":", path, NULL);
+ g_object_set_data (G_OBJECT (object), "dbus-plug-parent", id);
+ return dbus_message_new_method_return (message);
+}
+
static DRouteMethod methods[] = {
{impl_GetChildAtIndex, "GetChildAtIndex"},
{impl_GetChildren, "GetChildren"},
{impl_GetAttributes, "GetAttributes"},
{impl_GetApplication, "GetApplication"},
{impl_GetInterfaces, "GetInterfaces"},
+ {impl_Embedded, "Embedded"},
{NULL, NULL}
};
if (!bus_name)
bus_name = "";
+ if (!path)
+ path = SPI_DBUS_PATH_NULL;
dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL, &iter_struct);
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &bus_name);
path = atk_dbus_object_to_path (obj, do_register);
- if (!path)
- path = g_strdup (SPI_DBUS_PATH_NULL);
-
spi_dbus_append_name_and_path_inner (iter, atspi_dbus_name, path);
g_free (path);
{
AtkObject *parent;
gchar *path;
- gchar *bus_parent = NULL, *path_parent;
+ gchar *bus_parent = NULL, *path_parent = NULL;
/* Marshall object path */
path = atk_dbus_object_to_path (obj, FALSE);
{
/* TODO: Support getting parent of an AtkPlug */
#ifdef __ATK_PLUG_H__
- if (role != Accessibility_ROLE_APPLICATION && !ATK_IS_PLUG (obj))
+ if (ATK_IS_PLUG (obj))
+ {
+ char *id = g_object_get_data (G_OBJECT (obj), "dbus-plug-parent");
+ if (id)
+ bus_parent = g_strdup (id);
+ if (bus_parent && (path_parent = g_utf8_strchr (bus_parent + 1, -1, ':')))
+ {
+ *(path_parent++) = '\0';
+ /* path_parent is going to be freed, so dup it */
+ path_parent = g_strdup (path_parent);
+ }
+ }
+ else if (role != Accessibility_ROLE_APPLICATION)
#else
if (role != Accessibility_ROLE_APPLICATION)
#endif
socket_embed_hook (AtkSocket *socket, gchar *plug_id)
{
AtkObject *accessible = ATK_OBJECT(socket);
+ gchar *plug_name, *plug_path;
+
/* Force registration */
gchar *path = atk_dbus_object_to_path (accessible, TRUE);
spi_emit_cache_update (accessible, atk_adaptor_app_data->bus);
+ /* Let the plug know that it has been embedded */
+ plug_name = g_strdup (plug_id);
+ if (!plug_name)
+ {
+ g_free (path);
+ return;
+ }
+ plug_path = g_utf8_strchr (plug_name + 1, -1, ':');
+ if (plug_path)
+ {
+ DBusMessage *message;
+ *(plug_path++) = '\0';
+ message = dbus_message_new_method_call (plug_name, plug_path, "org.freedesktop.atspi.Accessible", "Embedded");
+ dbus_message_append_args (message, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID);
+ dbus_connection_send (atk_adaptor_app_data->bus, message, NULL);
+ }
+ g_free (plug_name);
g_free (path);
}