diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-03 11:34:34 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-10-07 11:25:24 +0200 |
commit | b7fe9542c721e1382625af485c35c2489319a7ac (patch) | |
tree | 9f58e28a9d752f7664b88d27f91282e6ee9db331 /telepathy-glib/client-channel-factory.c | |
parent | b889803a833eab6e65d15d3f806c90376932bfba (diff) | |
download | telepathy-glib-b7fe9542c721e1382625af485c35c2489319a7ac.tar.gz |
add client-channel-factory
Diffstat (limited to 'telepathy-glib/client-channel-factory.c')
-rw-r--r-- | telepathy-glib/client-channel-factory.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/telepathy-glib/client-channel-factory.c b/telepathy-glib/client-channel-factory.c new file mode 100644 index 000000000..0f0db762c --- /dev/null +++ b/telepathy-glib/client-channel-factory.c @@ -0,0 +1,90 @@ +/* + * Interface for channel factories + * + * Copyright © 2010 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 + */ + +/** + * SECTION:client-channel-factory + * @title: TpClientChannelFactoryInterface + * @short_description: an interface for client channel factories + * + * Client channel factories are used to create channel proxies. An application + * wanting to use its own #TpChannel subclass has to implement an object + * implementing the #TpClientChannelFactoryInterface interface. + */ + +/** + * TpClientChannelFactoryInterface: + * @parent: the parent + * @create_channel: the function used to create channels + * + * Interface for a channel factory + * + * Since: 0.13.UNRELEASED + */ + +#include "telepathy-glib/client-channel-factory.h" + +#include <telepathy-glib/util.h> + +#define DEBUG_FLAG TP_DEBUG_CLIENT +#include "telepathy-glib/debug-internal.h" + +G_DEFINE_INTERFACE(TpClientChannelFactory, tp_client_channel_factory, + G_TYPE_OBJECT) + +static void +tp_client_channel_factory_default_init (TpClientChannelFactoryInterface *iface) +{ +} + +/** + * tp_client_channel_factory_create_channel: + * @self: a client channel factory + * @conn: a #TpConnection + * @path: the object path of the channel + * @properties: (transfer none) (element-type utf8 GObject.Value): + * the immutable properties of the channel + * @error: used to indicate the error if %NULL is returned + * + * Function called when a channel need to be created. + * Implementation can return a subclass of #TpChannel if they need to. + * + * Returns: a new channel proxy, or %NULL on invalid arguments + * + * Since: 0.13.UNRELEASED + */ +TpChannel * +tp_client_channel_factory_create_channel (TpClientChannelFactoryInterface *self, + TpConnection *conn, + const gchar *path, + GHashTable *properties, + GError **error) +{ + TpClientChannelFactoryInterface *iface = TP_CLIENT_CHANNEL_FACTORY_GET_IFACE ( + self); + + g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL); + g_return_val_if_fail (path != NULL, NULL); + g_return_val_if_fail (properties != NULL, NULL); + + if (iface->create_channel != NULL) + return iface->create_channel (self, conn, path, properties, error); + + return tp_channel_new_from_properties (conn, path, properties, error); +} |