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_hyperlink (DBusMessage * message)
30 AtkObject *obj = spi_dbus_get_object (dbus_message_get_path (message));
33 return ATK_HYPERLINK (obj);
37 get_hyperlink_from_path (const char *path, void *user_data)
39 AtkObject *obj = spi_dbus_get_object (path);
40 if (!obj || !ATK_IS_HYPERLINK(obj))
42 return ATK_HYPERLINK (obj);
46 impl_get_nAnchors (const char *path, DBusMessageIter * iter, void *user_data)
48 AtkHyperlink *link = get_hyperlink_from_path (path, user_data);
51 return droute_return_v_int32 (iter, atk_hyperlink_get_n_anchors (link));
56 impl_get_startIndex (const char *path, DBusMessageIter * iter,
59 AtkHyperlink *link = get_hyperlink_from_path (path, user_data);
62 return droute_return_v_int32 (iter, atk_hyperlink_get_start_index (link));
66 impl_get_endIndex (const char *path, DBusMessageIter * iter, void *user_data)
68 AtkHyperlink *link = get_hyperlink_from_path (path, user_data);
71 return droute_return_v_int32 (iter, atk_hyperlink_get_end_index (link));
75 impl_getObject (DBusConnection * bus, DBusMessage * message, void *user_data)
77 AtkHyperlink *link = get_hyperlink (message);
80 AtkObject *atk_object;
83 return spi_dbus_general_error (message);
84 dbus_error_init (&error);
85 if (!dbus_message_get_args
86 (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
88 return SPI_DBUS_RETURN_ERROR (message, &error);
90 atk_object = atk_hyperlink_get_object (link, i);
91 return spi_dbus_return_object (message, atk_object, FALSE);
95 impl_getURI (DBusConnection * bus, DBusMessage * message, void *user_data)
97 AtkHyperlink *link = get_hyperlink (message);
104 return spi_dbus_general_error (message);
105 dbus_error_init (&error);
106 if (!dbus_message_get_args
107 (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INT32, &i,
110 return SPI_DBUS_RETURN_ERROR (message, &error);
113 rv = atk_hyperlink_get_uri (link, i);
116 reply = dbus_message_new_method_return (message);
119 dbus_message_append_args (reply, DBUS_TYPE_STRING, &rv,
127 impl_isValid (DBusConnection * bus, DBusMessage * message, void *user_data)
129 AtkHyperlink *link = get_hyperlink (message);
134 return spi_dbus_general_error (message);
136 rv = atk_hyperlink_is_valid (link);
137 reply = dbus_message_new_method_return (message);
140 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
146 static DRouteMethod methods[] = {
147 {impl_getObject, "getObject"},
148 {impl_getURI, "getURI"},
149 {impl_isValid, "isValid"},
153 static DRouteProperty properties[] = {
154 {impl_get_nAnchors, NULL, "nAnchors"},
155 {impl_get_startIndex, NULL, "startIndex"},
156 {impl_get_endIndex, NULL, "endIndex"},
161 spi_initialize_hyperlink (DRouteData * data)
163 droute_add_interface (data, "org.freedesktop.atspi.Hyperlink",
165 (DRouteGetDatumFunction) get_hyperlink_from_path,