diff options
author | Ted Gould <ted@canonical.com> | 2009-11-23 14:51:51 -0600 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-11-23 14:51:51 -0600 |
commit | 2c04418795e644efafc0204656dd575844ba0976 (patch) | |
tree | 396a67f7fcbeb4e8264edc9a1fa2e97a3b0f0ceb /src/libcustomindicator | |
parent | 9a4835415f4df9b906a4d489245b0aecab43c09d (diff) | |
download | libayatana-appindicator-2c04418795e644efafc0204656dd575844ba0976.tar.gz libayatana-appindicator-2c04418795e644efafc0204656dd575844ba0976.tar.bz2 libayatana-appindicator-2c04418795e644efafc0204656dd575844ba0976.zip |
Connecting to a notification watcher.
Diffstat (limited to 'src/libcustomindicator')
-rw-r--r-- | src/libcustomindicator/custom-indicator.c | 27 |
1 files changed, 26 insertions, 1 deletions
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 */ |