diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-03-15 14:39:03 +0000 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-03-15 14:39:03 +0000 |
commit | 04c5ef4799db15e400bb407396c161e930ab2389 (patch) | |
tree | 6323ecaed695dfb428c1400b4f9c1c744f941935 /salut | |
parent | 5262d495ae17c65b654d22bcb9f1699d4d866143 (diff) |
plugins: add sidecar support to plugins
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'salut')
-rw-r--r-- | salut/Makefile.am | 3 | ||||
-rw-r--r-- | salut/plugin.h | 43 | ||||
-rw-r--r-- | salut/sidecar.h | 67 |
3 files changed, 112 insertions, 1 deletions
diff --git a/salut/Makefile.am b/salut/Makefile.am index 7419dff2..8c4f2e42 100644 --- a/salut/Makefile.am +++ b/salut/Makefile.am @@ -6,6 +6,7 @@ salutincludedir = $(includedir)/telepathy-salut-0/salut salutinclude_HEADERS = \ connection.h \ plugin.h \ - protocol.h + protocol.h \ + sidecar.h endif diff --git a/salut/plugin.h b/salut/plugin.h index 975446c6..c0f2a062 100644 --- a/salut/plugin.h +++ b/salut/plugin.h @@ -26,6 +26,11 @@ #include <telepathy-glib/base-connection-manager.h> #include <telepathy-glib/base-connection.h> +#include <wocky/wocky-session.h> + +#include <salut/connection.h> +#include <salut/sidecar.h> + G_BEGIN_DECLS #define SALUT_TYPE_PLUGIN (salut_plugin_get_type ()) @@ -40,6 +45,14 @@ G_BEGIN_DECLS typedef struct _SalutPlugin SalutPlugin; typedef struct _SalutPluginInterface SalutPluginInterface; +typedef void (*SalutPluginCreateSidecarImpl) ( + SalutPlugin *plugin, + const gchar *sidecar_interface, + SalutConnection *connection, + WockySession *session, + GAsyncReadyCallback callback, + gpointer user_data); + /* The caller of this function takes ownership of the returned * GPtrArray and the channel managers inside the array. This has the * same semantics as TpBaseConnectionCreateChannelManagersImpl. */ @@ -75,6 +88,17 @@ struct _SalutPluginInterface const gchar *version; /** + * A %NULL-terminated array of strings listing the sidecar D-Bus interfaces + * implemented by this plugin. + */ + const gchar * const *sidecar_interfaces; + + /** + * An implementation of salut_plugin_create_sidecar(). + */ + SalutPluginCreateSidecarImpl create_sidecar; + + /** * An implementation of salut_plugin_initialize(). */ SalutPluginInitializeImpl initialize; @@ -93,6 +117,25 @@ const gchar * salut_plugin_get_name ( SalutPlugin *plugin); const gchar * salut_plugin_get_version ( SalutPlugin *plugin); +const gchar * const *salut_plugin_get_sidecar_interfaces ( + SalutPlugin *plugin); + +gboolean salut_plugin_implements_sidecar ( + SalutPlugin *plugin, + const gchar *sidecar_interface); + +void salut_plugin_create_sidecar_async ( + SalutPlugin *plugin, + const gchar *sidecar_interface, + SalutConnection *connection, + WockySession *session, + GAsyncReadyCallback callback, + gpointer user_data); + +SalutSidecar * salut_plugin_create_sidecar_finish ( + SalutPlugin *plugin, + GAsyncResult *result, + GError **error); void salut_plugin_initialize ( SalutPlugin *plugin, diff --git a/salut/sidecar.h b/salut/sidecar.h new file mode 100644 index 00000000..3d521941 --- /dev/null +++ b/salut/sidecar.h @@ -0,0 +1,67 @@ +/* + * sidecar.h — sidecar API available to telepathy-salut plugins + * Copyright © 2009 Collabora Ltd. + * Copyright © 2009 Nokia Corporation + * + * 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_PLUGINS_SIDECAR_H +#define SALUT_PLUGINS_SIDECAR_H + +#include <glib-object.h> + +#include <salut/connection.h> + +G_BEGIN_DECLS + +#define SALUT_TYPE_SIDECAR (salut_sidecar_get_type ()) +#define SALUT_SIDECAR(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), SALUT_TYPE_SIDECAR, SalutSidecar)) +#define SALUT_IS_SIDECAR(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SALUT_TYPE_SIDECAR)) +#define SALUT_SIDECAR_GET_INTERFACE(obj) \ + (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SALUT_TYPE_SIDECAR, \ + SalutSidecarInterface)) + +typedef struct _SalutSidecar SalutSidecar; +typedef struct _SalutSidecarInterface SalutSidecarInterface; + +typedef GHashTable * (*SalutSidecarGetImmutablePropertiesImpl) ( + SalutSidecar *); + +struct _SalutSidecarInterface +{ + GTypeInterface parent; + + /** + * The D-Bus interface implemented by this sidecar. + */ + const gchar *interface; + + /** + * An implementation of salut_sidecar_get_immutable_properties(). + */ + SalutSidecarGetImmutablePropertiesImpl get_immutable_properties; +}; + +GType salut_sidecar_get_type (void); + +const gchar * salut_sidecar_get_interface (SalutSidecar *sidecar); +GHashTable * salut_sidecar_get_immutable_properties (SalutSidecar *sidecar); + +G_END_DECLS + +#endif |