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.
25 #include "accessible.h"
28 get_hypertext (DBusMessage * message)
30 AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message));
33 return ATK_HYPERTEXT (obj);
37 get_hypertext_from_path (const char *path, void *user_data)
39 AtkObject *obj = spi_dbus_get_object (path);
40 if (!obj || !ATK_IS_HYPERTEXT(obj))
42 return ATK_HYPERTEXT (obj);
46 impl_getNLinks (DBusConnection * bus, DBusMessage * message, void *user_data)
48 AtkHypertext *hypertext = get_hypertext (message);
53 return spi_dbus_general_error (message);
54 rv = atk_hypertext_get_n_links (hypertext);
55 reply = dbus_message_new_method_return (message);
58 dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv,
65 impl_getLink (DBusConnection * bus, DBusMessage * message, void *user_data)
67 AtkHypertext *hypertext = get_hypertext (message);
69 dbus_int32_t linkIndex;
73 return spi_dbus_general_error (message);
74 dbus_error_init (&error);
75 if (!dbus_message_get_args
76 (message, &error, DBUS_TYPE_INT32, &linkIndex, DBUS_TYPE_INVALID))
78 return SPI_DBUS_RETURN_ERROR (message, &error);
80 link = atk_hypertext_get_link (hypertext, linkIndex);
81 return spi_dbus_return_object (message, ATK_OBJECT (link), FALSE);
85 impl_getLinkIndex (DBusConnection * bus, DBusMessage * message,
88 AtkHypertext *hypertext = get_hypertext (message);
90 dbus_int32_t characterIndex;
95 return spi_dbus_general_error (message);
96 dbus_error_init (&error);
97 if (!dbus_message_get_args
98 (message, &error, DBUS_TYPE_INT32, &characterIndex, DBUS_TYPE_INVALID))
100 return SPI_DBUS_RETURN_ERROR (message, &error);
102 rv = atk_hypertext_get_link_index (hypertext, characterIndex);
103 reply = dbus_message_new_method_return (message);
106 dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv,
112 static DRouteMethod methods[] = {
113 {impl_getNLinks, "getNLinks"},
114 {impl_getLink, "getLink"},
115 {impl_getLinkIndex, "getLinkIndex"},
120 spi_initialize_hypertext (DRouteData * data)
122 droute_add_interface (data, "org.freedesktop.atspi.Hypertext",
124 (DRouteGetDatumFunction) get_hypertext_from_path,