aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-01-21 17:15:34 -0600
committerTed Gould <ted@canonical.com>2009-01-21 17:15:34 -0600
commit8199742023930c8702aa213c859c01f15f77f673 (patch)
treedeac86394e68a42450ff80873112d10bcef10428
parentea69948a6faec897f74cc2323f291e1e0139db9a (diff)
parent0fc106dd6a5081d3769668249556766e15c07c71 (diff)
downloadlibayatana-indicator-8199742023930c8702aa213c859c01f15f77f673.tar.gz
libayatana-indicator-8199742023930c8702aa213c859c01f15f77f673.tar.bz2
libayatana-indicator-8199742023930c8702aa213c859c01f15f77f673.zip
Adding in a message indicator and a small test to use it.
-rw-r--r--.bzrignore4
-rw-r--r--libindicate/Makefile.am4
-rw-r--r--libindicate/indicator-message.c68
-rw-r--r--libindicate/indicator-message.h36
-rw-r--r--tests/Makefile.am15
-rw-r--r--tests/im-client.c21
6 files changed, 146 insertions, 2 deletions
diff --git a/.bzrignore b/.bzrignore
index 44b02de..f9243de 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -7,3 +7,7 @@ data/indicator-applet.schemas
po/@GETTEXT_PACKAGE@.pot
po/indicator-applet.pot
src/indicator-applet
+dbus-indicate-client.h
+dbus-indicate-server.h
+listener-marshal.c
+listener-marshal.h
diff --git a/libindicate/Makefile.am b/libindicate/Makefile.am
index 53cb273..e2aef39 100644
--- a/libindicate/Makefile.am
+++ b/libindicate/Makefile.am
@@ -18,6 +18,7 @@ libindicateincludedir=$(includedir)/libindicate-1.0/libindicate
indicate_headers = \
indicator.h \
+ indicator-message.h \
listener.h \
server.h
@@ -32,7 +33,8 @@ libindicate_la_SOURCES = \
listener.c \
listener-marshal.c \
listener-marshal.h \
- indicator.c
+ indicator.c \
+ indicator-message.c
libindicate_la_LDFLAGS = \
-version-info $(LIBINDICATE_CURRENT):$(LIBINDICATE_REVISION):$(LIBINDICATE_AGE) \
diff --git a/libindicate/indicator-message.c b/libindicate/indicator-message.c
new file mode 100644
index 0000000..32cf000
--- /dev/null
+++ b/libindicate/indicator-message.c
@@ -0,0 +1,68 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "indicator-message.h"
+
+typedef struct _IndicateIndicatorMessagePrivate IndicateIndicatorMessagePrivate;
+
+struct _IndicateIndicatorMessagePrivate
+{
+};
+
+#define INDICATE_INDICATOR_MESSAGE_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATE_INDICATOR_MESSAGE_TYPE, IndicateIndicatorMessagePrivate))
+
+static void indicate_indicator_message_class_init (IndicateIndicatorMessageClass *klass);
+static void indicate_indicator_message_init (IndicateIndicatorMessage *self);
+static void indicate_indicator_message_dispose (GObject *object);
+static void indicate_indicator_message_finalize (GObject *object);
+static const gchar * get_indicator_type (IndicateIndicator * indicator);
+
+G_DEFINE_TYPE (IndicateIndicatorMessage, indicate_indicator_message, INDICATE_TYPE_INDICATOR);
+
+static void
+indicate_indicator_message_class_init (IndicateIndicatorMessageClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (IndicateIndicatorMessagePrivate));
+
+ object_class->dispose = indicate_indicator_message_dispose;
+ object_class->finalize = indicate_indicator_message_finalize;
+
+ IndicateIndicatorClass * indicator_class = INDICATE_INDICATOR_CLASS(klass);
+
+ indicator_class->get_type = get_indicator_type;
+
+ return;
+}
+
+static void
+indicate_indicator_message_init (IndicateIndicatorMessage *self)
+{
+}
+
+static void
+indicate_indicator_message_dispose (GObject *object)
+{
+G_OBJECT_CLASS (indicate_indicator_message_parent_class)->dispose (object);
+}
+
+static void
+indicate_indicator_message_finalize (GObject *object)
+{
+G_OBJECT_CLASS (indicate_indicator_message_parent_class)->finalize (object);
+}
+
+static const gchar *
+get_indicator_type (IndicateIndicator * indicator)
+{
+ return "message";
+}
+
+IndicateIndicatorMessage *
+indicate_indicator_message_new (void)
+{
+ return g_object_new(INDICATE_TYPE_INDICATOR_MESSAGE, NULL);
+}
diff --git a/libindicate/indicator-message.h b/libindicate/indicator-message.h
new file mode 100644
index 0000000..ade584e
--- /dev/null
+++ b/libindicate/indicator-message.h
@@ -0,0 +1,36 @@
+#ifndef __INDICATE_INDICATOR_MESSAGE_H__
+#define __INDICATE_INDICATOR_MESSAGE_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "indicator.h"
+
+G_BEGIN_DECLS
+
+#define INDICATE_TYPE_INDICATOR_MESSAGE (indicate_indicator_message_get_type ())
+#define INDICATE_INDICATOR_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATE_TYPE_INDICATOR_MESSAGE, IndicateIndicatorMessage))
+#define INDICATE_INDICATOR_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATE_TYPE_INDICATOR_MESSAGE, IndicateIndicatorMessageClass))
+#define INDICATE_IS_INDICATOR_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATE_TYPE_INDICATOR_MESSAGE))
+#define INDICATE_IS_INDICATOR_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATE_TYPE_INDICATOR_MESSAGE))
+#define INDICATE_INDICATOR_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATE_TYPE_INDICATOR_MESSAGE, IndicateIndicatorMessageClass))
+
+typedef struct _IndicateIndicatorMessage IndicateIndicatorMessage;
+typedef struct _IndicateIndicatorMessageClass IndicateIndicatorMessageClass;
+
+struct _IndicateIndicatorMessageClass
+{
+IndicateIndicatorClass parent_class;
+};
+
+struct _IndicateIndicatorMessage
+{
+IndicateIndicator parent;
+};
+
+GType indicate_indicator_message_get_type (void);
+IndicateIndicatorMessage * indicate_indicator_message_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 03ec716..0017bca 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,7 +2,8 @@
noinst_PROGRAMS = \
indicate-and-crash \
indicate-alot \
- listen-and-print
+ listen-and-print \
+ im-client
indicate_and_crash_SOURCES = \
indicate-and-crash.c
@@ -36,3 +37,15 @@ listen_and_print_CFLAGS = \
listen_and_print_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
+
+im_client_SOURCES = \
+ im-client.c
+
+im_client_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+im_client_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
diff --git a/tests/im-client.c b/tests/im-client.c
new file mode 100644
index 0000000..cdf3484
--- /dev/null
+++ b/tests/im-client.c
@@ -0,0 +1,21 @@
+
+#include <glib.h>
+#include "libindicate/indicator-message.h"
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ IndicateIndicatorMessage * indicator;
+
+ indicator = indicate_indicator_message_new();
+ indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "subtype", "im");
+ indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "sender", "Ted Gould");
+ indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "time", "11:11");
+ indicate_indicator_show(indicator);
+
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+
+ return 0;
+}