[at-spi2-atk/mgorse: 1/3] Support AtkPlug and AtkSocket
- From: Mike Gorse <mgorse src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [at-spi2-atk/mgorse: 1/3] Support AtkPlug and AtkSocket
- Date: Wed, 11 Nov 2009 15:15:50 +0000 (UTC)
commit 9e77ce18c391f574e4cda97b553eef172c2e276f
Author: Mike Gorse <mgorse novell com>
Date: Mon Nov 9 18:17:30 2009 -0500
Support AtkPlug and AtkSocket
Add support for AtkPlug and AtkSocket. This code is currently enabled
conditionally if the relevant code is present. Support is not yet
committed into atk.
atk-adaptor/accessible-marshaller.c | 17 +++++++++++++
atk-adaptor/bridge.c | 46 +++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/atk-adaptor/accessible-marshaller.c b/atk-adaptor/accessible-marshaller.c
index 2d5e4fd..93fe2de 100644
--- a/atk-adaptor/accessible-marshaller.c
+++ b/atk-adaptor/accessible-marshaller.c
@@ -20,6 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
+#include <string.h>
#include <droute/droute.h>
#include "common/spi-dbus.h"
@@ -312,6 +313,22 @@ spi_atk_append_accessible(AtkObject *obj, gpointer data)
g_object_unref(G_OBJECT(child));
}
}
+#ifdef __ATK_PLUG_H__
+ if (ATK_IS_SOCKET (obj) && atk_socket_is_occupied (ATK_SOCKET(obj)))
+ {
+ AtkSocket *socket = ATK_SOCKET(obj);
+ gchar *child_name, *child_path;
+ child_name = g_strdup (socket->embedded_plug_id);
+ child_path = strchr (child_name + 1, ':');
+ if (child_path)
+ {
+ *(child_path++) = '\0';
+ spi_dbus_append_name_and_path_inner (&iter_sub_array, child_name, child_path);
+ }
+ g_free (child_name);
+ }
+#endif
+
dbus_message_iter_close_container (&iter_struct, &iter_sub_array);
/* Marshall interfaces */
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index 36d32c7..e1782aa 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -211,6 +211,47 @@ exit_func (void)
/*---------------------------------------------------------------------------*/
+#ifdef __ATK_PLUG_H__
+static AtkPlugClass *plug_class;
+static AtkSocketClass *socket_class;
+
+static gchar *
+get_plug_id (AtkPlug *plug)
+{
+ const char *uname = dbus_bus_get_unique_name(atk_adaptor_app_data->bus);
+ gchar *path;
+ GString *str = g_string_new (NULL);
+
+ path = atk_dbus_object_to_path (ATK_OBJECT(plug), TRUE);
+ g_string_printf (str, "%s:%s", uname, path);
+ g_free (path);
+ return g_string_free (str, FALSE);
+}
+
+static void
+socket_embed_hook (AtkSocket *socket, gchar *plug_id)
+{
+ AtkObject *accessible = ATK_OBJECT(socket);
+ /* Force registration */
+ gchar *path = atk_dbus_object_to_path (accessible, TRUE);
+ spi_emit_cache_update (accessible, atk_adaptor_app_data->bus);
+ g_free (path);
+}
+
+static void
+install_plug_hooks ()
+{
+ gpointer data;
+
+ data = g_type_class_ref (ATK_TYPE_PLUG);
+ plug_class = ATK_PLUG_CLASS (data);
+ data = g_type_class_ref (ATK_TYPE_SOCKET);
+ socket_class = ATK_SOCKET_CLASS (data);
+ plug_class->get_object_id = get_plug_id;
+ socket_class->embed = socket_embed_hook;
+}
+#endif
+
static gchar *atspi_dbus_name;
static gboolean atspi_no_register;
@@ -323,6 +364,11 @@ adaptor_init (gint *argc, gchar **argv[])
/* Register methods to send D-Bus signals on certain ATK events */
spi_atk_register_event_listeners ();
+#ifdef __ATK_PLUG_H__
+ /* Hook our plug-and socket functions */
+ install_plug_hooks ();
+#endif
+
/* Register this app by sending a signal out to AT-SPI registry daemon */
register_application (atk_adaptor_app_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]