diff options
Diffstat (limited to 'src/libcustomindicator/custom-indicator.c')
-rw-r--r-- | src/libcustomindicator/custom-indicator.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libcustomindicator/custom-indicator.c b/src/libcustomindicator/custom-indicator.c index 639d304..6ade629 100644 --- a/src/libcustomindicator/custom-indicator.c +++ b/src/libcustomindicator/custom-indicator.c @@ -11,6 +11,8 @@ #include "notification-item-server.h" #include "notification-watcher-client.h" +#include "dbus-shared.h" + /** CustomIndicatorPrivate: @id: The ID of the indicator. Maps to CustomIndicator::id. @@ -91,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); @@ -276,10 +279,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; } @@ -593,6 +611,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 */ |