diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2009-11-27 19:29:14 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2009-11-27 19:29:14 +0000 |
commit | 10de892c149a6848bbf4177fc32b36e33a46b3f8 (patch) | |
tree | 6f3049683903201ca35b8839eef766d227da7fcc /gabble | |
parent | b2c3648cb89cc0a88e12f7671f2a5096db270128 (diff) |
Move headers available to plugins to gabble/
This makes it obvious which headers plugins can use, as well as making
it possible to write both gabble.pc and gabble-uninstalled.pc without
moving the whole of src/ to gabble/.
Diffstat (limited to 'gabble')
-rw-r--r-- | gabble/plugin.h | 106 | ||||
-rw-r--r-- | gabble/sidecar.h | 59 |
2 files changed, 165 insertions, 0 deletions
diff --git a/gabble/plugin.h b/gabble/plugin.h new file mode 100644 index 000000000..e5b2054af --- /dev/null +++ b/gabble/plugin.h @@ -0,0 +1,106 @@ +/* + * plugin.h — API for telepathy-gabble 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 __PLUGIN_H__ +#define __PLUGIN_H__ + +#include <glib-object.h> +#include <gio/gio.h> + +#include <telepathy-glib/base-connection.h> +#include <wocky/wocky-session.h> + +#include "sidecar.h" + +#define GABBLE_TYPE_PLUGIN (gabble_plugin_get_type ()) +#define GABBLE_PLUGIN(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GABBLE_TYPE_PLUGIN, GabblePlugin)) +#define GABBLE_IS_PLUGIN(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GABBLE_TYPE_PLUGIN)) +#define GABBLE_PLUGIN_GET_INTERFACE(obj) \ + (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GABBLE_TYPE_PLUGIN, \ + GabblePluginInterface)) + +typedef struct _GabblePlugin GabblePlugin; +typedef struct _GabblePluginInterface GabblePluginInterface; + +typedef void (*GabblePluginCreateSidecarImpl) ( + GabblePlugin *plugin, + const gchar *sidecar_interface, + TpBaseConnection *connection, + WockySession *session, + GAsyncReadyCallback callback, + gpointer user_data); + +struct _GabblePluginInterface { + GTypeInterface parent; + + /** + * An arbitrary human-readable name identifying this plugin. + */ + const gchar *name; + + /** + * A %NULL-terminated array of strings listing the sidecar D-Bus interfaces + * implemented by this plugin. + */ + const gchar * const *sidecar_interfaces; + + /** + * An implementation of gabble_plugin_create_sidecar(). + */ + GabblePluginCreateSidecarImpl create_sidecar; +}; + +GType gabble_plugin_get_type (void); + +const gchar *gabble_plugin_get_name ( + GabblePlugin *plugin); +const gchar * const *gabble_plugin_get_sidecar_interfaces ( + GabblePlugin *plugin); + +gboolean gabble_plugin_implements_sidecar ( + GabblePlugin *plugin, + const gchar *sidecar_interface); + +void gabble_plugin_create_sidecar ( + GabblePlugin *plugin, + const gchar *sidecar_interface, + TpBaseConnection *connection, + WockySession *session, + GAsyncReadyCallback callback, + gpointer user_data); + +GabbleSidecar *gabble_plugin_create_sidecar_finish ( + GabblePlugin *plugin, + GAsyncResult *result, + GError **error); + +/** + * gabble_plugin_create: + * + * Prototype for the plugin entry point. + * + * Returns: a new instance of this plugin, which must not be %NULL. + */ +GabblePlugin *gabble_plugin_create (void); + +typedef GabblePlugin *(*GabblePluginCreateImpl) (void); + +#endif diff --git a/gabble/sidecar.h b/gabble/sidecar.h new file mode 100644 index 000000000..531a7f95e --- /dev/null +++ b/gabble/sidecar.h @@ -0,0 +1,59 @@ +/* + * sidecar.h — interface for connection sidecars + * 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 __SIDECAR_H__ +#define __SIDECAR_H__ + +#include <glib-object.h> + +#define GABBLE_TYPE_SIDECAR (gabble_sidecar_get_type ()) +#define GABBLE_SIDECAR(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GABBLE_TYPE_SIDECAR, GabbleSidecar)) +#define GABBLE_IS_SIDECAR(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GABBLE_TYPE_SIDECAR)) +#define GABBLE_SIDECAR_GET_INTERFACE(obj) \ + (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GABBLE_TYPE_SIDECAR, \ + GabbleSidecarInterface)) + +typedef struct _GabbleSidecar GabbleSidecar; +typedef struct _GabbleSidecarInterface GabbleSidecarInterface; + +typedef GHashTable * (*GabbleSidecarGetImmutablePropertiesImpl) ( + GabbleSidecar *); + +struct _GabbleSidecarInterface { + GTypeInterface parent; + + /** + * The D-Bus interface implemented by this sidecar. + */ + const gchar *interface; + + /** + * An implementation of gabble_sidecar_get_immutable_properties(). + */ + GabbleSidecarGetImmutablePropertiesImpl get_immutable_properties; +}; + +GType gabble_sidecar_get_type (void); + +const gchar *gabble_sidecar_get_interface (GabbleSidecar *sidecar); +GHashTable *gabble_sidecar_get_immutable_properties (GabbleSidecar *sidecar); + +#endif |