summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2011-09-07 19:43:18 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2011-09-07 19:43:18 +0100
commit2f50192d79fcb9f4cfa670fcb8531993649fff3a (patch)
tree2a1421762b5c16638d442d2da00696af65075100
parentbe1c6ddf830329b477b1c0600eafcbf368379eaf (diff)
plugin-base: use more #defines to use fewer #ifdefs
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--plugin-base/channel-manager.c22
-rw-r--r--plugin-base/ytstenut.c39
2 files changed, 19 insertions, 42 deletions
diff --git a/plugin-base/channel-manager.c b/plugin-base/channel-manager.c
index a62eaec..0cf6e97 100644
--- a/plugin-base/channel-manager.c
+++ b/plugin-base/channel-manager.c
@@ -36,8 +36,12 @@
#ifdef SALUT
#include <salut/caps-channel-manager.h>
+typedef SalutConnection FooConnection;
+#define foo_connection_get_session salut_connection_get_session
#else
#include <gabble/caps-channel-manager.h>
+typedef GabbleConnection FooConnection;
+#define foo_connection_get_session gabble_connection_get_session
#endif
#include <telepathy-ytstenut-glib/telepathy-ytstenut-glib.h>
@@ -67,11 +71,7 @@ enum
/* private structure */
struct _YtstChannelManagerPrivate
{
-#ifdef SALUT
- SalutConnection *connection;
-#else
- GabbleConnection *connection;
-#endif
+ FooConnection *connection;
GQueue *channels;
gulong status_changed_id;
guint message_handler_id;
@@ -257,11 +257,7 @@ ytst_channel_manager_set_property (GObject *object,
static void
ytst_channel_manager_porter_available_cb (
-#ifdef SALUT
- SalutConnection *connection,
-#else
- GabbleConnection *connection,
-#endif
+ FooConnection *connection,
WockyPorter *porter,
YtstChannelManager *self)
{
@@ -321,11 +317,7 @@ ytst_channel_manager_dispose (GObject *object)
priv->dispose_has_run = TRUE;
-#ifdef SALUT
- session = salut_connection_get_session (priv->connection);
-#else
- session = gabble_connection_get_session (priv->connection);
-#endif
+ session = foo_connection_get_session (priv->connection);
if (session != NULL)
{
diff --git a/plugin-base/ytstenut.c b/plugin-base/ytstenut.c
index f2a7662..e293354 100644
--- a/plugin-base/ytstenut.c
+++ b/plugin-base/ytstenut.c
@@ -29,8 +29,14 @@
#ifdef SALUT
#include <salut/plugin.h>
#include <salut/protocol.h>
+typedef SalutPlugin FooPlugin;
+typedef SalutConnection FooConnection;
+typedef SalutSidecar FooSidecar;
#else
#include <gabble/plugin.h>
+typedef GabblePlugin FooPlugin;
+typedef GabbleConnection FooConnection;
+typedef GabbleSidecar FooSidecar;
#endif
#include <telepathy-ytstenut-glib/telepathy-ytstenut-glib.h>
@@ -81,17 +87,9 @@ ytstenut_plugin_initialize (SalutPlugin *plugin,
static void
ytstenut_plugin_create_sidecar (
-#ifdef SALUT
- SalutPlugin *plugin,
-#else
- GabblePlugin *plugin,
-#endif
+ FooPlugin *plugin,
const gchar *sidecar_interface,
-#ifdef SALUT
- SalutConnection *connection,
-#else
- GabbleConnection *connection,
-#endif
+ FooConnection *connection,
WockySession *session,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -107,19 +105,11 @@ ytstenut_plugin_create_sidecar (
gabble_plugin_create_sidecar
#endif
);
-#ifdef SALUT
- SalutSidecar *sidecar = NULL;
-#else
- GabbleSidecar *sidecar = NULL;
-#endif
+ FooSidecar *sidecar = NULL;
if (!tp_strdiff (sidecar_interface, TP_YTS_IFACE_STATUS))
{
-#ifdef SALUT
- sidecar = SALUT_SIDECAR (ytst_status_new (session, connection));
-#else
- sidecar = GABBLE_SIDECAR (ytst_status_new (session, connection));
-#endif
+ sidecar = (FooSidecar *) ytst_status_new (session, connection);
DEBUG ("created side car for: %s", TP_YTS_IFACE_STATUS);
}
else
@@ -137,11 +127,7 @@ ytstenut_plugin_create_sidecar (
static GPtrArray *
ytstenut_plugin_create_channel_managers (
-#ifdef SALUT
- SalutPlugin *plugin,
-#else
- GabblePlugin *plugin,
-#endif
+ FooPlugin *plugin,
TpBaseConnection *connection)
{
GPtrArray *ret = g_ptr_array_sized_new (1);
@@ -177,11 +163,10 @@ plugin_iface_init (gpointer g_iface,
iface->create_channel_managers = ytstenut_plugin_create_channel_managers;
}
+FooPlugin *
#ifdef SALUT
-SalutPlugin *
salut_plugin_create (void)
#else
-GabblePlugin *
gabble_plugin_create (void)
#endif
{