aboutsummaryrefslogtreecommitdiff
path: root/libindicate
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-01-15 10:39:51 -0600
committerTed Gould <ted@canonical.com>2009-01-15 10:39:51 -0600
commitccac9b84bae42b0ad622d282dc12a65c3f7c7b11 (patch)
tree5dcaeaabf4efae093f0c31cfb6ad8d57c00ef2b3 /libindicate
parent48277fb0df0d455db8f1e953a591200fd650c202 (diff)
downloadlibayatana-indicator-ccac9b84bae42b0ad622d282dc12a65c3f7c7b11.tar.gz
libayatana-indicator-ccac9b84bae42b0ad622d282dc12a65c3f7c7b11.tar.bz2
libayatana-indicator-ccac9b84bae42b0ad622d282dc12a65c3f7c7b11.zip
Adding in the base object for the listener.
Diffstat (limited to 'libindicate')
-rw-r--r--libindicate/Makefile.am2
-rw-r--r--libindicate/listener.c78
-rw-r--r--libindicate/listener.h53
3 files changed, 133 insertions, 0 deletions
diff --git a/libindicate/Makefile.am b/libindicate/Makefile.am
index 3dd211d..2d75dbd 100644
--- a/libindicate/Makefile.am
+++ b/libindicate/Makefile.am
@@ -17,6 +17,7 @@ libindicateincludedir=$(includedir)/libindicate-1.0/libindicate
indicate_headers = \
indicator.h \
+ listener.h \
server.h
libindicateinclude_HEADERS = \
@@ -26,6 +27,7 @@ libindicate_la_SOURCES = \
$(indicate_headers) \
dbus-indicate-server.h \
server.c \
+ listener.c \
indicator.c
libindicate_la_LDFLAGS = \
diff --git a/libindicate/listener.c b/libindicate/listener.c
new file mode 100644
index 0000000..3b082d7
--- /dev/null
+++ b/libindicate/listener.c
@@ -0,0 +1,78 @@
+
+#include "listener.h"
+
+/* Errors */
+enum {
+ LAST_ERROR
+};
+
+/* Signals */
+enum {
+ INDICATOR_ADDED,
+ INDICATOR_REMOVED,
+ INDICATOR_MODIFIED,
+ SERVER_ADDED,
+ SERVER_REMOVED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (IndicateListener, indicate_listener, G_TYPE_OBJECT);
+
+/* Prototypes */
+static void indicate_listener_finalize (GObject * obj);
+
+/* Code */
+static void
+indicate_listener_class_init (IndicateListenerClass * class)
+{
+ g_debug("Listener Class Initialized");
+ GObjectClass * gobj;
+ gobj = G_OBJECT_CLASS(class);
+
+ gobj->finalize = indicate_listener_finalize;
+
+/* TODO, I need new marshallers here, bah humbug
+ signals[INDICATOR_ADDED] = g_signal_new("indicator-added",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IndicateListenerClass, indicator_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_OBJECT, G_TYPE_STRING);
+ signals[INDICATOR_REMOVED] = g_signal_new("indicator-removed",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IndicateServerClass, indicator_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__UINT_POINTER,
+ G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ signals[INDICATOR_MODIFIED] = g_signal_new("indicator-modified",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IndicateServerClass, indicator_modified),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__UINT_POINTER,
+ G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+*/
+
+ return;
+}
+
+static void
+indicate_listener_init (IndicateListener * server)
+{
+ g_debug("Listener Object Initialized");
+
+ return;
+}
+
+static void
+indicate_listener_finalize (GObject * obj)
+{
+ IndicateListener * listener = INDICATE_LISTENER(obj);
+
+ return;
+}
+
diff --git a/libindicate/listener.h b/libindicate/listener.h
new file mode 100644
index 0000000..1f0c870
--- /dev/null
+++ b/libindicate/listener.h
@@ -0,0 +1,53 @@
+
+#ifndef INDICATE_LISTENER_H_INCLUDED__
+#define INDICATE_LISTENER_H_INCLUDED__ 1
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "indicator.h"
+#include "server.h"
+
+G_BEGIN_DECLS
+
+/* Boilerplate */
+#define INDICATE_TYPE_LISTENER (indicate_server_get_type ())
+#define INDICATE_LISTENER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), INDICATE_TYPE_LISTENER, IndicateListener))
+#define INDICATE_IS_LISTENER(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), INDICATE_TYPE_LISTENER))
+#define INDICATE_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), INDICATE_TYPE_LISTENER, IndicateListenerClass))
+#define INDICATE_IS_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), INDICATE_TYPE_LISTENER))
+#define INDICATE_LISTENER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), INDICATE_TYPE_LISTENER, IndicateListenerClass))
+
+typedef struct _IndicateListener IndicateListener;
+struct _IndicateListener {
+ GObject parent;
+
+};
+
+typedef struct _IndicateListenerClass IndicateListenerClass;
+struct _IndicateListenerClass {
+ GObjectClass parent;
+
+ /* Signals */
+ void (* indicator_added) (IndicateServer * server, IndicateIndicator * indicator, gchar * type);
+ void (* indicator_removed) (IndicateServer * server, IndicateIndicator * indicator, gchar * type);
+ void (* indicator_modified) (IndicateServer * server, IndicateIndicator * indicator, gchar * property);
+
+ void (* server_added) (IndicateServer * server);
+ void (* server_removed) (IndicateServer * server);
+
+};
+
+GType indicate_listener_get_type (void) G_GNUC_CONST;
+
+/* Create a new server */
+IndicateListener * indicate_listener_new (void);
+
+
+
+
+
+G_END_DECLS
+
+#endif /* INDICATE_LISTENER_H_INCLUDED__ */
+