From 6195e787e6fb2c92cebe85ebd815210f0952a2f0 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Mon, 7 Feb 2011 11:49:59 +0000 Subject: plugins: add a test plugin Signed-off-by: Jonny Lamb --- plugins/Makefile.am | 32 ++++++++++++++++++++++++++++++++ plugins/test.c | 41 +++++++++++++++++++++++++++++++++++++++++ plugins/test.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 plugins/Makefile.am create mode 100644 plugins/test.c create mode 100644 plugins/test.h (limited to 'plugins') 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 + +#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 + +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)) + -- cgit v1.2.1