summaryrefslogtreecommitdiff
path: root/salut
diff options
context:
space:
mode:
authorSiraj Razick <siraj.razick@collabora.co.uk>2012-02-03 12:36:31 -0500
committerSiraj Razick <siraj.razick@collabora.co.uk>2012-02-17 15:46:51 -0500
commit2d9394fb317626a07105fc91f3a392d357d5f91c (patch)
tree1ae82625ce4d25da1c5d9fb4a23dd6f41fdd8885 /salut
parenta6f77caf370037002d2452e27e2d46feac7360aa (diff)
plugins: Introduce SalutPluginConnectionInterface interface
The library defines a new SalutPluginConnectionInterface which will be implemented by SalutConnection. And plugins can use SalutPluginConnection instead of using SalutConnection directly. This helps us to hide SalutConnection symbols in plugins.
Diffstat (limited to 'salut')
-rw-r--r--salut/connection.h6
-rw-r--r--salut/plugin-connection.h68
2 files changed, 72 insertions, 2 deletions
diff --git a/salut/connection.h b/salut/connection.h
index 0e292c0a..34a89363 100644
--- a/salut/connection.h
+++ b/salut/connection.h
@@ -23,6 +23,8 @@
#include <wocky/wocky.h>
+#include <salut/plugin-connection.h>
+
G_BEGIN_DECLS
#define SALUT_TYPE_CONNECTION (salut_connection_get_type ())
@@ -44,9 +46,9 @@ typedef struct _SalutConnectionClass SalutConnectionClass;
GType salut_connection_get_type (void);
-WockySession * salut_connection_get_session (SalutConnection *connection);
+WockySession * salut_connection_get_session (SalutPluginConnection *connection);
-const gchar * salut_connection_get_name (SalutConnection *connection);
+const gchar * salut_connection_get_name (SalutPluginConnection *connection);
G_END_DECLS
diff --git a/salut/plugin-connection.h b/salut/plugin-connection.h
new file mode 100644
index 00000000..bd71306c
--- /dev/null
+++ b/salut/plugin-connection.h
@@ -0,0 +1,68 @@
+/*
+ * plugin-connection.h — Connection API available to telepathy-salut plugins
+ * Copyright © 2012 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef SALUT_PLUGIN_CONNECTION_H
+#define SALUT_PLUGIN_CONNECTION_H
+
+#include <glib-object.h>
+
+#include <telepathy-glib/base-connection.h>
+#include <telepathy-glib/base-contact-list.h>
+
+#include <wocky/wocky.h>
+
+G_BEGIN_DECLS
+
+typedef struct _SalutPluginConnection SalutPluginConnection;
+typedef struct _SalutPluginConnectionInterface SalutPluginConnectionInterface;
+
+#define SALUT_TYPE_PLUGIN_CONNECTION (salut_plugin_connection_get_type ())
+#define SALUT_PLUGIN_CONNECTION(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), SALUT_TYPE_PLUGIN_CONNECTION, \
+ SalutPluginConnection))
+#define SALUT_IS_PLUGIN_CONNECTION(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), SALUT_TYPE_PLUGIN_CONNECTION))
+#define SALUT_PLUGIN_CONNECTION_GET_IFACE(o) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((o), SALUT_TYPE_PLUGIN_CONNECTION, \
+ SalutPluginConnectionInterface))
+
+GType salut_plugin_connection_get_type (void) G_GNUC_CONST;
+
+typedef WockySession * (*SalutPluginConnectionGetSessionFunc) (
+ SalutPluginConnection *plugin_connection);
+
+typedef const gchar * (*SalutPluginConnectionGetNameFunc) (
+ SalutPluginConnection *plugin_connection);
+
+struct _SalutPluginConnectionInterface
+{
+ GTypeInterface parent;
+ SalutPluginConnectionGetSessionFunc get_session;
+ SalutPluginConnectionGetNameFunc get_name;
+};
+
+WockySession *salut_plugin_connection_get_session (
+ SalutPluginConnection *plugin_connection);
+
+const gchar * salut_plugin_connection_get_name (
+ SalutPluginConnection *plugin_connection);
+
+G_END_DECLS
+
+#endif