summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2011-02-07 11:49:59 +0000
committerJonny Lamb <jonny.lamb@collabora.co.uk>2011-02-07 13:49:28 +0000
commit6195e787e6fb2c92cebe85ebd815210f0952a2f0 (patch)
treee69fd50e0a624897ea90e7b76c0e60af9f172d61 /plugins
parentaacd617f299de8836b41383634c452060f0dcf4f (diff)
downloadtelepathy-salut-6195e787e6fb2c92cebe85ebd815210f0952a2f0.tar.gz
plugins: add a test plugin
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am32
-rw-r--r--plugins/test.c41
-rw-r--r--plugins/test.h32
3 files changed, 105 insertions, 0 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
new file mode 100644
index 00000000..a28c8f2c
--- /dev/null
+++ b/plugins/Makefile.am
@@ -0,0 +1,32 @@
+plugindir = $(libdir)/telepathy/salut-0
+
+# testing-only plugins
+noinst_LTLIBRARIES = \
+ test.la
+
+installable_plugins =
+ $(NULL)
+
+if ENABLE_PLUGINS
+plugin_LTLIBRARIES = $(installable_plugins)
+else
+# we still compile the plugin (just to make sure it compiles!) but we don't
+# install it
+noinst_LTLIBRARIES += $(installable_plugins)
+endif
+
+AM_LDFLAGS = -module -avoid-version -shared
+
+test_la_SOURCES = \
+ test.c \
+ test.h
+
+# because test.la is not installed, libtool will want to compile it as static
+# despite -shared (a convenience library), unless we also use -rpath
+test_la_LDFLAGS = $(AM_LDFLAGS) -rpath $(plugindir)
+
+AM_CFLAGS = $(ERROR_CFLAGS) \
+ -I $(top_srcdir) -I $(top_builddir) \
+ @GLIB_CFLAGS@ \
+ -I $(top_srcdir)/salut -I $(top_builddir)/salut \
+ -I $(top_srcdir)/plugins
diff --git a/plugins/test.c b/plugins/test.c
new file mode 100644
index 00000000..36d66b5d
--- /dev/null
+++ b/plugins/test.c
@@ -0,0 +1,41 @@
+#include "test.h"
+
+#include <salut/plugin.h>
+
+#define DEBUG(msg, ...) \
+ g_debug ("%s: " msg, G_STRFUNC, ##__VA_ARGS__)
+
+static void plugin_iface_init (
+ gpointer g_iface,
+ gpointer data);
+
+G_DEFINE_TYPE_WITH_CODE (TestPlugin, test_plugin, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (SALUT_TYPE_PLUGIN, plugin_iface_init);
+ )
+
+static void
+test_plugin_init (TestPlugin *object)
+{
+ DEBUG ("%p", object);
+}
+
+static void
+test_plugin_class_init (TestPluginClass *klass)
+{
+}
+
+static void
+plugin_iface_init (
+ gpointer g_iface,
+ gpointer data G_GNUC_UNUSED)
+{
+ SalutPluginInterface *iface = g_iface;
+
+ iface->name = "Salut test plugin";
+}
+
+SalutPlugin *
+salut_plugin_create ()
+{
+ return g_object_new (test_plugin_get_type (), NULL);
+}
diff --git a/plugins/test.h b/plugins/test.h
new file mode 100644
index 00000000..13e11e4c
--- /dev/null
+++ b/plugins/test.h
@@ -0,0 +1,32 @@
+#include <glib-object.h>
+
+typedef struct _TestPluginClass TestPluginClass;
+typedef struct _TestPlugin TestPlugin;
+
+struct _TestPluginClass
+{
+ GObjectClass parent;
+};
+
+struct _TestPlugin
+{
+ GObject parent;
+};
+
+GType test_plugin_get_type (void);
+
+#define TEST_TYPE_PLUGIN \
+ (test_plugin_get_type ())
+#define TEST_PLUGIN(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), TEST_TYPE_PLUGIN, TestPlugin))
+#define TEST_PLUGIN_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), TEST_TYPE_PLUGIN, \
+ TestPluginClass))
+#define TEST_IS_PLUGIN(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), TEST_TYPE_PLUGIN))
+#define TEST_IS_PLUGIN_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), TEST_TYPE_PLUGIN))
+#define TEST_PLUGIN_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_PLUGIN, \
+ TestPluginClass))
+