From d2bd9a0a70bbcb73997561baa7a61ddbe7e4780a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 27 May 2009 10:44:37 +0200 Subject: Getting a name, and grabbing it, and loving it... --- src/indicator-service.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/indicator-service.c b/src/indicator-service.c index 467ef3a..77d42e6 100644 --- a/src/indicator-service.c +++ b/src/indicator-service.c @@ -21,6 +21,7 @@ with this program. If not, see . */ #include +#include #include #include @@ -469,6 +470,21 @@ main (int argc, char ** argv) { g_type_init(); + DBusGConnection * 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, INDICATOR_MESSAGES_DBUS_NAME, 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; + } + listener = indicate_listener_ref_default(); serverList = NULL; -- cgit v1.2.3