Update the DBus manager and the tests to send/return names and paths
[mmediamanager.git] / test / clients / test-dbus-client.c
blobcfef1271012217546d14fe61241594c7159d22d4
1 #include <glib.h>
2 #include <glib-object.h>
3 #include <dbus/dbus-glib.h>
5 int main (int argc, char **argv)
7 DBusGProxy *proxy;
8 DBusGConnection *connection;
9 GError *error = NULL;
10 char **names, **paths = NULL;
11 char *app;
12 gboolean res;
13 int i;
15 g_type_init ();
17 connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
18 if (!connection) {
19 g_warning ("Error getting connection to the bus");
20 g_error_free (error);
21 return 0;
23 proxy = dbus_g_proxy_new_for_name (connection,
24 "org.gnome.MediaManager",
25 "/org/gnome/MediaManager/Manager",
26 "org.gnome.MediaManager.Manager");
27 if (!proxy) {
28 g_warning ("Error creating proxy");
29 g_error_free (error);
30 return 0;
32 res = dbus_g_proxy_call (proxy,
33 "GetRegisteredApps", &error,
34 G_TYPE_INVALID,
35 G_TYPE_STRV,
36 &names,
37 G_TYPE_STRV,
38 &paths,
39 G_TYPE_INVALID);
40 if (!res) {
41 g_warning ("error while calling GetRegisteredApps %s", error->message);
42 g_error_free (error);
45 for (i = 0; i < G_N_ELEMENTS (names); i++) {
46 g_print ("app: %s on path %s\n", names[i], paths[i]);
49 return 0;