diff options
author | Ted Gould <ted@gould.cx> | 2011-01-14 13:20:33 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-01-14 13:20:33 -0600 |
commit | 490cde29b6d70c7abad6b6ff90609e64fd2af409 (patch) | |
tree | 3562be30ef3f6237a69aefa222ca9bf38b68d7f7 /src | |
parent | 26ceab5a8b4e80711f5cd7ed0bda4a28f3113429 (diff) | |
download | ayatana-indicator-messages-490cde29b6d70c7abad6b6ff90609e64fd2af409.tar.gz ayatana-indicator-messages-490cde29b6d70c7abad6b6ff90609e64fd2af409.tar.bz2 ayatana-indicator-messages-490cde29b6d70c7abad6b6ff90609e64fd2af409.zip |
Get the connection in the cool new style
Diffstat (limited to 'src')
-rw-r--r-- | src/messages-service-dbus.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/messages-service-dbus.c b/src/messages-service-dbus.c index 6ed6678..aeda625 100644 --- a/src/messages-service-dbus.c +++ b/src/messages-service-dbus.c @@ -111,12 +111,40 @@ message_service_dbus_class_init (MessageServiceDbusClass *klass) } static void +connection_cb (GObject * object, GAsyncResult * res, gpointer user_data) +{ + GError * error = NULL; + GDBusConnection * connection = g_bus_get_finish(res, &error); + + if (error != NULL) { + g_error("Unable to connect to the session bus: %s", error->message); + g_error_free(error); + return; + } + + g_dbus_connection_register_object(connection, + INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT, + bus_interface_info, + bus_vtable, + user_data, + NULL, /* destroy */ + &error); + + if (error != NULL) { + g_error("Unable to register on session bus: %s", error->message); + g_error_free(error); + return; + } + + g_debug("Service on session bus"); + + return; +} + +static void message_service_dbus_init (MessageServiceDbus *self) { - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - dbus_g_connection_register_g_object(connection, - INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT, - G_OBJECT(self)); + g_bus_get(G_BUS_TYPE_SESSION, NULL, connection_cb, self); MessageServiceDbusPrivate * priv = MESSAGE_SERVICE_DBUS_GET_PRIVATE(self); |