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 "accessible-marshaller.h"
29 #include "spi-common/spi-dbus.h"
32 impl_get_nAnchors (DBusMessageIter * iter, void *user_data)
34 AtkHyperlink *link = (AtkHyperlink *) user_data;
35 g_return_val_if_fail (ATK_IS_HYPERLINK (user_data), FALSE);
36 return droute_return_v_int32 (iter, atk_hyperlink_get_n_anchors (link));
41 impl_get_startIndex (DBusMessageIter * iter,
44 AtkHyperlink *link = (AtkHyperlink *) user_data;
45 g_return_val_if_fail (ATK_IS_HYPERLINK (user_data), FALSE);
46 return droute_return_v_int32 (iter, atk_hyperlink_get_start_index (link));
50 impl_get_endIndex (DBusMessageIter * iter, void *user_data)
52 AtkHyperlink *link = (AtkHyperlink *) user_data;
53 g_return_val_if_fail (ATK_IS_HYPERLINK (user_data), FALSE);
54 return droute_return_v_int32 (iter, atk_hyperlink_get_end_index (link));
58 impl_getObject (DBusConnection * bus, DBusMessage * message, void *user_data)
60 AtkHyperlink *link = (AtkHyperlink *) user_data;
63 AtkObject *atk_object;
65 g_return_val_if_fail (ATK_IS_HYPERLINK (user_data),
66 droute_not_yet_handled_error (message));
67 dbus_error_init (&error);
68 if (!dbus_message_get_args
69 (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
71 return SPI_DBUS_RETURN_ERROR (message, &error);
73 atk_object = atk_hyperlink_get_object (link, i);
74 return spi_dbus_return_object (message, atk_object, FALSE);
78 impl_getURI (DBusConnection * bus, DBusMessage * message, void *user_data)
80 AtkHyperlink *link = (AtkHyperlink *) user_data;
86 g_return_val_if_fail (ATK_IS_HYPERLINK (user_data),
87 droute_not_yet_handled_error (message));
88 dbus_error_init (&error);
89 if (!dbus_message_get_args
90 (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INT32, &i,
93 return SPI_DBUS_RETURN_ERROR (message, &error);
96 rv = atk_hyperlink_get_uri (link, i);
99 reply = dbus_message_new_method_return (message);
102 dbus_message_append_args (reply, DBUS_TYPE_STRING, &rv,
110 impl_isValid (DBusConnection * bus, DBusMessage * message, void *user_data)
112 AtkHyperlink *link = (AtkHyperlink *) user_data;
116 g_return_val_if_fail (ATK_IS_HYPERLINK (user_data),
117 droute_not_yet_handled_error (message));
119 rv = atk_hyperlink_is_valid (link);
120 reply = dbus_message_new_method_return (message);
123 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
129 static DRouteMethod methods[] = {
130 {impl_getObject, "getObject"},
131 {impl_getURI, "getURI"},
132 {impl_isValid, "isValid"},
136 static DRouteProperty properties[] = {
137 {impl_get_nAnchors, NULL, "nAnchors"},
138 {impl_get_startIndex, NULL, "startIndex"},
139 {impl_get_endIndex, NULL, "endIndex"},
144 spi_initialize_hyperlink (DRoutePath *path)
146 droute_path_add_interface (path,
147 SPI_DBUS_INTERFACE_HYPERLINK,