From 8b92c1c28c4d956b45aa85a31a7a201ef831fe2f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 22:15:19 -0600 Subject: Building a proxy. --- src/custom-service-appstore.c | 23 +++++++++++++++++++++-- src/dbus-shared.h | 12 +++++++++--- 2 files changed, 30 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/custom-service-appstore.c b/src/custom-service-appstore.c index 65c6b6b..5b8f7e0 100644 --- a/src/custom-service-appstore.c +++ b/src/custom-service-appstore.c @@ -15,6 +15,7 @@ static gboolean _custom_service_server_get_applications (CustomServiceAppstore * /* Private Stuff */ typedef struct _CustomServiceAppstorePrivate CustomServiceAppstorePrivate; struct _CustomServiceAppstorePrivate { + DBusGConnection * bus; GList * applications; }; @@ -85,14 +86,14 @@ custom_service_appstore_init (CustomServiceAppstore *self) priv->applications = NULL; GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + priv->bus = dbus_g_bus_get(DBUS_BUS_STARTER, &error); if (error != NULL) { g_error("Unable to get session bus: %s", error->message); g_error_free(error); return; } - dbus_g_connection_register_g_object(session_bus, + dbus_g_connection_register_g_object(priv->bus, INDICATOR_CUSTOM_DBUS_OBJ, G_OBJECT(self)); @@ -128,7 +129,25 @@ custom_service_appstore_application_add (CustomServiceAppstore * appstore, const g_return_if_fail(IS_CUSTOM_SERVICE_APPSTORE(appstore)); g_return_if_fail(dbus_name != NULL && dbus_name[0] != '\0'); g_return_if_fail(dbus_object != NULL && dbus_object[0] != '\0'); + CustomServiceAppstorePrivate * priv = CUSTOM_SERVICE_APPSTORE_GET_PRIVATE(appstore); + Application * app = g_new(Application, 1); + + app->dbus_name = g_strdup(dbus_name); + app->dbus_object = g_strdup(dbus_object); + + GError * error = NULL; + app->dbus_proxy = dbus_g_proxy_new_for_name_owner(priv->bus, + app->dbus_name, + app->dbus_object, + NOTIFICATION_ITEM_DBUS_IFACE, + &error); + if (error != NULL) { + g_warning("Unable to get notification item proxy for object '%s' on host '%s': %s", dbus_object, dbus_name, error->message); + g_error_free(error); + g_free(app); + return; + } return; } diff --git a/src/dbus-shared.h b/src/dbus-shared.h index 6cec06b..5c56e0b 100644 --- a/src/dbus-shared.h +++ b/src/dbus-shared.h @@ -1,5 +1,11 @@ -#define INDICATOR_CUSTOM_DBUS_ADDR "org.ayatana.indicator.custom" -#define INDICATOR_CUSTOM_DBUS_OBJ "/org/ayatana/indicator/custom/service" -#define INDICATOR_CUSTOM_DBUS_IFACE "org.ayatana.indicator.custom.service" +#define INDICATOR_CUSTOM_DBUS_ADDR "org.ayatana.indicator.custom" +#define INDICATOR_CUSTOM_DBUS_OBJ "/org/ayatana/indicator/custom/service" +#define INDICATOR_CUSTOM_DBUS_IFACE "org.ayatana.indicator.custom.service" + +#define NOTIFICATION_WATCHER_DBUS_OBJ "/org/ayatana/indicator/custom/NotificationWatcher" +#define NOTIFICATION_WATCHER_DBUS_IFACE "org.ayatana.indicator.custom.NotificationWatcher" + +#define NOTIFICATION_ITEM_DBUS_OBJ "/org/ayatana/indicator/custom/NotificationItem" +#define NOTIFICATION_ITEM_DBUS_IFACE "org.ayatana.indicator.custom.NotificationItem" -- cgit v1.2.3