2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2008 Novell, Inc.
6 * Copyright 2001, 2002 Sun Microsystems Inc.,
7 * Copyright 2001, 2002 Ximian, Inc.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
26 #include <droute/droute.h>
28 #include "common/spi-dbus.h"
29 #include "introspection.h"
31 /* for spi_global_app_data is there a better way? */
32 #include "../bridge.h"
35 impl_get_ToolkitName (DBusMessageIter * iter, void *user_data)
37 return droute_return_v_string (iter, atk_get_toolkit_name ());
41 impl_get_Version (DBusMessageIter * iter, void *user_data)
43 return droute_return_v_string (iter, atk_get_toolkit_version ());
47 impl_get_AtspiVersion (DBusMessageIter * iter, void *user_data)
49 return droute_return_v_string (iter, "2.0");
52 static dbus_int32_t id;
55 impl_get_Id (DBusMessageIter * iter, void *user_data)
57 return droute_return_v_int32 (iter, id);
61 impl_set_Id (DBusMessageIter * iter, void *user_data)
63 id = droute_get_v_int32 (iter);
68 impl_registerToolkitEventListener (DBusConnection * bus,
69 DBusMessage * message, void *user_data)
75 impl_registerObjectEventListener (DBusConnection * bus, DBusMessage * message,
82 impl_pause (DBusConnection * bus, DBusMessage * message, void *user_data)
88 impl_resume (DBusConnection * bus, DBusMessage * message, void *user_data)
94 impl_GetLocale (DBusConnection * bus, DBusMessage * message, void *user_data)
100 impl_get_app_bus(DBusConnection *bus, DBusMessage *msg, void *data)
104 if (bus == spi_global_app_data->bus)
105 spi_atk_add_client (dbus_message_get_sender (msg));
107 reply = dbus_message_new_method_return(msg);
110 const char *retval = (g_getenv ("AT_SPI_CLIENT") ?
112 spi_global_app_data->app_bus_addr);
113 dbus_message_append_args(reply, DBUS_TYPE_STRING, &retval, DBUS_TYPE_INVALID);
119 static DRouteMethod methods[] = {
120 {impl_registerToolkitEventListener, "registerToolkitEventListener"},
121 {impl_registerObjectEventListener, "registerObjectEventListener"},
122 {impl_pause, "pause"},
123 {impl_resume, "resume"},
124 {impl_GetLocale, "GetLocale"},
125 {impl_get_app_bus, "GetApplicationBusAddress"},
129 static DRouteProperty properties[] = {
130 {impl_get_ToolkitName, NULL, "ToolkitName"},
131 {impl_get_Version, NULL, "Version"},
132 {impl_get_AtspiVersion, NULL, "AtspiVersion"},
133 {impl_get_Id, impl_set_Id, "Id"},
138 obj_is_root (const char *path, void *user_data)
140 AtkObject *obj = atk_dbus_get_object (path);
141 return (obj == atk_get_root ());
145 spi_initialize_application (DRoutePath * path)
147 droute_path_add_interface (path,
148 SPI_DBUS_INTERFACE_APPLICATION,
149 spi_org_a11y_atspi_Application,
150 methods, properties);