2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2008 Codethink Ltd.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 #include <accessible.h>
26 #include <droute/droute.h>
27 #include <droute/introspect-loader.h>
30 * This file contains an implementation of the D-Bus introspectable interface.
35 * This function finds the names of each interface that the ATK object supports
36 * and appends the introspection XML for each interface.
39 impl_introspect (DBusConnection *bus, DBusMessage *message,
49 path = dbus_message_get_path(message);
50 object = spi_dbus_get_object(path);
52 output = g_string_new(spi_introspection_header);
54 g_string_append_printf(output, spi_introspection_node_element, path);
56 spi_append_interface(output, SPI_DBUS_INTERFACE_ACCESSIBLE);
58 if (ATK_IS_ACTION (object))
59 spi_append_interface(output, SPI_DBUS_INTERFACE_ACTION);
61 if (ATK_IS_COMPONENT (object))
62 spi_append_interface(output, SPI_DBUS_INTERFACE_COMPONENT);
64 if (ATK_IS_EDITABLE_TEXT (object))
65 spi_append_interface(output, SPI_DBUS_INTERFACE_EDITABLE_TEXT);
67 if (ATK_IS_TEXT (object))
68 spi_append_interface(output, SPI_DBUS_INTERFACE_TEXT);
70 if (ATK_IS_HYPERTEXT (object))
71 spi_append_interface(output, SPI_DBUS_INTERFACE_HYPERTEXT);
73 if (ATK_IS_IMAGE (object))
74 spi_append_interface(output, SPI_DBUS_INTERFACE_IMAGE);
76 if (ATK_IS_SELECTION (object))
77 spi_append_interface(output, SPI_DBUS_INTERFACE_SELECTION);
79 if (ATK_IS_TABLE (object))
80 spi_append_interface(output, SPI_DBUS_INTERFACE_TABLE);
82 if (ATK_IS_VALUE (object))
83 spi_append_interface(output, SPI_DBUS_INTERFACE_VALUE);
85 if (ATK_IS_STREAMABLE_CONTENT (object))
86 spi_append_interface(output, "org.freedesktop.atspi.StreamableContent");
88 if (ATK_IS_DOCUMENT (object))
90 spi_append_interface(output, "org.freedesktop.atspi.Collection");
91 spi_append_interface(output, SPI_DBUS_INTERFACE_DOCUMENT);
94 if (ATK_IS_HYPERLINK_IMPL (object))
95 spi_append_interface(output, SPI_DBUS_INTERFACE_HYPERLINK);
97 g_string_append(output, spi_introspection_footer);
98 final = g_string_free(output, FALSE);
100 reply = dbus_message_new_method_return (message);
101 g_assert(reply != NULL);
102 dbus_message_append_args(reply, DBUS_TYPE_STRING, &final,
109 static DRouteMethod methods[] = {
110 {impl_introspect, "Introspect"},
115 * Adds the introspectable interface to the DRoute object provided
118 spi_initialize_introspectable (DRouteData *data, DRouteGetDatumFunction verify_object)
120 droute_add_interface (data, "org.freedesktop.DBus.Introspectable",
122 verify_object, NULL);