From 2c04418795e644efafc0204656dd575844ba0976 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 23 Nov 2009 14:51:51 -0600 Subject: Connecting to a notification watcher. --- src/libcustomindicator/custom-indicator.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libcustomindicator/custom-indicator.c b/src/libcustomindicator/custom-indicator.c index 6138daf..b2d1384 100644 --- a/src/libcustomindicator/custom-indicator.c +++ b/src/libcustomindicator/custom-indicator.c @@ -11,7 +11,7 @@ #include "notification-item-server.h" #include "notification-watcher-client.h" -#include "../dbus-shared.h" +#include "dbus-shared.h" /** CustomIndicatorPrivate: @@ -93,6 +93,7 @@ static void custom_indicator_set_property (GObject * object, guint prop_id, cons static void custom_indicator_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); /* Other stuff */ static void check_connect (CustomIndicator * self); +static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data); /* GObject type */ G_DEFINE_TYPE (CustomIndicator, custom_indicator, G_TYPE_OBJECT); @@ -279,10 +280,25 @@ custom_indicator_init (CustomIndicator *self) g_error_free(error); return; } + dbus_g_connection_register_g_object(connection, "/need/a/path", G_OBJECT(self)); + priv->watcher_proxy = dbus_g_proxy_new_for_name_owner(connection, + INDICATOR_CUSTOM_DBUS_ADDR, + NOTIFICATION_WATCHER_DBUS_OBJ, + NOTIFICATION_WATCHER_DBUS_IFACE, + &error); + if (error != NULL) { + g_warning("Unable to create Ayatana Watcher proxy! %s", error->message); + /* TODO: This is where we should start looking at fallbacks */ + g_error_free(error); + return; + } + + org_ayatana_indicator_custom_NotificationWatcher_register_service_async(priv->watcher_proxy, "/need/a/path", register_service_cb, self); + return; } @@ -600,6 +616,15 @@ check_connect (CustomIndicator * self) } +static void +register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) +{ + if (error != NULL) { + g_warning("Unable to connect to the Notification Watcher: %s", error->message); + } + return; +} + /* ************************* */ /* Public Functions */ -- cgit v1.2.3