From ec8cd6885a17a2a03fc65c89f6e10f3da42b59de Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 28 Oct 2009 14:52:08 -0500 Subject: Adding the custom-service interface. --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index ff5b26e..aace163 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -82,6 +82,7 @@ libcustomindicator_la_LIBADD = \ ################################## DBUS_SPECS = \ + custom-service.xml \ notification-item.xml \ notification-watcher.xml -- cgit v1.2.3 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/Makefile.am | 3 +++ src/custom-service-appstore.c | 57 +++++++++++++++++++++++++++++++++++++++++++ src/custom-service-appstore.h | 31 +++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 src/custom-service-appstore.c create mode 100644 src/custom-service-appstore.h (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index aace163..6f7e6e6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,6 +30,9 @@ libexec_PROGRAMS = indicator-custom-service indicator_custom_service_SOURCES = \ custom-service.c \ + custom-service-appstore.h \ + custom-service-appstore.c \ + custom-service-server.h \ notification-item-client.h \ notification-watcher-server.h indicator_custom_service_CFLAGS = \ 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; +} diff --git a/src/custom-service-appstore.h b/src/custom-service-appstore.h new file mode 100644 index 0000000..48c9da9 --- /dev/null +++ b/src/custom-service-appstore.h @@ -0,0 +1,31 @@ +#ifndef __CUSTOM_SERVICE_APPSTORE_H__ +#define __CUSTOM_SERVICE_APPSTORE_H__ + +#include +#include + +G_BEGIN_DECLS + +#define CUSTOM_SERVICE_APPSTORE_TYPE (custom_service_appstore_get_type ()) +#define CUSTOM_SERVICE_APPSTORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CUSTOM_SERVICE_APPSTORE_TYPE, CustomServiceAppstore)) +#define CUSTOM_SERVICE_APPSTORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CUSTOM_SERVICE_APPSTORE_TYPE, CustomServiceAppstoreClass)) +#define IS_CUSTOM_SERVICE_APPSTORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CUSTOM_SERVICE_APPSTORE_TYPE)) +#define IS_CUSTOM_SERVICE_APPSTORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CUSTOM_SERVICE_APPSTORE_TYPE)) +#define CUSTOM_SERVICE_APPSTORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CUSTOM_SERVICE_APPSTORE_TYPE, CustomServiceAppstoreClass)) + +typedef struct _CustomServiceAppstore CustomServiceAppstore; +typedef struct _CustomServiceAppstoreClass CustomServiceAppstoreClass; + +struct _CustomServiceAppstoreClass { + GObjectClass parent_class; +}; + +struct _CustomServiceAppstore { + GObject parent; +}; + +GType custom_service_appstore_get_type (void); + +G_END_DECLS + +#endif -- cgit v1.2.3 From 9aff9ba7149a1757f124db54599637801fa76ae6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 2 Nov 2009 19:52:47 -0600 Subject: Getting the name into a header. --- src/Makefile.am | 2 ++ src/custom-service.c | 3 ++- src/dbus-shared.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/dbus-shared.h (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 6f7e6e6..273c2dc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,6 +12,7 @@ include $(top_srcdir)/Makefile.am.enum customlibdir = $(INDICATORDIR) customlib_LTLIBRARIES = libcustom.la libcustom_la_SOURCES = \ + dbus-shared.h \ indicator-custom.c libcustom_la_CFLAGS = $(INDICATOR_CFLAGS) \ -Wall \ @@ -33,6 +34,7 @@ indicator_custom_service_SOURCES = \ custom-service-appstore.h \ custom-service-appstore.c \ custom-service-server.h \ + dbus-shared.h \ notification-item-client.h \ notification-watcher-server.h indicator_custom_service_CFLAGS = \ diff --git a/src/custom-service.c b/src/custom-service.c index 2f8ecf5..df3d58a 100644 --- a/src/custom-service.c +++ b/src/custom-service.c @@ -2,6 +2,7 @@ #include "libindicator/indicator-service.h" #include "notification-item-client.h" #include "custom-service-appstore.h" +#include "dbus-shared.h" static GMainLoop * mainloop = NULL; static CustomServiceAppstore * appstore = NULL; @@ -12,7 +13,7 @@ main (int argc, char ** argv) { g_type_init(); - service = indicator_service_new("org.ayatana.indicator.custom"); + service = indicator_service_new(INDICATOR_CUSTOM_DBUS_ADDR); appstore = CUSTOM_SERVICE_APPSTORE(g_object_new(CUSTOM_SERVICE_APPSTORE_TYPE, NULL)); mainloop = g_main_loop_new(NULL, FALSE); diff --git a/src/dbus-shared.h b/src/dbus-shared.h new file mode 100644 index 0000000..36436bd --- /dev/null +++ b/src/dbus-shared.h @@ -0,0 +1,3 @@ + +#define INDICATOR_CUSTOM_DBUS_ADDR "org.ayatana.indicator.custom" + -- cgit v1.2.3 From 53f654eec6419c4999a620f9f1e0aaf3f2ac5e89 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 16:47:54 -0600 Subject: Adding in a set of marshallers to make our signals all happy. --- .bzrignore | 3 +++ src/Makefile.am | 6 ++++++ src/custom-service-appstore.c | 3 ++- src/custom-service-marshal.list | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/custom-service-marshal.list (limited to 'src/Makefile.am') diff --git a/.bzrignore b/.bzrignore index f41b607..2942d56 100644 --- a/.bzrignore +++ b/.bzrignore @@ -26,3 +26,6 @@ tests/libcustomindicator-tests tests/test-libcustomindicator-dbus src/custom-service-client.h src/custom-service-server.h +src/custom-service-marshal.c +src/custom-service-marshal.h +src/stamp-marshal diff --git a/src/Makefile.am b/src/Makefile.am index 273c2dc..2fb861c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,6 +4,7 @@ BUILT_SOURCES = EXTRA_DIST = include $(top_srcdir)/Makefile.am.enum +include $(top_srcdir)/Makefile.am.marshal ################################## # Indicator @@ -33,6 +34,8 @@ indicator_custom_service_SOURCES = \ custom-service.c \ custom-service-appstore.h \ custom-service-appstore.c \ + custom-service-marshal.h \ + custom-service-marshal.c \ custom-service-server.h \ dbus-shared.h \ notification-item-client.h \ @@ -43,6 +46,9 @@ indicator_custom_service_CFLAGS = \ indicator_custom_service_LDADD = \ $(INDICATOR_LIBS) +glib_marshal_list = custom-service-marshal.list +glib_marshal_prefix = _custom_service_marshal + ################################## # Library ################################## diff --git a/src/custom-service-appstore.c b/src/custom-service-appstore.c index a012fae..02d7927 100644 --- a/src/custom-service-appstore.c +++ b/src/custom-service-appstore.c @@ -4,6 +4,7 @@ #include #include "custom-service-appstore.h" +#include "custom-service-marshal.h" #include "dbus-shared.h" /* DBus Prototypes */ @@ -59,7 +60,7 @@ custom_service_appstore_class_init (CustomServiceAppstoreClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CustomServiceAppstore, application_added), NULL, NULL, - g_cclosure_marshal_VOID__POINTER, + _custom_service_marshal_VOID__STRING_INT_STRING_STRING, G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE); signals[APPLICATION_REMOVED] = g_signal_new ("application-removed", G_TYPE_FROM_CLASS(klass), diff --git a/src/custom-service-marshal.list b/src/custom-service-marshal.list new file mode 100644 index 0000000..4056f53 --- /dev/null +++ b/src/custom-service-marshal.list @@ -0,0 +1 @@ +VOID: STRING, INT, STRING, STRING -- cgit v1.2.3 From ab660ab46dabfdd99fb4e5ee8641a305299852c8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 16:55:48 -0600 Subject: Creating a new object to be our watcher. Apparently we can't have two DBus interfaces on the same object :( --- src/Makefile.am | 2 ++ src/custom-service-watcher.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ src/custom-service-watcher.h | 31 ++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 src/custom-service-watcher.c create mode 100644 src/custom-service-watcher.h (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 2fb861c..fa0137f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,6 +37,8 @@ indicator_custom_service_SOURCES = \ custom-service-marshal.h \ custom-service-marshal.c \ custom-service-server.h \ + custom-service-watcher.h \ + custom-service-watcher.c \ dbus-shared.h \ notification-item-client.h \ notification-watcher-server.h diff --git a/src/custom-service-watcher.c b/src/custom-service-watcher.c new file mode 100644 index 0000000..5899b83 --- /dev/null +++ b/src/custom-service-watcher.c @@ -0,0 +1,56 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "custom-service-watcher.h" + +typedef struct _CustomServiceWatcherPrivate CustomServiceWatcherPrivate; +struct _CustomServiceWatcherPrivate { + int dummy; +}; + +#define CUSTOM_SERVICE_WATCHER_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), CUSTOM_SERVICE_WATCHER_TYPE, CustomServiceWatcherPrivate)) + +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; + + return; +} + +static void +custom_service_watcher_init (CustomServiceWatcher *self) +{ + + return; +} + +static void +custom_service_watcher_dispose (GObject *object) +{ + + 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; +} diff --git a/src/custom-service-watcher.h b/src/custom-service-watcher.h new file mode 100644 index 0000000..3006175 --- /dev/null +++ b/src/custom-service-watcher.h @@ -0,0 +1,31 @@ +#ifndef __CUSTOM_SERVICE_WATCHER_H__ +#define __CUSTOM_SERVICE_WATCHER_H__ + +#include +#include + +G_BEGIN_DECLS + +#define CUSTOM_SERVICE_WATCHER_TYPE (custom_service_watcher_get_type ()) +#define CUSTOM_SERVICE_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CUSTOM_SERVICE_WATCHER_TYPE, CustomServiceWatcher)) +#define CUSTOM_SERVICE_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CUSTOM_SERVICE_WATCHER_TYPE, CustomServiceWatcherClass)) +#define IS_CUSTOM_SERVICE_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CUSTOM_SERVICE_WATCHER_TYPE)) +#define IS_CUSTOM_SERVICE_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CUSTOM_SERVICE_WATCHER_TYPE)) +#define CUSTOM_SERVICE_WATCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CUSTOM_SERVICE_WATCHER_TYPE, CustomServiceWatcherClass)) + +typedef struct _CustomServiceWatcher CustomServiceWatcher; +typedef struct _CustomServiceWatcherClass CustomServiceWatcherClass; + +struct _CustomServiceWatcherClass { + GObjectClass parent_class; +}; + +struct _CustomServiceWatcher { + GObject parent; +}; + +GType custom_service_watcher_get_type (void); + +G_END_DECLS + +#endif -- cgit v1.2.3 From ffd996217a130a5252ca804c506205bbbbadef3a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Nov 2009 22:50:48 -0600 Subject: Adding some XML for dbus properties interface. --- .bzrignore | 2 ++ src/Makefile.am | 2 ++ src/dbus-properties.xml | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 src/dbus-properties.xml (limited to 'src/Makefile.am') diff --git a/.bzrignore b/.bzrignore index 2942d56..4d5f1b0 100644 --- a/.bzrignore +++ b/.bzrignore @@ -29,3 +29,5 @@ src/custom-service-server.h src/custom-service-marshal.c src/custom-service-marshal.h src/stamp-marshal +src/dbus-properties-client.h +src/dbus-properties-server.h diff --git a/src/Makefile.am b/src/Makefile.am index fa0137f..21d7cf8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,6 +39,7 @@ indicator_custom_service_SOURCES = \ custom-service-server.h \ custom-service-watcher.h \ custom-service-watcher.c \ + dbus-properties-client.h \ dbus-shared.h \ notification-item-client.h \ notification-watcher-server.h @@ -96,6 +97,7 @@ libcustomindicator_la_LIBADD = \ DBUS_SPECS = \ custom-service.xml \ + dbus-properties.xml \ notification-item.xml \ notification-watcher.xml diff --git a/src/dbus-properties.xml b/src/dbus-properties.xml new file mode 100644 index 0000000..c172895 --- /dev/null +++ b/src/dbus-properties.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 25d690a42cb12ca9136932d7ace759bbe4185f86 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 23 Nov 2009 16:35:45 -0600 Subject: Registering marshallers for DBus in the indicator. --- src/Makefile.am | 1 + src/indicator-custom.c | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 21d7cf8..102804e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,6 +13,7 @@ include $(top_srcdir)/Makefile.am.marshal customlibdir = $(INDICATORDIR) customlib_LTLIBRARIES = libcustom.la libcustom_la_SOURCES = \ + custom-service-marshal.c \ dbus-shared.h \ indicator-custom.c libcustom_la_CFLAGS = $(INDICATOR_CFLAGS) \ diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 3bd2aa9..53e2269 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -16,6 +16,7 @@ /* Local Stuff */ #include "dbus-shared.h" #include "custom-service-client.h" +#include "custom-service-marshal.h" #define INDICATOR_CUSTOM_TYPE (indicator_custom_get_type ()) #define INDICATOR_CUSTOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_CUSTOM_TYPE, IndicatorCustom)) @@ -87,6 +88,10 @@ indicator_custom_class_init (IndicatorCustomClass *klass) io_class->get_entries = get_entries; + /* Register the marshallers for the dbus signals */ + dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__INT, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_object_register_marshaller(_custom_service_marshal_VOID__STRING_INT_STRING_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + return; } @@ -184,6 +189,7 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c G_TYPE_INT, G_TYPE_NONE); + /* Connect to them */ dbus_g_proxy_connect_signal(priv->service_proxy, "ApplicationAdded", G_CALLBACK(application_added), -- cgit v1.2.3