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 if (ATK_IS_ACTION (object))
57 spi_append_interface(output, "org.freedesktop.atspi.Action");
59 if (ATK_IS_COMPONENT (object))
60 spi_append_interface(output, "org.freedesktop.atspi.Component");
62 if (ATK_IS_EDITABLE_TEXT (object))
63 spi_append_interface(output, "org.freedesktop.atspi.EditableText");
64 else if (ATK_IS_TEXT (object))
65 spi_append_interface(output, "org.freedesktop.atspi.Text");
67 if (ATK_IS_HYPERTEXT (object))
68 spi_append_interface(output, "org.freedesktop.atspi.Hypertext");
70 if (ATK_IS_IMAGE (object))
71 spi_append_interface(output, "org.freedesktop.atspi.Image");
73 if (ATK_IS_SELECTION (object))
74 spi_append_interface(output, "org.freedesktop.atspi.Selection");
76 if (ATK_IS_TABLE (object))
77 spi_append_interface(output, "org.freedesktop.atspi.Table");
79 if (ATK_IS_VALUE (object))
80 spi_append_interface(output, "org.freedesktop.atspi.Value");
82 if (ATK_IS_STREAMABLE_CONTENT (object))
83 spi_append_interface(output, "org.freedesktop.atspi.StreamableContent");
85 if (ATK_IS_DOCUMENT (object))
87 spi_append_interface(output, "org.freedesktop.atspi.Collection");
88 spi_append_interface(output, "org.freedesktop.atspi.Document");
91 if (ATK_IS_HYPERLINK_IMPL (object))
92 spi_append_interface(output, "org.freedesktop.atspi.Hyperlink");
94 g_string_append(output, spi_introspection_footer);
95 final = g_string_free(output, FALSE);
97 reply = dbus_message_new_method_return (message);
98 g_assert(reply != NULL);
99 dbus_message_append_args(reply, DBUS_TYPE_STRING, &final,
106 static DRouteMethod methods[] = {
107 {impl_introspect, "Introspect"},
112 * Adds the introspectable interface to the DRoute object provided
115 spi_initialize_introspectable (DRouteData *data, DRouteGetDatumFunction verify_object)
117 droute_add_interface (data, "org.freedesktop.atspi.Introspectable",
119 verify_object, NULL);