From ecf44bf6a995071c7f0e5760dc3ed03542b993a0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 28 Oct 2009 14:57:38 -0500 Subject: Adding an appstore object to hold all of our apps. --- src/custom-service-appstore.c | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/custom-service-appstore.c (limited to 'src/custom-service-appstore.c') diff --git a/src/custom-service-appstore.c b/src/custom-service-appstore.c new file mode 100644 index 0000000..c1bc345 --- /dev/null +++ b/src/custom-service-appstore.c @@ -0,0 +1,57 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "custom-service-appstore.h" + +typedef struct _CustomServiceAppstorePrivate CustomServiceAppstorePrivate; + +struct _CustomServiceAppstorePrivate { + int demo; +}; + +#define CUSTOM_SERVICE_APPSTORE_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), CUSTOM_SERVICE_APPSTORE_TYPE, CustomServiceAppstorePrivate)) + +static void custom_service_appstore_class_init (CustomServiceAppstoreClass *klass); +static void custom_service_appstore_init (CustomServiceAppstore *self); +static void custom_service_appstore_dispose (GObject *object); +static void custom_service_appstore_finalize (GObject *object); + +G_DEFINE_TYPE (CustomServiceAppstore, custom_service_appstore, G_TYPE_OBJECT); + +static void +custom_service_appstore_class_init (CustomServiceAppstoreClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (CustomServiceAppstorePrivate)); + + object_class->dispose = custom_service_appstore_dispose; + object_class->finalize = custom_service_appstore_finalize; + + return; +} + +static void +custom_service_appstore_init (CustomServiceAppstore *self) +{ + + return; +} + +static void +custom_service_appstore_dispose (GObject *object) +{ + + G_OBJECT_CLASS (custom_service_appstore_parent_class)->dispose (object); + return; +} + +static void +custom_service_appstore_finalize (GObject *object) +{ + + G_OBJECT_CLASS (custom_service_appstore_parent_class)->finalize (object); + return; +} -- cgit v1.2.3 From 8903841582ea26b4987fbe04b5a5545d8d65f729 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 28 Oct 2009 15:12:46 -0500 Subject: Boom! Now we're implementing dbus. --- src/custom-service-appstore.c | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'src/custom-service-appstore.c') diff --git a/src/custom-service-appstore.c b/src/custom-service-appstore.c index c1bc345..7f88d46 100644 --- a/src/custom-service-appstore.c +++ b/src/custom-service-appstore.c @@ -4,6 +4,18 @@ #include "custom-service-appstore.h" +/* DBus Prototypes */ +static gboolean _custom_service_server_get_applications (CustomServiceAppstore * appstore, GArray ** apps, gpointer user_data); + +static gboolean _notification_watcher_server_register_service (CustomServiceAppstore * appstore, const gchar * service, gpointer user_data); +static gboolean _notification_watcher_server_registered_services (CustomServiceAppstore * appstore, GArray ** apps, gpointer user_data); +static gboolean _notification_watcher_server_protocol_version (CustomServiceAppstore * appstore, char ** version, gpointer user_data); +static gboolean _notification_watcher_server_register_notification_host (CustomServiceAppstore * appstore, const gchar * host, gpointer user_data); +static gboolean _notification_watcher_server_is_notification_host_registered (CustomServiceAppstore * appstore, gboolean * haveHost, gpointer user_data); + +#include "custom-service-server.h" +#include "notification-watcher-server.h" + typedef struct _CustomServiceAppstorePrivate CustomServiceAppstorePrivate; struct _CustomServiceAppstorePrivate { @@ -55,3 +67,47 @@ custom_service_appstore_finalize (GObject *object) G_OBJECT_CLASS (custom_service_appstore_parent_class)->finalize (object); return; } + +/* DBus Interface */ +static gboolean +_custom_service_server_get_applications (CustomServiceAppstore * appstore, GArray ** apps, gpointer user_data) +{ + + return FALSE; +} + +static gboolean +_notification_watcher_server_register_service (CustomServiceAppstore * appstore, const gchar * service, gpointer user_data) +{ + + return FALSE; +} + +static gboolean +_notification_watcher_server_registered_services (CustomServiceAppstore * appstore, GArray ** apps, gpointer user_data) +{ + + return FALSE; +} + +static gboolean +_notification_watcher_server_protocol_version (CustomServiceAppstore * appstore, char ** version, gpointer user_data) +{ + + return FALSE; +} + +static gboolean +_notification_watcher_server_register_notification_host (CustomServiceAppstore * appstore, const gchar * host, gpointer user_data) +{ + + return FALSE; +} + +static gboolean +_notification_watcher_server_is_notification_host_registered (CustomServiceAppstore * appstore, gboolean * haveHost, gpointer user_data) +{ + + return FALSE; +} + -- cgit v1.2.3 From 714f372137fb2a9a992a6d0c23dc12a58b34c43d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 28 Oct 2009 15:52:48 -0500 Subject: Registering ourselves on dbus --- src/custom-service-appstore.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/custom-service-appstore.c') diff --git a/src/custom-service-appstore.c b/src/custom-service-appstore.c index 7f88d46..1e61852 100644 --- a/src/custom-service-appstore.c +++ b/src/custom-service-appstore.c @@ -42,12 +42,29 @@ custom_service_appstore_class_init (CustomServiceAppstoreClass *klass) object_class->dispose = custom_service_appstore_dispose; object_class->finalize = custom_service_appstore_finalize; + 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); + return; } static void custom_service_appstore_init (CustomServiceAppstore *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, + "/my/path", + G_OBJECT(self)); return; } -- cgit v1.2.3