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"
30 #include "introspection.h"
33 impl_GetLocale (DBusConnection * bus, DBusMessage * message, void *user_data)
35 AtkDocument *document = (AtkDocument *) user_data;
39 g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
40 droute_not_yet_handled_error (message));
41 lc = atk_document_get_locale (document);
44 reply = dbus_message_new_method_return (message);
47 dbus_message_append_args (reply, DBUS_TYPE_STRING, &lc,
54 impl_GetAttributeValue (DBusConnection * bus, DBusMessage * message,
57 AtkDocument *document = (AtkDocument *) user_data;
63 g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
64 droute_not_yet_handled_error (message));
65 dbus_error_init (&error);
66 if (!dbus_message_get_args
67 (message, &error, DBUS_TYPE_STRING, &attributename, DBUS_TYPE_INVALID))
69 return droute_invalid_arguments_error (message);
71 atr = atk_document_get_attribute_value (document, attributename);
74 reply = dbus_message_new_method_return (message);
77 dbus_message_append_args (reply, DBUS_TYPE_STRING, &atr,
84 impl_GetAttributes (DBusConnection * bus, DBusMessage * message,
87 AtkDocument *document = (AtkDocument *) user_data;
89 AtkAttributeSet *attributes;
92 g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
93 droute_not_yet_handled_error (message));
95 attributes = atk_document_get_attributes (document);
97 reply = dbus_message_new_method_return (message);
100 dbus_message_iter_init_append (reply, &iter);
101 spi_object_append_attribute_set (&iter, attributes);
105 atk_attribute_set_free (attributes);
109 static DRouteMethod methods[] = {
110 {impl_GetLocale, "GetLocale"},
111 {impl_GetAttributeValue, "GetAttributeValue"},
112 {impl_GetAttributes, "GetAttributes"},
117 spi_initialize_document (DRoutePath * path)
119 droute_path_add_interface (path,
120 SPI_DBUS_INTERFACE_DOCUMENT, spi_org_freedesktop_atspi_Document, methods, NULL);