From fa2ac0047468678ee0bd6cf8e03731bbfdd98dd3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 17:05:28 -0600 Subject: Moving the watcher stuff to the new object. --- src/custom-service-appstore.c | 48 --------------------------------- src/custom-service-watcher.c | 63 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/custom-service-appstore.c b/src/custom-service-appstore.c index 02d7927..493d4f4 100644 --- a/src/custom-service-appstore.c +++ b/src/custom-service-appstore.c @@ -10,14 +10,7 @@ /* DBus Prototypes */ static gboolean _custom_service_server_get_applications (CustomServiceAppstore * appstore, GArray ** apps); -static gboolean _notification_watcher_server_register_service (CustomServiceAppstore * appstore, const gchar * service, DBusGMethodInvocation * method); -static gboolean _notification_watcher_server_registered_services (CustomServiceAppstore * appstore, GArray ** apps); -static gboolean _notification_watcher_server_protocol_version (CustomServiceAppstore * appstore, char ** version); -static gboolean _notification_watcher_server_register_notification_host (CustomServiceAppstore * appstore, const gchar * host); -static gboolean _notification_watcher_server_is_notification_host_registered (CustomServiceAppstore * appstore, gboolean * haveHost); - #include "custom-service-server.h" -#include "notification-watcher-server.h" /* Private Stuff */ typedef struct _CustomServiceAppstorePrivate CustomServiceAppstorePrivate; @@ -71,8 +64,6 @@ custom_service_appstore_class_init (CustomServiceAppstoreClass *klass) G_TYPE_NONE, 1, G_TYPE_INT, G_TYPE_NONE); - dbus_g_object_type_install_info(CUSTOM_SERVICE_APPSTORE_TYPE, - &dbus_glib__notification_watcher_server_object_info); dbus_g_object_type_install_info(CUSTOM_SERVICE_APPSTORE_TYPE, &dbus_glib__custom_service_server_object_info); @@ -121,42 +112,3 @@ _custom_service_server_get_applications (CustomServiceAppstore * appstore, GArra return FALSE; } - -static gboolean -_notification_watcher_server_register_service (CustomServiceAppstore * appstore, const gchar * service, DBusGMethodInvocation * method) -{ - - - - dbus_g_method_return(method, G_TYPE_NONE); - return TRUE; -} - -static gboolean -_notification_watcher_server_registered_services (CustomServiceAppstore * appstore, GArray ** apps) -{ - - return FALSE; -} - -static gboolean -_notification_watcher_server_protocol_version (CustomServiceAppstore * appstore, char ** version) -{ - *version = g_strdup("Ayatana Version 1"); - return TRUE; -} - -static gboolean -_notification_watcher_server_register_notification_host (CustomServiceAppstore * appstore, const gchar * host) -{ - - return FALSE; -} - -static gboolean -_notification_watcher_server_is_notification_host_registered (CustomServiceAppstore * appstore, gboolean * haveHost) -{ - *haveHost = TRUE; - return TRUE; -} - diff --git a/src/custom-service-watcher.c b/src/custom-service-watcher.c index 5899b83..b4680ab 100644 --- a/src/custom-service-watcher.c +++ b/src/custom-service-watcher.c @@ -2,7 +2,17 @@ #include "config.h" #endif +#include #include "custom-service-watcher.h" +#include "dbus-shared.h" + +static gboolean _notification_watcher_server_register_service (CustomServiceWatcher * appstore, const gchar * service, DBusGMethodInvocation * method); +static gboolean _notification_watcher_server_registered_services (CustomServiceWatcher * appstore, GArray ** apps); +static gboolean _notification_watcher_server_protocol_version (CustomServiceWatcher * appstore, char ** version); +static gboolean _notification_watcher_server_register_notification_host (CustomServiceWatcher * appstore, const gchar * host); +static gboolean _notification_watcher_server_is_notification_host_registered (CustomServiceWatcher * appstore, gboolean * haveHost); + +#include "notification-watcher-server.h" typedef struct _CustomServiceWatcherPrivate CustomServiceWatcherPrivate; struct _CustomServiceWatcherPrivate { @@ -29,12 +39,26 @@ custom_service_watcher_class_init (CustomServiceWatcherClass *klass) object_class->dispose = custom_service_watcher_dispose; object_class->finalize = custom_service_watcher_finalize; + dbus_g_object_type_install_info(CUSTOM_SERVICE_WATCHER_TYPE, + &dbus_glib__notification_watcher_server_object_info); + return; } static void custom_service_watcher_init (CustomServiceWatcher *self) { + GError * error = NULL; + DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &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, + INDICATOR_CUSTOM_DBUS_OBJ "/more", + G_OBJECT(self)); return; } @@ -54,3 +78,42 @@ custom_service_watcher_finalize (GObject *object) G_OBJECT_CLASS (custom_service_watcher_parent_class)->finalize (object); return; } + +static gboolean +_notification_watcher_server_register_service (CustomServiceWatcher * appstore, const gchar * service, DBusGMethodInvocation * method) +{ + + + + dbus_g_method_return(method, G_TYPE_NONE); + return TRUE; +} + +static gboolean +_notification_watcher_server_registered_services (CustomServiceWatcher * appstore, GArray ** apps) +{ + + return FALSE; +} + +static gboolean +_notification_watcher_server_protocol_version (CustomServiceWatcher * appstore, char ** version) +{ + *version = g_strdup("Ayatana Version 1"); + return TRUE; +} + +static gboolean +_notification_watcher_server_register_notification_host (CustomServiceWatcher * appstore, const gchar * host) +{ + + return FALSE; +} + +static gboolean +_notification_watcher_server_is_notification_host_registered (CustomServiceWatcher * appstore, gboolean * haveHost) +{ + *haveHost = TRUE; + return TRUE; +} + -- cgit v1.2.3