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.
28 #include <droute/droute.h>
30 #include "spi-common/spi-dbus.h"
33 impl_get_minimumValue (DBusMessageIter * iter,
36 AtkValue *value = (AtkValue *) user_data;
41 g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
43 atk_value_get_minimum_value (value, &src);
44 g_value_init (&dest, G_TYPE_DOUBLE);
46 if (g_value_transform (&src, &dest))
48 dub = g_value_get_double (&dest);
49 return droute_return_v_double (iter, dub);
58 impl_get_maximumValue (DBusMessageIter * iter,
61 AtkValue *value = (AtkValue *) user_data;
66 g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
68 atk_value_get_maximum_value (value, &src);
69 g_value_init (&dest, G_TYPE_DOUBLE);
71 if (g_value_transform (&src, &dest))
73 dub = g_value_get_double (&dest);
74 return droute_return_v_double (iter, dub);
83 impl_get_minimumIncrement (DBusMessageIter * iter,
86 AtkValue *value = (AtkValue *) user_data;
91 g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
93 atk_value_get_minimum_increment (value, &src);
94 g_value_init (&dest, G_TYPE_DOUBLE);
96 if (g_value_transform (&src, &dest))
98 dub = g_value_get_double (&dest);
99 return droute_return_v_double (iter, dub);
108 impl_get_currentValue (DBusMessageIter * iter,
111 AtkValue *value = (AtkValue *) user_data;
116 g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
118 atk_value_get_current_value (value, &src);
119 g_value_init (&dest, G_TYPE_DOUBLE);
121 if (g_value_transform (&src, &dest))
123 dub = g_value_get_double (&dest);
124 return droute_return_v_double (iter, dub);
133 impl_set_currentValue (DBusMessageIter * iter,
136 AtkValue *value = (AtkValue *) user_data;
140 DBusMessageIter iter_variant;
142 g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
144 dbus_message_iter_recurse (iter, &iter_variant);
145 if (dbus_message_iter_get_arg_type (&iter_variant) != DBUS_TYPE_DOUBLE)
147 G_WARNING ("TODO: Support setting value from a non-double");
150 dbus_message_iter_get_basic (&iter_variant, &dub);
151 g_value_init (&src, G_TYPE_DOUBLE);
152 g_value_set_double (&src, dub);
154 atk_value_get_current_value (value, &dest);
156 if (g_value_transform (&src, &dest))
158 atk_value_set_current_value (value, &dest);
167 static DRouteProperty properties[] = {
168 {impl_get_minimumValue, NULL, "minimumValue"},
169 {impl_get_maximumValue, NULL, "maximumValue"},
170 {impl_get_minimumIncrement, NULL, "minimumIncrement"},
171 {impl_get_currentValue, impl_set_currentValue, "currentValue"},
176 spi_initialize_value (DRoutePath *path)
178 droute_path_add_interface (path,
179 SPI_DBUS_INTERFACE_VALUE,