From fc1e08a7c7873005d9161da2ea677908d07f3fcc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 30 Nov 2009 09:52:16 -0600 Subject: Total insane rename. Probably broke more than a few things. --- src/application-service-watcher.c | 183 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 src/application-service-watcher.c (limited to 'src/application-service-watcher.c') diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c new file mode 100644 index 0000000..7cc15ee --- /dev/null +++ b/src/application-service-watcher.c @@ -0,0 +1,183 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include "custom-service-watcher.h" +#include "dbus-shared.h" + +static gboolean _notification_watcher_server_register_service (CustomServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method); +static gboolean _notification_watcher_server_registered_services (CustomServiceWatcher * appwatcher, GArray ** apps); +static gboolean _notification_watcher_server_protocol_version (CustomServiceWatcher * appwatcher, char ** version); +static gboolean _notification_watcher_server_register_notification_host (CustomServiceWatcher * appwatcher, const gchar * host); +static gboolean _notification_watcher_server_is_notification_host_registered (CustomServiceWatcher * appwatcher, gboolean * haveHost); + +#include "notification-watcher-server.h" + +/* Private Stuff */ +typedef struct _CustomServiceWatcherPrivate CustomServiceWatcherPrivate; +struct _CustomServiceWatcherPrivate { + CustomServiceAppstore * appstore; +}; + +#define CUSTOM_SERVICE_WATCHER_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), CUSTOM_SERVICE_WATCHER_TYPE, CustomServiceWatcherPrivate)) + +/* Signals Stuff */ +enum { + SERVICE_REGISTERED, + SERVICE_UNREGISTERED, + NOTIFICATION_HOST_REGISTERED, + NOTIFICATION_HOST_UNREGISTERED, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + +/* GObject stuff */ +static void custom_service_watcher_class_init (CustomServiceWatcherClass *klass); +static void custom_service_watcher_init (CustomServiceWatcher *self); +static void custom_service_watcher_dispose (GObject *object); +static void custom_service_watcher_finalize (GObject *object); + +G_DEFINE_TYPE (CustomServiceWatcher, custom_service_watcher, G_TYPE_OBJECT); + +static void +custom_service_watcher_class_init (CustomServiceWatcherClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (CustomServiceWatcherPrivate)); + + object_class->dispose = custom_service_watcher_dispose; + object_class->finalize = custom_service_watcher_finalize; + + signals[SERVICE_REGISTERED] = g_signal_new ("service-registered", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CustomServiceWatcherClass, service_registered), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING, G_TYPE_NONE); + signals[SERVICE_UNREGISTERED] = g_signal_new ("service-unregistered", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CustomServiceWatcherClass, service_unregistered), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING, G_TYPE_NONE); + signals[NOTIFICATION_HOST_REGISTERED] = g_signal_new ("notification-host-registered", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CustomServiceWatcherClass, notification_host_registered), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, G_TYPE_NONE); + signals[NOTIFICATION_HOST_UNREGISTERED] = g_signal_new ("notification-host-unregistered", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CustomServiceWatcherClass, notification_host_unregistered), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, G_TYPE_NONE); + + 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) +{ + CustomServiceWatcherPrivate * priv = CUSTOM_SERVICE_WATCHER_GET_PRIVATE(self); + + priv->appstore = NULL; + + 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, + NOTIFICATION_WATCHER_DBUS_OBJ, + G_OBJECT(self)); + + return; +} + +static void +custom_service_watcher_dispose (GObject *object) +{ + CustomServiceWatcherPrivate * priv = CUSTOM_SERVICE_WATCHER_GET_PRIVATE(object); + + if (priv->appstore != NULL) { + g_object_unref(G_OBJECT(priv->appstore)); + priv->appstore = NULL; + } + + G_OBJECT_CLASS (custom_service_watcher_parent_class)->dispose (object); + return; +} + +static void +custom_service_watcher_finalize (GObject *object) +{ + + G_OBJECT_CLASS (custom_service_watcher_parent_class)->finalize (object); + return; +} + +CustomServiceWatcher * +custom_service_watcher_new (CustomServiceAppstore * appstore) +{ + GObject * obj = g_object_new(CUSTOM_SERVICE_WATCHER_TYPE, NULL); + CustomServiceWatcherPrivate * priv = CUSTOM_SERVICE_WATCHER_GET_PRIVATE(obj); + priv->appstore = appstore; + g_object_ref(G_OBJECT(priv->appstore)); + return CUSTOM_SERVICE_WATCHER(obj); +} + +static gboolean +_notification_watcher_server_register_service (CustomServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method) +{ + CustomServiceWatcherPrivate * priv = CUSTOM_SERVICE_WATCHER_GET_PRIVATE(appwatcher); + + custom_service_appstore_application_add(priv->appstore, dbus_g_method_get_sender(method), service); + + dbus_g_method_return(method, G_TYPE_NONE); + return TRUE; +} + +static gboolean +_notification_watcher_server_registered_services (CustomServiceWatcher * appwatcher, GArray ** apps) +{ + + return FALSE; +} + +static gboolean +_notification_watcher_server_protocol_version (CustomServiceWatcher * appwatcher, char ** version) +{ + *version = g_strdup("Ayatana Version 1"); + return TRUE; +} + +static gboolean +_notification_watcher_server_register_notification_host (CustomServiceWatcher * appwatcher, const gchar * host) +{ + + return FALSE; +} + +static gboolean +_notification_watcher_server_is_notification_host_registered (CustomServiceWatcher * appwatcher, gboolean * haveHost) +{ + *haveHost = TRUE; + return TRUE; +} + -- cgit v1.2.3 From 5b2dcab7aad9e2920bedc3ef28c34c661d70ce71 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 30 Nov 2009 09:58:53 -0600 Subject: Changing file names, and some fallouts from that. --- src/application-service-watcher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/application-service-watcher.c') diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c index 7cc15ee..a5e1817 100644 --- a/src/application-service-watcher.c +++ b/src/application-service-watcher.c @@ -4,7 +4,7 @@ #include #include -#include "custom-service-watcher.h" +#include "application-service-watcher.h" #include "dbus-shared.h" static gboolean _notification_watcher_server_register_service (CustomServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method); -- cgit v1.2.3 From 672b7258707f3508ca4abe5fd1adee3847af5f94 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 30 Nov 2009 12:34:53 -0600 Subject: Massive custom to application find and replace throughout the code. --- src/application-service-watcher.c | 86 +++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'src/application-service-watcher.c') diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c index a5e1817..b077e6a 100644 --- a/src/application-service-watcher.c +++ b/src/application-service-watcher.c @@ -7,22 +7,22 @@ #include "application-service-watcher.h" #include "dbus-shared.h" -static gboolean _notification_watcher_server_register_service (CustomServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method); -static gboolean _notification_watcher_server_registered_services (CustomServiceWatcher * appwatcher, GArray ** apps); -static gboolean _notification_watcher_server_protocol_version (CustomServiceWatcher * appwatcher, char ** version); -static gboolean _notification_watcher_server_register_notification_host (CustomServiceWatcher * appwatcher, const gchar * host); -static gboolean _notification_watcher_server_is_notification_host_registered (CustomServiceWatcher * appwatcher, gboolean * haveHost); +static gboolean _notification_watcher_server_register_service (ApplicationServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method); +static gboolean _notification_watcher_server_registered_services (ApplicationServiceWatcher * appwatcher, GArray ** apps); +static gboolean _notification_watcher_server_protocol_version (ApplicationServiceWatcher * appwatcher, char ** version); +static gboolean _notification_watcher_server_register_notification_host (ApplicationServiceWatcher * appwatcher, const gchar * host); +static gboolean _notification_watcher_server_is_notification_host_registered (ApplicationServiceWatcher * appwatcher, gboolean * haveHost); #include "notification-watcher-server.h" /* Private Stuff */ -typedef struct _CustomServiceWatcherPrivate CustomServiceWatcherPrivate; -struct _CustomServiceWatcherPrivate { - CustomServiceAppstore * appstore; +typedef struct _ApplicationServiceWatcherPrivate ApplicationServiceWatcherPrivate; +struct _ApplicationServiceWatcherPrivate { + ApplicationServiceAppstore * appstore; }; -#define CUSTOM_SERVICE_WATCHER_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), CUSTOM_SERVICE_WATCHER_TYPE, CustomServiceWatcherPrivate)) +#define APPLICATION_SERVICE_WATCHER_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), APPLICATION_SERVICE_WATCHER_TYPE, ApplicationServiceWatcherPrivate)) /* Signals Stuff */ enum { @@ -36,62 +36,62 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; /* GObject stuff */ -static void custom_service_watcher_class_init (CustomServiceWatcherClass *klass); -static void custom_service_watcher_init (CustomServiceWatcher *self); -static void custom_service_watcher_dispose (GObject *object); -static void custom_service_watcher_finalize (GObject *object); +static void application_service_watcher_class_init (ApplicationServiceWatcherClass *klass); +static void application_service_watcher_init (ApplicationServiceWatcher *self); +static void application_service_watcher_dispose (GObject *object); +static void application_service_watcher_finalize (GObject *object); -G_DEFINE_TYPE (CustomServiceWatcher, custom_service_watcher, G_TYPE_OBJECT); +G_DEFINE_TYPE (ApplicationServiceWatcher, application_service_watcher, G_TYPE_OBJECT); static void -custom_service_watcher_class_init (CustomServiceWatcherClass *klass) +application_service_watcher_class_init (ApplicationServiceWatcherClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (CustomServiceWatcherPrivate)); + g_type_class_add_private (klass, sizeof (ApplicationServiceWatcherPrivate)); - object_class->dispose = custom_service_watcher_dispose; - object_class->finalize = custom_service_watcher_finalize; + object_class->dispose = application_service_watcher_dispose; + object_class->finalize = application_service_watcher_finalize; signals[SERVICE_REGISTERED] = g_signal_new ("service-registered", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (CustomServiceWatcherClass, service_registered), + G_STRUCT_OFFSET (ApplicationServiceWatcherClass, service_registered), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING, G_TYPE_NONE); signals[SERVICE_UNREGISTERED] = g_signal_new ("service-unregistered", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (CustomServiceWatcherClass, service_unregistered), + G_STRUCT_OFFSET (ApplicationServiceWatcherClass, service_unregistered), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING, G_TYPE_NONE); signals[NOTIFICATION_HOST_REGISTERED] = g_signal_new ("notification-host-registered", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (CustomServiceWatcherClass, notification_host_registered), + G_STRUCT_OFFSET (ApplicationServiceWatcherClass, notification_host_registered), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); signals[NOTIFICATION_HOST_UNREGISTERED] = g_signal_new ("notification-host-unregistered", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (CustomServiceWatcherClass, notification_host_unregistered), + G_STRUCT_OFFSET (ApplicationServiceWatcherClass, notification_host_unregistered), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); - dbus_g_object_type_install_info(CUSTOM_SERVICE_WATCHER_TYPE, + dbus_g_object_type_install_info(APPLICATION_SERVICE_WATCHER_TYPE, &dbus_glib__notification_watcher_server_object_info); return; } static void -custom_service_watcher_init (CustomServiceWatcher *self) +application_service_watcher_init (ApplicationServiceWatcher *self) { - CustomServiceWatcherPrivate * priv = CUSTOM_SERVICE_WATCHER_GET_PRIVATE(self); + ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(self); priv->appstore = NULL; @@ -111,71 +111,71 @@ custom_service_watcher_init (CustomServiceWatcher *self) } static void -custom_service_watcher_dispose (GObject *object) +application_service_watcher_dispose (GObject *object) { - CustomServiceWatcherPrivate * priv = CUSTOM_SERVICE_WATCHER_GET_PRIVATE(object); + ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(object); if (priv->appstore != NULL) { g_object_unref(G_OBJECT(priv->appstore)); priv->appstore = NULL; } - G_OBJECT_CLASS (custom_service_watcher_parent_class)->dispose (object); + G_OBJECT_CLASS (application_service_watcher_parent_class)->dispose (object); return; } static void -custom_service_watcher_finalize (GObject *object) +application_service_watcher_finalize (GObject *object) { - G_OBJECT_CLASS (custom_service_watcher_parent_class)->finalize (object); + G_OBJECT_CLASS (application_service_watcher_parent_class)->finalize (object); return; } -CustomServiceWatcher * -custom_service_watcher_new (CustomServiceAppstore * appstore) +ApplicationServiceWatcher * +application_service_watcher_new (ApplicationServiceAppstore * appstore) { - GObject * obj = g_object_new(CUSTOM_SERVICE_WATCHER_TYPE, NULL); - CustomServiceWatcherPrivate * priv = CUSTOM_SERVICE_WATCHER_GET_PRIVATE(obj); + GObject * obj = g_object_new(APPLICATION_SERVICE_WATCHER_TYPE, NULL); + ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(obj); priv->appstore = appstore; g_object_ref(G_OBJECT(priv->appstore)); - return CUSTOM_SERVICE_WATCHER(obj); + return APPLICATION_SERVICE_WATCHER(obj); } static gboolean -_notification_watcher_server_register_service (CustomServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method) +_notification_watcher_server_register_service (ApplicationServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method) { - CustomServiceWatcherPrivate * priv = CUSTOM_SERVICE_WATCHER_GET_PRIVATE(appwatcher); + ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(appwatcher); - custom_service_appstore_application_add(priv->appstore, dbus_g_method_get_sender(method), service); + application_service_appstore_application_add(priv->appstore, dbus_g_method_get_sender(method), service); dbus_g_method_return(method, G_TYPE_NONE); return TRUE; } static gboolean -_notification_watcher_server_registered_services (CustomServiceWatcher * appwatcher, GArray ** apps) +_notification_watcher_server_registered_services (ApplicationServiceWatcher * appwatcher, GArray ** apps) { return FALSE; } static gboolean -_notification_watcher_server_protocol_version (CustomServiceWatcher * appwatcher, char ** version) +_notification_watcher_server_protocol_version (ApplicationServiceWatcher * appwatcher, char ** version) { *version = g_strdup("Ayatana Version 1"); return TRUE; } static gboolean -_notification_watcher_server_register_notification_host (CustomServiceWatcher * appwatcher, const gchar * host) +_notification_watcher_server_register_notification_host (ApplicationServiceWatcher * appwatcher, const gchar * host) { return FALSE; } static gboolean -_notification_watcher_server_is_notification_host_registered (CustomServiceWatcher * appwatcher, gboolean * haveHost) +_notification_watcher_server_is_notification_host_registered (ApplicationServiceWatcher * appwatcher, gboolean * haveHost) { *haveHost = TRUE; return TRUE; -- cgit v1.2.3