aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-05-25 00:35:41 +0200
committerTed Gould <ted@canonical.com>2009-05-25 00:35:41 +0200
commit342660113458cdcd2c19421733701aba335774eb (patch)
tree346cc4a648df221fa426a15c20728652fb343b7f
parent8d10e66c11d3708a72e9c5f6ba79632e6fcc1b8f (diff)
downloadlibdbusmenu-342660113458cdcd2c19421733701aba335774eb.tar.gz
libdbusmenu-342660113458cdcd2c19421733701aba335774eb.tar.bz2
libdbusmenu-342660113458cdcd2c19421733701aba335774eb.zip
Requesting a name on the bus
-rw-r--r--tests/test-gtk-label-server.c16
1 files changed, 16 insertions, 0 deletions
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 <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib-bindings.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
@@ -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);