Add doc files to dist and fix version number in NEWS.
[mmediamanager.git] / test / clients / test-dbus-client.c
blob81d6bab485406c77e160ee7c5d14135abdc1c8d5
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);
43 goto out;
46 for (i = 0; i < G_N_ELEMENTS (names); i++) {
47 g_print ("app: %s on path %s\n", names[i], paths[i]);
50 out:
51 return 0;