Back to index

dbus-test-runner  12.10.0
test-check-name.c
Go to the documentation of this file.
00001 #include <glib.h>
00002 #include <gio/gio.h>
00003 
00004 int
00005 main (int argc, char * argv[])
00006 {
00007        g_type_init();
00008 
00009        if (argc != 2) {
00010               g_error("ARG, need a single argument");
00011               return 1;
00012        }
00013 
00014        g_debug("Looking for name: %s", argv[1]);
00015 
00016        GDBusConnection * bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
00017        g_return_val_if_fail(bus != NULL, 1);
00018 
00019        GDBusProxy * proxy = g_dbus_proxy_new_sync(bus,
00020                                                   G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
00021                                                   NULL,
00022                                                   argv[1],
00023                                                   "/",
00024                                                   "org.freedesktop.DBus.Introspectable",
00025                                                   NULL, NULL); /* cancel, error */
00026        g_return_val_if_fail(proxy != NULL, 1);
00027 
00028        g_return_val_if_fail(g_dbus_proxy_get_name_owner(proxy) != NULL, 1);
00029 
00030        g_debug("Quitting");
00031 
00032        return 0;
00033 }