2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
26 * Basic SPI initialization and event loop function prototypes
33 #include <cspi/spi-private.h>
38 static DBusConnection *bus = NULL;
39 static GHashTable *apps = NULL;
40 static GHashTable *live_refs = NULL;
41 static GQueue *exception_handlers = NULL;
42 static DBusError exception;
45 cspi_object_release (gpointer value)
50 cspi_exception_throw (DBusError *error, const char *desc_prefix)
52 SPIExceptionHandler *handler = NULL;
54 if (exception_handlers) handler = g_queue_peek_head (exception_handlers);
56 ex.type = SPI_EXCEPTION_SOURCE_UNSPECIFIED;
58 ex.code = SPI_EXCEPTION_UNSPECIFIED;
60 // TODO: Fill in description
63 return (*handler) (&ex, FALSE);
65 return FALSE; /* means exception was not handled */
68 const char *spi_path_dec = SPI_DBUS_PATH_DEC;
69 const char *spi_path_registry = SPI_DBUS_PATH_REGISTRY;
70 const char *spi_bus_registry = SPI_DBUS_NAME_REGISTRY;
71 const char *spi_path_desktop = SPI_DBUS_PATH_DESKTOP;
72 const char *spi_interface_accessible = SPI_DBUS_INTERFACE_ACCESSIBLE;
73 const char *spi_interface_action = SPI_DBUS_INTERFACE_ACTION;
74 const char *spi_interface_application = SPI_DBUS_INTERFACE_APPLICATION;
75 const char *spi_interface_component = SPI_DBUS_INTERFACE_COMPONENT;
76 const char *spi_interface_dec = SPI_DBUS_INTERFACE_DEC;
77 const char *spi_interface_desktop = SPI_DBUS_INTERFACE_DESKTOP;
78 const char *spi_interface_device_event_listener = SPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER;
79 const char *spi_interface_document = SPI_DBUS_INTERFACE_DOCUMENT;
80 const char *spi_interface_editable_text = SPI_DBUS_INTERFACE_EDITABLE_TEXT;
81 const char *spi_interface_hyperlink = SPI_DBUS_INTERFACE_HYPERLINK;
82 const char *spi_interface_hypertext = SPI_DBUS_INTERFACE_HYPERTEXT;
83 const char *spi_interface_image = SPI_DBUS_INTERFACE_IMAGE;
84 const char *spi_interface_registry = SPI_DBUS_INTERFACE_REGISTRY;
85 const char *spi_interface_selection = SPI_DBUS_INTERFACE_SELECTION;
86 const char *spi_interface_table = SPI_DBUS_INTERFACE_TABLE;
87 const char *spi_interface_text = SPI_DBUS_INTERFACE_TEXT;
88 const char *spi_interface_tree = SPI_DBUS_INTERFACE_TREE;
89 const char *spi_interface_value = SPI_DBUS_INTERFACE_VALUE;
91 static const char *interfaces[] =
93 SPI_DBUS_INTERFACE_ACCESSIBLE,
94 SPI_DBUS_INTERFACE_ACTION,
95 SPI_DBUS_INTERFACE_APPLICATION,
96 SPI_DBUS_INTERFACE_COMPONENT,
97 SPI_DBUS_INTERFACE_DOCUMENT,
98 SPI_DBUS_INTERFACE_EDITABLE_TEXT,
99 SPI_DBUS_INTERFACE_HYPERLINK,
100 SPI_DBUS_INTERFACE_HYPERTEXT,
101 SPI_DBUS_INTERFACE_IMAGE,
102 "org.freedesktop.atspi.LoginHelper",
103 SPI_DBUS_INTERFACE_SELECTION,
104 "org.freedesktop.atspi.Selector",
105 SPI_DBUS_INTERFACE_TABLE,
106 SPI_DBUS_INTERFACE_TEXT,
107 SPI_DBUS_INTERFACE_VALUE,
111 static gint get_iface_num (const char *iface)
113 // TODO: Use a binary search or hash to improve performance
116 for (i = 0; interfaces[i]; i++)
118 if (!strcmp(iface, interfaces[i])) return i;
124 cspi_accessible_is_a (Accessible *accessible,
125 const char *interface_name)
129 if (accessible == NULL)
134 n = get_iface_num (interface_name);
135 if (n == -1) return FALSE;
136 return (SPIBoolean)((accessible->interfaces & (1 << n))? TRUE: FALSE);
140 cspi_get_live_refs (void)
144 live_refs = g_hash_table_new (g_direct_hash, g_direct_equal);
156 cspi_exception (void)
158 if (dbus_error_is_set (&exception))
160 dbus_error_free (&exception);
167 cspi_check_ev (const char *error_string)
169 if (dbus_error_is_set (&exception))
171 cspi_exception_throw (&exception, error_string);
178 cspi_object_add (Accessible *accessible)
180 if (accessible) cspi_object_ref (accessible);
185 cspi_object_ref (Accessible *accessible)
187 g_return_if_fail (accessible != NULL);
189 accessible->ref_count++;
190 g_hash_table_insert (live_refs, accessible, accessible);
193 #define APP_IS_REGISTRY(app) (!strcmp (app->bus_name, spi_bus_registry))
196 cspi_object_unref_internal (Accessible *accessible, gboolean defunct)
200 if (accessible == NULL)
205 if (--accessible->ref_count == 0 || (accessible->ref_count == 1 && !defunct) && g_hash_table_lookup (live_refs, accessible))
208 memset (&e, 0, sizeof(e));
209 e.type = "object:state-change:defunct";
210 e.source = accessible;
212 cspi_dispatch_event (&e);
213 g_hash_table_remove (live_refs, accessible);
215 if (accessible->ref_count == 0)
217 if (APP_IS_REGISTRY (accessible->app))
219 g_free (accessible->v.path);
226 cspi_object_unref (Accessible *accessible)
228 cspi_object_unref_internal (accessible, FALSE);
236 cspi_streams_close_all ();
242 g_hash_table_destroy (refs);
246 static gboolean SPI_inited = FALSE;
248 static GHashTable *app_hash = NULL;
251 ref_accessible (CSpiApplication *app, const char *path)
256 if (sscanf (path, "/org/freedesktop/atspi/accessible/%d", &id) != 1)
260 Accessible *a = g_hash_table_lookup (app->hash, &id);
266 id_val = g_new (guint, 1);
267 if (!id_val) return NULL;
269 a = g_new0 (Accessible, 1);
275 g_hash_table_insert (app->hash, id_val, a);
278 a->ref_count = 2; /* one for the caller, one for the hash */
282 static CSpiApplication *
283 cspi_get_application (const char *bus_name)
285 CSpiApplication *app = NULL;
290 app_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_hash_table_unref);
291 if (!app_hash) return;
293 app = g_hash_table_lookup (app_hash, bus_name);
295 bus_name_dup = g_strdup (bus_name);
296 if (!bus_name_dup) return NULL;
297 // TODO: change below to something that will send state-change:defunct notification if necessary */
298 app = g_new (CSpiApplication, 1);
299 if (!app) return NULL;
300 app->bus_name = bus_name_dup;
301 if (APP_IS_REGISTRY (app))
303 app->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, cspi_object_unref);
307 app->hash = g_hash_table_new_full (g_int_hash, g_int_equal, g_free, cspi_object_unref);
309 g_hash_table_insert (app_hash, bus_name_dup, app);
324 /* Update the cache with added/modified objects and free the array */
326 handle_additions (CSpiApplication*app, GArray *additions)
335 for (i = 0; i < additions->len; i++)
337 CACHE_ADDITION *ca = &g_array_index (additions, CACHE_ADDITION, i);
338 Accessible *a = ref_accessible (app, ca->path);
339 /* Note: children don't hold refs for their parents or vice versa */
340 a->parent = ref_accessible (app, ca->parent);
341 if (a->parent) cspi_object_unref (a->parent);
344 g_list_free (a->children);
347 for (j = 0; j < ca->children->len; j++)
349 const char *child_path = g_array_index (ca->children, const char *, j);
350 Accessible *child = ref_accessible (app, child_path);
351 new_list = g_list_append (a->children, child);
352 if (new_list) a->children = new_list;
353 cspi_object_unref (child);
356 for (j = 0; j < ca->interfaces->len; j++)
358 const char *iface = g_array_index (ca->interfaces, const char *, j);
359 if (!strcmp (iface, "org.freedesktop.DBus.Introspectable")) continue;
360 gint n = get_iface_num (iface);
363 g_warning ("Unknown interface %s", iface);
365 else a->interfaces |= (1 << n);
368 if (a->name) g_free (a->name);
371 if (a->description) g_free (a->description);
372 a->description = ca->description;
373 g_array_free (ca->interfaces, TRUE);
374 g_array_free (ca->children, TRUE);
375 /* This is a bit of a hack since ref_accessible sets ref_count to 2
376 * for a new object, one of the refs being for the cache */
377 cspi_object_unref (a);
379 g_array_free (additions, TRUE);
383 handle_removals (CSpiApplication *app, GArray *removals)
387 if (!removals) return;
388 for (j = 0; j < removals->len; j++)
390 const char *path = g_array_index (removals, const char *, j);
391 Accessible *a = ref_accessible (app, path);
392 if (a->parent && g_list_find (a->parent->children, a))
394 a->parent->children = g_list_remove (a->parent->children, a);
395 /* Note: children don't hold refs for their parents or vice versa */
397 g_hash_table_remove (app->hash, &a->v.id);
398 cspi_object_unref_internal (a, TRUE); /* unref our own ref */
400 g_array_free (removals, TRUE);
404 add_app_to_desktop (Accessible *a, const char *bus_name)
409 dbus_error_init (&error);
410 if (dbind_connection_method_call (bus, bus_name, "/org/freedesktop/atspi/tree", spi_interface_tree, "getRoot", &error, "=>o", &root_path))
412 Accessible *obj = cspi_ref_accessible (bus_name, root_path);
415 GList *new_list = g_list_append (a->children, obj);
418 a->children = new_list;
426 g_warning ("Error calling getRoot for %s: %s", bus_name, error.message);
432 send_children_changed (Accessible *parent, Accessible *child, gboolean add)
436 memset (&e, 0, sizeof(e));
437 e.type = (add? "object:children-changed:add": "object:children-changed:remove");
439 e.detail1 = g_list_index (parent->children, child);
440 cspi_dispatch_event (&e);
444 unref_object_and_children (Accessible *obj)
448 for (l = obj->children; l; l = l->next)
450 unref_object_and_children (l->data);
452 cspi_object_unref_internal (obj, TRUE);
456 remove_app_from_desktop (Accessible *a, const char *bus_name)
461 for (l = a->children; l; l = l->next)
464 if (!strcmp (bus_name, child->app->bus_name)) break;
468 g_warning ("Removing unregistered app %s; doing nothing\n", bus_name);
471 send_children_changed (a, child, FALSE);
472 a->children = g_list_remove (a->children, child);
473 unref_object_and_children (child);
477 static Accessible *desktop;
480 ref_accessible_desktop (CSpiApplication *app)
489 cspi_object_ref (desktop);
492 desktop = g_new0 (Accessible, 1);
497 g_hash_table_insert (app->hash, "", desktop);
499 desktop->ref_count = 2; /* one for the caller, one for the hash */
500 desktop->name = g_strdup ("");
501 dbus_error_init (&error);
502 if (!dbind_connection_method_call (bus, spi_bus_registry, spi_path_registry, spi_interface_registry, "getApplications", &error, "=>as", &apps))
504 g_error ("Couldn't get application list: %s", error.message);
506 for (i = 0; i < apps->len; i++)
508 const char *app_name = g_array_index (apps, char *, i);
509 if (app_name[0] == '\0')
511 g_warning ("Got empty app name");
514 CSpiApplication *app = cspi_get_application (app_name);
516 dbus_error_init (&error);
517 dbind_connection_method_call (bus, app_name, "/org/freedesktop/atspi/tree", spi_interface_tree, "getTree", &error, "=>a(ooaoassus)", &additions);
520 g_warning ("getTree (%s): %s", app_name, error.message);
522 handle_additions (app, additions);
523 add_app_to_desktop (desktop, app_name);
525 g_array_free (apps, TRUE);
530 cspi_ref_accessible (const char *app, const char *path)
532 CSpiApplication *a = cspi_get_application (app);
534 if ( APP_IS_REGISTRY(a))
536 return ref_accessible_desktop (a);
538 return ref_accessible (a, path);
542 cspi_ref_related_accessible (Accessible *obj, const char *path)
544 return ref_accessible (obj->app, path);
553 static const char *cacheSignalType = "a(ooaoassus)ao";
555 static DBusHandlerResult
556 cspi_dbus_handle_update_tree (DBusConnection *bus, DBusMessage *message, void *user_data)
558 DBusMessageIter iter;
561 const char *sender = dbus_message_get_sender (message);
562 CSpiApplication *app = cspi_get_application (sender);
563 const char *type = cacheSignalType;
567 g_warning ("UpdateTree from unknown app. Should we add it?", sender);
570 dbus_message_iter_init (message, &iter);
571 // TODO: Check signature
572 dbind_any_demarshal (&iter, &type, &p); /* additions */
573 dbind_any_demarshal (&iter, &type, &p); /* removals */
574 handle_additions (app, cd.additions);
575 handle_removals (app, cd.removals);
578 static DBusHandlerResult
579 cspi_dbus_handle_register_application (DBusConnection *bus, DBusMessage *message, void *user_data)
586 dbus_error_init (&error);
587 a = cspi_ref_accessible (spi_bus_registry, spi_path_registry);
588 if (add_app_to_desktop (a, dbus_message_get_sender (message)))
590 send_children_changed (a, g_list_last (a->children)->data, TRUE);
592 cspi_object_unref (a);
593 return DBUS_HANDLER_RESULT_HANDLED;
596 static DBusHandlerResult
597 cspi_dbus_handle_deregister_application (DBusConnection *bus, DBusMessage *message, void *user_data)
603 dbus_error_init (&error);
604 if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &bus_name, DBUS_TYPE_INVALID))
606 g_warning ("Error processing %s: %s\n", dbus_message_get_member(message), error.message);
607 dbus_error_free (&error);
608 return DBUS_HANDLER_RESULT_HANDLED;
611 a = cspi_ref_accessible (spi_bus_registry, spi_path_registry);
612 remove_app_from_desktop (a, bus_name);
613 cspi_object_unref (a);
614 return DBUS_HANDLER_RESULT_HANDLED;
618 static DBusHandlerResult
619 cspi_dbus_filter (DBusConnection *bus, DBusMessage *message, void *data)
621 int type = dbus_message_get_type (message);
622 const char *interface = dbus_message_get_interface (message);
623 const char *member = dbus_message_get_member (message);
627 if (type == DBUS_MESSAGE_TYPE_SIGNAL &&
628 !strcmp (interface, SPI_DBUS_INTERFACE_ACCESSIBLE))
630 return cspi_dbus_handle_event (bus, message, data);
632 if (dbus_message_is_method_call (message, spi_interface_device_event_listener, "notifyEvent"))
634 return cspi_dbus_handle_deviceEvent (bus, message, data);
636 if (dbus_message_is_signal (message, spi_interface_tree, "updateTree"))
638 return cspi_dbus_handle_update_tree (bus, message, data);
640 if (dbus_message_is_signal (message, spi_interface_tree, "registerApplication"))
642 return cspi_dbus_handle_register_application (bus, message, data);
644 if (dbus_message_is_signal (message, spi_interface_registry, "deregisterApplication"))
646 return cspi_dbus_handle_deregister_application (bus, message, data);
648 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
654 * Connects to the accessibility registry and initializes the SPI.
656 * Returns: 0 on success, otherwise an integer error code.
673 cspi_get_live_refs();
674 g_atexit (cspi_cleanup);
676 dbus_error_init (&error);
677 bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
680 g_error ("Couldn't get session bus");
683 dbus_bus_register (bus, &error);
684 dbus_connection_setup_with_g_main(bus, g_main_context_default());
685 dbus_connection_add_filter (bus, cspi_dbus_filter, NULL, NULL);
686 match = g_strdup_printf ("type='signal',interface='%s',member='updateTree'", spi_interface_tree);
687 dbus_error_init (&error);
688 dbus_bus_add_match (bus, match, &error);
690 match = g_strdup_printf ("type='signal',interface='%s'", spi_interface_tree);
691 dbus_bus_add_match (bus, match, &error);
696 static GMainLoop *mainloop;
701 * Starts/enters the main event loop for the SPI services.
703 * (NOTE: This method does not return control, it is exited via a call to
704 * SPI_event_quit () from within an event handler).
708 SPI_event_main (void)
711 mainloop = g_main_loop_new (NULL, FALSE);
712 g_main_loop_run (mainloop);
718 * Quits the last main event loop for the SPI services,
722 SPI_event_quit (void)
724 g_main_loop_quit (mainloop);
730 * Checks to see if an SPI event is waiting in the event queue.
731 * Used by clients that don't wish to use SPI_event_main().
733 * Not Yet Implemented.
735 * Returns: #TRUE if an event is waiting, otherwise #FALSE.
739 SPI_eventIsReady (void)
746 * @waitForEvent: a #SPIBoolean indicating whether to block or not.
748 * Gets the next event in the SPI event queue; blocks if no event
749 * is pending and @waitForEvent is #TRUE.
750 * Used by clients that don't wish to use SPI_event_main().
752 * Not Yet Implemented.
754 * Returns: the next #AccessibleEvent in the SPI event queue.
757 SPI_nextEvent (SPIBoolean waitForEvent)
764 report_leaked_ref (gpointer key, gpointer val, gpointer user_data)
767 Accessible *a = (Accessible *) val;
769 name = Accessible_getName (a);
770 if (cspi_exception ())
775 role = Accessible_getRoleName (a);
776 if (cspi_exception ())
781 fprintf (stderr, "leaked %d references to object %s, role %s %p\n",
782 a->ref_count, name ? name : "<?>", role ? role : "<?>", a);
784 SPI_freeString (name);
791 * Disconnects from the Accessibility Registry and releases
792 * any floating resources. Call only once at exit.
794 * Returns: 0 if there were no leaks, otherwise non zero.
810 leaked = g_hash_table_size (live_refs);
812 fprintf (stderr, "Leaked %d SPI handles\n", leaked);
816 g_hash_table_foreach (live_refs, report_leaked_ref, NULL);
833 * @s: a character string returned from another at-spi call.
835 * Free a character string returned from an at-spi call. Clients of
836 * at-spi should use this function instead of free () or g_free().
837 * A NULL string @s will be silently ignored.
838 * This API should not be used to free strings
839 * from other libraries or allocated by the client.
842 SPI_freeString (char *s)
852 * @r: a pointer to an SPIRect returned from another at-spi call.
854 * Free a SPIRect structure returned from an at-spi call. Clients of
855 * at-spi should use this function instead of free () or g_free().
856 * A NULL rect @r will be silently ignored.
857 * This API should not be used to free data
858 * from other libraries or allocated by the client.
863 SPI_freeRect (SPIRect *r)
867 /* err, okay, in this case the client _could_
868 have called g_free, but we don't want to guarantee it */
875 * @s: a UTF-8 string to be duplicated
879 * Returns: a duplicate of the string passed as a parameter, which should
880 * be freed via SPI_freeString after use.
883 SPI_dupString (char *s)
894 * SPI_exceptionHandlerPush:
895 * @handler: an #SPIExceptionHandler to install as the first code to deal with exceptions.
897 * Install a client-side handler for #SPIException instances, which can see and handle any
898 * exceptions before chaining them to the next exception handler in the stack.
902 * Returns %TRUE if the result succeeded, %FALSE if @hander could not be registered.
904 SPIBoolean SPI_exceptionHandlerPush (SPIExceptionHandler *handler)
906 if (!exception_handlers)
907 exception_handlers = g_queue_new ();
908 g_queue_push_head (exception_handlers, handler);
913 * SPI_exceptionHandlerPop:
915 * Remove/pop an #SPIExceptionHandler off the error handler stack and return the new handler.
919 * Returns the #SPIExceptionHandler which is now at the top of the error handler stack after the call.
921 SPIExceptionHandler* SPI_exceptionHandlerPop (void)
923 return (SPIExceptionHandler *) g_queue_pop_head (exception_handlers);
927 * SPIException_getSourceType:
928 * @err: the exception being queried
930 * Get the #SPIExceptionType of an exception which has been thrown.
934 * Returns: the #SPIExceptionType corresponding to exception @err.
936 SPIExceptionType SPIException_getSourceType (SPIException *err)
941 return SPI_EXCEPTION_SOURCE_UNSPECIFIED;
945 * SPIException_getExceptionCode:
946 * @err: the #SPIException being queried.
948 * Get the #SPIExceptionCode telling what type of exception condition has occurred.
952 * Returns: the #SPIExceptionCode corresponding to exception @err.
954 SPIExceptionCode SPIException_getExceptionCode (SPIException *err)
960 * SPIAccessibleException_getSource:
961 * @err: the #SPIException being queried.
963 * Get the identity of the object which threw an exception.
967 * Returns: a pointer to the #Accessible object which threw the exception.
969 Accessible* SPIAccessibleException_getSource (SPIException *err)
971 if (err->type == SPI_EXCEPTION_SOURCE_ACCESSIBLE)
972 cspi_object_ref (err->source);
978 * SPIException_getDescription:
979 * @err: the #SPIException being queried.
981 * Get a text description of the exception that has been thrown.
982 * Unfortunately these descriptions tend to be terse and limited in
983 * the detail which they can provide.
985 * Returns: a brief character string describing the exception.
987 char* SPIException_getDescription (SPIException *err)
989 /* TODO: friendlier error messages? */
991 return err->error->message;
996 get_path (Accessible *obj)
998 if (APP_IS_REGISTRY (obj->app))
1000 return g_strdup_printf (SPI_DBUS_PATH_REGISTRY);
1002 return g_strdup_printf ("/org/freedesktop/atspi/accessible/%d", obj->v.id);
1006 cspi_dbus_call (Accessible *obj, const char *interface, const char *method, DBusError *error, const char *type, ...)
1009 char *path = get_path (obj);
1013 if (!error) error = &err;
1014 dbus_error_init (error);
1015 va_start (args, type);
1016 retval = dbind_connection_method_call_va (SPI_bus(), obj->app->bus_name, path, interface, method, error, type, args);
1019 if (dbus_error_is_set (error))
1021 if (!dbus_error_is_set (&exception))
1023 // TODO: Should we call cspi_exception_throw?
1024 dbus_move_error (error, &exception);
1026 else if (error == &err) dbus_error_free (error);
1032 cspi_dbus_get_property (Accessible *obj, const char *interface, const char *name, DBusError *error, const char *type, void *data)
1034 DBusMessage *message, *reply;
1035 char *path = get_path (obj);
1036 DBusMessageIter iter, iter_variant;
1038 dbus_bool_t retval = FALSE;
1040 message = dbus_message_new_method_call (obj->app->bus_name, path, "org.freedesktop.DBus.Properties", "Get");
1043 // TODO: throw exception
1046 dbus_message_append_args (message, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID);
1047 if (!error) error = &err;
1048 dbus_error_init (error);
1049 reply = dbus_connection_send_with_reply_and_block (SPI_bus(), message, 1000, error);
1050 dbus_message_unref (message);
1053 // TODO: throw exception
1056 dbus_message_iter_init (reply, &iter);
1057 dbus_message_iter_recurse (&iter, &iter_variant);
1058 if (dbus_message_iter_get_arg_type (&iter_variant) != type[0])
1060 g_warning ("cspi_dbus_get_property: Wrong type: expected %s, got %c\n", type, dbus_message_iter_get_arg_type (&iter_variant));
1063 dbus_message_iter_get_basic (&iter_variant, data);
1064 dbus_message_unref (reply);
1065 if (type[0] == 's') *(char **)data = g_strdup (*(char **)data);