From 342660113458cdcd2c19421733701aba335774eb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 25 May 2009 00:35:41 +0200 Subject: Requesting a name on the bus --- tests/test-gtk-label-server.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/test-gtk-label-server.c') diff --git a/tests/test-gtk-label-server.c b/tests/test-gtk-label-server.c index 477f951..0e395d4 100644 --- a/tests/test-gtk-label-server.c +++ b/tests/test-gtk-label-server.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -68,8 +69,23 @@ main (int argc, char ** argv) { g_type_init(); + DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); + DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); + GError * error = NULL; + guint nameret = 0; + + if (!org_freedesktop_DBus_request_name(bus_proxy, "glib.label.test", 0, &nameret, &error)) { + g_error("Unable to call to request name"); + return 1; + } + + if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + g_error("Unable to get name"); + return 1; + } + server = dbusmenu_server_new("/org/test"); timer_func(NULL); -- cgit v1.2.3