[at-spi2-atk] Have ChildCount and GetChildAtIndex take sockets into account
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-atk] Have ChildCount and GetChildAtIndex take sockets into account
- Date: Mon, 21 Jun 2010 15:08:47 +0000 (UTC)
commit b489de3d71574d8249278d6dac5f8d0713bf4db8
Author: Mike Gorse <mgorse novell com>
Date: Fri Jun 18 14:59:51 2010 -0400
Have ChildCount and GetChildAtIndex take sockets into account
atk-adaptor/adaptors/accessible-adaptor.c | 33 ++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/atk-adaptor/adaptors/accessible-adaptor.c b/atk-adaptor/adaptors/accessible-adaptor.c
index b40c5f9..9872c41 100644
--- a/atk-adaptor/adaptors/accessible-adaptor.c
+++ b/atk-adaptor/adaptors/accessible-adaptor.c
@@ -141,12 +141,14 @@ static dbus_bool_t
impl_get_ChildCount (DBusMessageIter * iter, void *user_data)
{
AtkObject *object = (AtkObject *) user_data;
+ int childCount;
g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
- return droute_return_v_int32 (iter,
- atk_object_get_n_accessible_children
- (object));
+ childCount = (ATK_IS_SOCKET (object) && atk_socket_is_occupied (object))
+ ? 1
+ : atk_object_get_n_accessible_children (object);
+ return droute_return_v_int32 (iter, childCount);
}
static DBusMessage *
@@ -166,6 +168,31 @@ impl_GetChildAtIndex (DBusConnection * bus,
{
return droute_invalid_arguments_error (message);
}
+
+ if (ATK_IS_SOCKET (object) && atk_socket_is_occupied (ATK_SOCKET (object)) && i == 0)
+ {
+ AtkSocket *socket = ATK_SOCKET (object);
+ gchar *child_name, *child_path;
+ child_name = g_strdup (socket->embedded_plug_id);
+ child_path = g_utf8_strchr (child_name + 1, -1, ':');
+ if (child_path)
+ {
+ DBusMessage *reply;
+ DBusMessageIter iter, iter_socket;
+ *(child_path++) = '\0';
+ reply = dbus_message_new_method_return (message);
+ if (!reply)
+ return NULL;
+ dbus_message_iter_init_append (reply, &iter);
+ dbus_message_iter_open_container (&iter, DBUS_TYPE_STRUCT, NULL,
+ &iter_socket);
+ dbus_message_iter_append_basic (&iter_socket, DBUS_TYPE_STRING, &child_name);
+ dbus_message_iter_append_basic (&iter_socket, DBUS_TYPE_OBJECT_PATH, &child_path);
+ dbus_message_iter_close_container (&iter, &iter_socket);
+ return reply;
+ }
+ g_free (child_name);
+ }
child = atk_object_ref_accessible_child (object, i);
return spi_object_return_reference (message, child);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]