2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2008 Novell, Inc.
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.
27 #include "droute-variant.h"
29 /*---------------------------------------------------------------------------*/
32 droute_return_v_int32 (DBusMessageIter *iter, dbus_int32_t val)
36 if (!dbus_message_iter_open_container
37 (iter, DBUS_TYPE_VARIANT, DBUS_TYPE_INT32_AS_STRING, &sub))
41 dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &val);
42 dbus_message_iter_close_container (iter, &sub);
47 droute_return_v_double (DBusMessageIter *iter, double val)
51 if (!dbus_message_iter_open_container
52 (iter, DBUS_TYPE_VARIANT, DBUS_TYPE_DOUBLE_AS_STRING, &sub))
56 dbus_message_iter_append_basic (&sub, DBUS_TYPE_DOUBLE, &val);
57 dbus_message_iter_close_container (iter, &sub);
62 droute_return_v_string (DBusMessageIter *iter, const char *val)
68 if (!g_utf8_validate (val, -1, NULL))
70 g_warning ("droute: Received bad UTF-8 string");
74 if (!dbus_message_iter_open_container
75 (iter, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &sub))
79 dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING, &val);
80 dbus_message_iter_close_container (iter, &sub);
85 droute_return_v_object (DBusMessageIter *iter, const char *path)
89 if (!dbus_message_iter_open_container
90 (iter, DBUS_TYPE_VARIANT, DBUS_TYPE_OBJECT_PATH_AS_STRING, &sub))
94 dbus_message_iter_append_basic (&sub, DBUS_TYPE_OBJECT_PATH, &path);
95 dbus_message_iter_close_container (iter, &sub);
99 /*---------------------------------------------------------------------------*/
102 droute_get_v_int32 (DBusMessageIter *iter)
107 // TODO- ensure we have the correct type
108 dbus_message_iter_recurse (iter, &sub);
109 dbus_message_iter_get_basic (&sub, &rv);
114 droute_get_v_string (DBusMessageIter *iter)
119 // TODO- ensure we have the correct type
120 dbus_message_iter_recurse (iter, &sub);
121 dbus_message_iter_get_basic (&sub, &rv);
125 /*END------------------------------------------------------------------------*/