diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2012-01-31 16:28:45 -0500 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2012-01-31 16:28:45 -0500 |
commit | 748220dfce0042b84ebbdc747e0dec5ca1a99c7c (patch) | |
tree | 14152162aaed21ee5c70931f3e8ea49cf7247c2b | |
parent | c98fcf22ea1daad156b04f9109968e1c38d7a173 (diff) |
channel-factory-iface: remove
\o/
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | docs/reference/telepathy-glib-docs.sgml | 1 | ||||
-rw-r--r-- | docs/reference/telepathy-glib-sections.txt | 26 | ||||
-rw-r--r-- | examples/cm/extended/conn.c | 4 | ||||
-rw-r--r-- | telepathy-glib/Makefile.am | 2 | ||||
-rw-r--r-- | telepathy-glib/base-connection.c | 303 | ||||
-rw-r--r-- | telepathy-glib/base-connection.h | 2 | ||||
-rw-r--r-- | telepathy-glib/channel-factory-iface.c | 340 | ||||
-rw-r--r-- | telepathy-glib/channel-factory-iface.h | 227 | ||||
-rw-r--r-- | tests/lib/simple-conn.c | 4 |
9 files changed, 14 insertions, 895 deletions
diff --git a/docs/reference/telepathy-glib-docs.sgml b/docs/reference/telepathy-glib-docs.sgml index f4f783ef7..538bd3431 100644 --- a/docs/reference/telepathy-glib-docs.sgml +++ b/docs/reference/telepathy-glib-docs.sgml @@ -164,7 +164,6 @@ <chapter id="ch-obsolete"> <title>Obsolete modules</title> - <xi:include href="xml/channel-factory-iface.xml"/> <xi:include href="xml/debug-ansi.xml"/> </chapter> diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index 622563e50..1369adef7 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -104,32 +104,6 @@ TpBaseConnectionManagerPrivate </SECTION> <SECTION> -<INCLUDE>telepathy-glib/channel-factory-iface.h</INCLUDE> -<FILE>channel-factory-iface</FILE> -TpChannelFactoryIfaceForeachImpl -TpChannelFactoryIfaceProc -TpChannelFactoryIfaceRequestImpl -TpChannelFactoryRequestStatus -<TITLE>TpChannelFactoryIface</TITLE> -TpChannelFactoryIface -TpChannelFactoryIfaceClass -tp_channel_factory_iface_close_all -tp_channel_factory_iface_connecting -tp_channel_factory_iface_connected -tp_channel_factory_iface_disconnected -tp_channel_factory_iface_foreach -tp_channel_factory_iface_request -tp_channel_factory_iface_emit_new_channel -tp_channel_factory_iface_emit_channel_error -<SUBSECTION Standard> -TP_CHANNEL_FACTORY_IFACE -TP_IS_CHANNEL_FACTORY_IFACE -TP_TYPE_CHANNEL_FACTORY_IFACE -tp_channel_factory_iface_get_type -TP_CHANNEL_FACTORY_IFACE_GET_CLASS -</SECTION> - -<SECTION> <INCLUDE>telepathy-glib/channel-manager.h</INCLUDE> <FILE>channel-manager</FILE> TpChannelManagerChannelClassFunc diff --git a/examples/cm/extended/conn.c b/examples/cm/extended/conn.c index 60672084b..7bb53b540 100644 --- a/examples/cm/extended/conn.c +++ b/examples/cm/extended/conn.c @@ -135,7 +135,7 @@ create_handle_repos (TpBaseConnection *conn, } static GPtrArray * -create_channel_factories (TpBaseConnection *conn) +create_channel_managers (TpBaseConnection *conn) { return g_ptr_array_sized_new (0); } @@ -215,7 +215,7 @@ example_extended_connection_class_init (ExampleExtendedConnectionClass *klass) base_class->create_handle_repos = create_handle_repos; base_class->get_unique_connection_name = get_unique_connection_name; - base_class->create_channel_factories = create_channel_factories; + base_class->create_channel_managers = create_channel_managers; base_class->start_connecting = start_connecting; base_class->shut_down = shut_down; diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am index 1b11417f6..91dd224a6 100644 --- a/telepathy-glib/Makefile.am +++ b/telepathy-glib/Makefile.am @@ -42,7 +42,6 @@ our_headers = \ channel-iface.h \ channel-dispatcher.h \ channel-dispatch-operation.h \ - channel-factory-iface.h \ channel-manager.h \ channel-request.h \ client.h \ @@ -224,7 +223,6 @@ libtelepathy_glib_internal_la_SOURCES = \ heap.c \ intset.c \ channel-iface.c \ - channel-factory-iface.c \ message.c \ message-internal.h \ message-mixin.c \ diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c index f16626356..759f0fe65 100644 --- a/telepathy-glib/base-connection.c +++ b/telepathy-glib/base-connection.c @@ -26,7 +26,7 @@ * @see_also: #TpBaseConnectionManager, #TpSvcConnection * * This base class makes it easier to write #TpSvcConnection implementations - * by managing connection status, channel factories and handle tracking. + * by managing connection status, channel managers and handle tracking. * A subclass should often not need to implement any of the Connection * methods itself. * @@ -86,18 +86,6 @@ */ /** - * TpBaseConnectionCreateChannelFactoriesImpl: - * @self: The implementation, a subclass of TpBaseConnection - * - * Signature of an implementation of the create_channel_factories method - * of #TpBaseConnection. - * - * Returns: (transfer full): a GPtrArray of objects implementing - * #TpChannelFactoryIface which, between them, implement all channel types - * this Connection supports. - */ - -/** * TpBaseConnectionCreateChannelManagersImpl: * @self: The implementation, a subclass of TpBaseConnection * @@ -128,10 +116,6 @@ * given array for all those handle types this Connection supports. * Must be set by subclasses to a non-%NULL value; the function must create * at least a CONTACT handle repository (failing to do so will cause a crash). - * @create_channel_factories: Create an array of channel factories for this - * Connection. At least one of this or @create_channel_managers must be set by - * subclasses to a non-%NULL value; in new code, setting this to %NULL and - * using channel managers exclusively is recommended. * @get_unique_connection_name: Construct a unique name for this connection * (for example using the protocol's format for usernames). If %NULL (the * default), a unique name will be generated. Subclasses should usually @@ -160,8 +144,7 @@ * value; so if you're doing a sub-subclass of TpBaseConnection, you should use * tp_base_connection_add_interfaces(). * @create_channel_managers: Create an array of channel managers for this - * Connection. At least one of this or @create_channel_factories must be set - * by subclasses to a non-%NULL value. + * Connection. This must be set by subclasses to a non-%NULL value. * Since: 0.7.15 * * The class of a #TpBaseConnection. Many members are virtual methods etc. @@ -238,7 +221,6 @@ #include <dbus/dbus-glib-lowlevel.h> -#include <telepathy-glib/channel-factory-iface.h> #include <telepathy-glib/channel-manager.h> #include <telepathy-glib/connection-manager.h> #include <telepathy-glib/contacts-mixin.h> @@ -373,8 +355,6 @@ struct _TpBaseConnectionPrivate /* if TRUE, the object has gone away */ gboolean dispose_has_run; - /* array of (TpChannelFactoryIface *) */ - GPtrArray *channel_factories; /* array of (TpChannelManager *) */ GPtrArray *channel_managers; /* array of (ChannelRequest *) */ @@ -594,10 +574,6 @@ tp_base_connection_dispose (GObject *object) tp_clear_object (&priv->bus_proxy); - g_ptr_array_foreach (priv->channel_factories, (GFunc) g_object_unref, NULL); - g_ptr_array_unref (priv->channel_factories); - priv->channel_factories = NULL; - g_ptr_array_foreach (priv->channel_managers, (GFunc) g_object_unref, NULL); g_ptr_array_unref (priv->channel_managers); priv->channel_managers = NULL; @@ -662,31 +638,11 @@ get_channel_details (GObject *obj) g_value_take_boxed (value, object_path); object_path = NULL; - g_assert (TP_IS_EXPORTABLE_CHANNEL (obj) || TP_IS_CHANNEL_IFACE (obj)); - - if (TP_IS_EXPORTABLE_CHANNEL (obj)) - { - g_object_get (obj, - "channel-properties", &table, - NULL); - } - else - { - table = g_hash_table_new_full (g_str_hash, g_str_equal, - NULL, (GDestroyNotify) tp_g_value_slice_free); - - value = tp_g_value_slice_new (G_TYPE_UINT); - g_object_get_property (obj, "handle", value); - g_hash_table_insert (table, TP_PROP_CHANNEL_TARGET_HANDLE, value); - - value = tp_g_value_slice_new (G_TYPE_UINT); - g_object_get_property (obj, "handle-type", value); - g_hash_table_insert (table, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, value); + g_assert (TP_IS_EXPORTABLE_CHANNEL (obj)); - value = tp_g_value_slice_new (G_TYPE_STRING); - g_object_get_property (obj, "channel-type", value); - g_hash_table_insert (table, TP_PROP_CHANNEL_CHANNEL_TYPE, value); - } + g_object_get (obj, + "channel-properties", &table, + NULL); g_value_array_append (structure, NULL); value = g_value_array_get_nth (structure, 1); @@ -696,66 +652,6 @@ get_channel_details (GObject *obj) return structure; } - -static GPtrArray * -find_matching_channel_requests (TpBaseConnection *conn, - const gchar *channel_type, - guint handle_type, - guint handle, - ChannelRequest *channel_request) -{ - TpBaseConnectionPrivate *priv = conn->priv; - GPtrArray *requests; - guint i; - - requests = g_ptr_array_sized_new (1); - - if (handle_type == 0) - { - /* It's an anonymous channel, which can only satisfy the request for - * which it was created (or if it's returned as EXISTING, it can only - * satisfy the request for which it was returned as EXISTING). - */ - g_assert (handle == 0); - g_assert (channel_request == NULL || - tp_g_ptr_array_contains (priv->channel_requests, channel_request)); - - if (channel_request) - g_ptr_array_add (requests, channel_request); - - /* whether we've put any matches in requests or not */ - return requests; - } - - /* for identifiable channels (those which are to a particular handle), - * satisfy any queued requests. - */ - for (i = 0; i < priv->channel_requests->len; i++) - { - ChannelRequest *request = g_ptr_array_index (priv->channel_requests, i); - - if (tp_strdiff (request->channel_type, channel_type)) - continue; - - if (handle_type != request->handle_type) - continue; - - if (handle != request->handle) - continue; - - g_ptr_array_add (requests, request); - } - - /* if this channel was created or returned as a result of a particular - * request, that request had better be among the matching ones in the queue - */ - g_assert (channel_request == NULL || - tp_g_ptr_array_contains (requests, channel_request)); - - return requests; -} - - static void satisfy_request (TpBaseConnection *conn, ChannelRequest *request, @@ -809,52 +705,6 @@ satisfy_request (TpBaseConnection *conn, channel_request_free (request); } - -static void -factory_satisfy_requests (TpBaseConnection *conn, - TpChannelFactoryIface *factory, - TpChannelIface *chan, - ChannelRequest *channel_request, - gboolean is_new) -{ - gchar *object_path = NULL, *channel_type = NULL; - guint handle_type = 0, handle = 0; - GPtrArray *tmp; - guint i; - - g_object_get (chan, - "object-path", &object_path, - "channel-type", &channel_type, - "handle-type", &handle_type, - "handle", &handle, - NULL); - - DEBUG ("called for %s", object_path); - - tmp = find_matching_channel_requests (conn, channel_type, handle_type, - handle, channel_request); - - for (i = 0; i < tmp->len; i++) - satisfy_request (conn, g_ptr_array_index (tmp, i), G_OBJECT (chan), - object_path); - - if (is_new) - { - GPtrArray *array = g_ptr_array_sized_new (1); - - g_ptr_array_add (array, get_channel_details (G_OBJECT (chan))); - tp_svc_connection_interface_requests_emit_new_channels (conn, array); - g_value_array_free (g_ptr_array_index (array, 0)); - g_ptr_array_unref (array); - } - - g_ptr_array_unref (tmp); - - g_free (object_path); - g_free (channel_type); -} - - static void fail_channel_request (TpBaseConnection *conn, ChannelRequest *request, @@ -875,73 +725,6 @@ fail_channel_request (TpBaseConnection *conn, channel_request_free (request); } - -/* Channel factory signal handlers */ - -static void -factory_channel_closed_cb (GObject *channel, - TpBaseConnection *conn) -{ - gchar *object_path; - - g_object_get (channel, - "object-path", &object_path, - NULL); - - tp_svc_connection_interface_requests_emit_channel_closed (conn, - object_path); - - g_free (object_path); -} - -static void -factory_new_channel_cb (TpChannelFactoryIface *factory, - GObject *chan, - ChannelRequest *channel_request, - gpointer data) -{ - factory_satisfy_requests (TP_BASE_CONNECTION (data), factory, - TP_CHANNEL_IFACE (chan), channel_request, TRUE); - - g_signal_connect (chan, "closed", (GCallback) factory_channel_closed_cb, - data); -} - - -static void -factory_channel_error_cb (TpChannelFactoryIface *factory, - GObject *chan, - GError *error, - ChannelRequest *channel_request, - gpointer data) -{ - TpBaseConnection *conn = TP_BASE_CONNECTION (data); - gchar *channel_type = NULL; - guint handle_type = 0, handle = 0; - GPtrArray *tmp; - guint i; - - DEBUG ("channel_type=%s, handle_type=%u, handle=%u, error_code=%u, " - "error_message=\"%s\"", channel_type, handle_type, handle, - error->code, error->message); - - g_object_get (chan, - "channel-type", &channel_type, - "handle-type", &handle_type, - "handle", &handle, - NULL); - - tmp = find_matching_channel_requests (conn, channel_type, handle_type, - handle, channel_request); - - for (i = 0; i < tmp->len; i++) - fail_channel_request (conn, g_ptr_array_index (tmp, i), error); - - g_ptr_array_unref (tmp); - g_free (channel_type); -} - - /* Channel manager signal handlers */ static void @@ -1120,8 +903,7 @@ tp_base_connection_constructor (GType type, guint n_construct_properties, TpBaseConnectionClass *cls = TP_BASE_CONNECTION_GET_CLASS (self); g_assert (cls->create_handle_repos != NULL); - g_assert (cls->create_channel_factories != NULL || - cls->create_channel_managers != NULL); + g_assert (cls->create_channel_managers != NULL); g_assert (cls->shut_down != NULL); g_assert (cls->start_connecting != NULL); @@ -1134,25 +916,11 @@ tp_base_connection_constructor (GType type, guint n_construct_properties, /* a connection that doesn't support contacts is no use to anyone */ g_assert (priv->handles[TP_HANDLE_TYPE_CONTACT] != NULL); - if (cls->create_channel_factories != NULL) - priv->channel_factories = cls->create_channel_factories (self); - else - priv->channel_factories = g_ptr_array_sized_new (0); - if (cls->create_channel_managers != NULL) priv->channel_managers = cls->create_channel_managers (self); else priv->channel_managers = g_ptr_array_sized_new (0); - for (i = 0; i < priv->channel_factories->len; i++) - { - GObject *factory = g_ptr_array_index (priv->channel_factories, i); - g_signal_connect (factory, "new-channel", G_CALLBACK - (factory_new_channel_cb), self); - g_signal_connect (factory, "channel-error", G_CALLBACK - (factory_channel_error_cb), self); - } - for (i = 0; i < priv->channel_managers->len; i++) { TpChannelManager *manager = TP_CHANNEL_MANAGER ( @@ -1205,16 +973,6 @@ tp_base_connection_add_possible_client_interest (TpBaseConnection *self, /* D-Bus properties for the Requests interface */ static void -factory_get_channel_details_foreach (TpChannelIface *chan, - gpointer data) -{ - GPtrArray *details = data; - - g_ptr_array_add (details, get_channel_details (G_OBJECT (chan))); -} - - -static void manager_get_channel_details_foreach (TpExportableChannel *chan, gpointer data) { @@ -1228,21 +986,10 @@ static GPtrArray * conn_requests_get_channel_details (TpBaseConnection *self) { TpBaseConnectionPrivate *priv = self->priv; - /* guess that each ChannelManager and each ChannelFactory has two - * channels, on average */ - GPtrArray *details = g_ptr_array_sized_new (priv->channel_managers->len * 2 - + priv->channel_factories->len * 2); + /* guess that each ChannelManager has two channels, on average */ + GPtrArray *details = g_ptr_array_sized_new (priv->channel_managers->len * 2); guint i; - for (i = 0; i < priv->channel_factories->len; i++) - { - TpChannelFactoryIface *factory = TP_CHANNEL_FACTORY_IFACE ( - g_ptr_array_index (priv->channel_factories, i)); - - tp_channel_factory_iface_foreach (factory, - factory_get_channel_details_foreach, details); - } - for (i = 0; i < priv->channel_managers->len; i++) { TpChannelManager *manager = TP_CHANNEL_MANAGER ( @@ -1677,21 +1424,6 @@ tp_base_connection_register (TpBaseConnection *self, return TRUE; } -static void -tp_base_connection_close_all_channels (TpBaseConnection *self) -{ - TpBaseConnectionPrivate *priv = self->priv; - - /* We deliberately don't iterate over channel managers here - - * they don't need this, and are expected to listen to - * TpSvcConnection::status-changed on the connection for themselves. - */ - - /* trigger close_all on all channel factories */ - g_ptr_array_foreach (priv->channel_factories, (GFunc) - tp_channel_factory_iface_close_all, NULL); -} - /* D-Bus methods on Connection interface ----------------------------*/ static inline TpConnectionStatusReason @@ -2171,13 +1903,10 @@ tp_base_connection_disconnect_with_dbus_error (TpBaseConnection *self, * * <itemizedlist> * <listitem>Update #TpBaseConnection<!-- -->.status;</listitem> - * <listitem>If the new state is #TP_CONNECTION_STATUS_DISCONNECTED, call - * tp_channel_factory_iface_close_all() on all channel factories</listitem> * <listitem>Emit the D-Bus StatusChanged signal;</listitem> * <listitem>Call #TpBaseConnectionClass.connecting, * #TpBaseConnectionClass.connected or #TpBaseConnectionClass.disconnected * as appropriate;</listitem> - * <listitem>Call the channel factories' status change callbacks;</listitem> * <listitem>If the new state is #TP_CONNECTION_STATUS_DISCONNECTED, call the * subclass' #TpBaseConnectionClass.shut_down callback.</listitem> * </itemizedlist> @@ -2263,26 +1992,18 @@ tp_base_connection_change_status (TpBaseConnection *self, /* the presence of this array indicates that we are shutting down */ if (self->priv->disconnect_requests == NULL) self->priv->disconnect_requests = g_ptr_array_sized_new (0); - - /* remove all channels and shut down all factories, so we don't get - * any race conditions where method calls are delivered to a channel - * after we've started disconnecting - */ - tp_base_connection_close_all_channels (self); } DEBUG("emitting status-changed to %u, for reason %u", status, reason); tp_svc_connection_emit_status_changed (self, status, reason); - /* tell subclass and factories about the state change. In the case of + /* tell subclass about the state change. In the case of * disconnection, shut down afterwards */ switch (status) { case TP_CONNECTION_STATUS_CONNECTING: if (klass->connecting) (klass->connecting) (self); - g_ptr_array_foreach (priv->channel_factories, (GFunc) - tp_channel_factory_iface_connecting, NULL); break; case TP_CONNECTION_STATUS_CONNECTED: @@ -2294,8 +2015,6 @@ tp_base_connection_change_status (TpBaseConnection *self, self->self_handle, NULL)); if (klass->connected) (klass->connected) (self); - g_ptr_array_foreach (priv->channel_factories, (GFunc) - tp_channel_factory_iface_connected, NULL); break; case TP_CONNECTION_STATUS_DISCONNECTED: @@ -2314,8 +2033,6 @@ tp_base_connection_change_status (TpBaseConnection *self, { if (klass->disconnected) (klass->disconnected) (self); - g_ptr_array_foreach (priv->channel_factories, (GFunc) - tp_channel_factory_iface_disconnected, NULL); } (klass->shut_down) (self); tp_base_connection_unregister (self); diff --git a/telepathy-glib/base-connection.h b/telepathy-glib/base-connection.h index e5f5c62d0..314f484a0 100644 --- a/telepathy-glib/base-connection.h +++ b/telepathy-glib/base-connection.h @@ -87,8 +87,6 @@ struct _TpBaseConnectionClass { TpBaseConnectionCreateHandleReposImpl create_handle_repos; #endif - TpBaseConnectionCreateChannelFactoriesImpl create_channel_factories; - TpBaseConnectionGetUniqueConnectionNameImpl get_unique_connection_name; TpBaseConnectionProc connecting; diff --git a/telepathy-glib/channel-factory-iface.c b/telepathy-glib/channel-factory-iface.c deleted file mode 100644 index 586ee7ac0..000000000 --- a/telepathy-glib/channel-factory-iface.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * tp-channel-factory-iface.c - Stubs for Telepathy Channel Factory interface - * - * Copyright (C) 2006-2008 Collabora Ltd. - * Copyright (C) 2006-2008 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 - */ - -/** - * SECTION:channel-factory-iface - * @title: TpChannelFactoryIface - * @short_description: interface for channel allocation/tracking - * @see_also: #TpSvcConnection, #TpChannelManager - * - * A channel factory is attached to a connection. It carries out channel - * requests from the connection, and responds to channel-related events - * on the underlying network connection (e.g. incoming calls). - * - * Deprecated since version 0.11.7. Use #TpChannelManager, a newer - * interface which can be used to implement modern D-Bus APIs, instead. - * - * Deprecated: 0.11.7 - */ - -#include <telepathy-glib/channel-factory-iface.h> - -#include <glib-object.h> - -#include <telepathy-glib/channel-iface.h> - -#include "_gen/signals-marshal.h" - -enum { - NEW_CHANNEL, - CHANNEL_ERROR, - N_SIGNALS -}; - -static guint signals[N_SIGNALS] = {0}; - -static void -tp_channel_factory_iface_base_init (gpointer klass) -{ - static gboolean initialized = FALSE; - - if (!initialized) { - initialized = TRUE; - - /** - * TpChannelFactoryIface::new-channel: - * @self: an object implementing #TpChannelFactoryIface - * @channel: a new channel (an object implementing #TpChannelIface) - * @request_context: a request context as passed to - * tp_channel_factory_iface_request(), or %NULL - * - * Emitted when a new channel has been created. - * - * If the @channel was created in response to a channel request, the - * request was for a nonzero handle type, and the channel has zero handle - * type, @request_context will be the request context passed to - * tp_channel_factory_iface_request(). - * - * Otherwise, request may either be %NULL or a request that led to - * @channel's creation; callers are expected to determine which channels - * satisfy which requests based on the handle and handle-type. - */ - signals[NEW_CHANNEL] = g_signal_new ("new-channel", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, - 0, - NULL, NULL, - _tp_marshal_VOID__OBJECT_POINTER, - G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_POINTER); - - /** - * TpChannelFactoryIface::channel-error: - * @self: an object implementing #TpChannelFactoryIface - * @channel: an object implementing #TpChannelIface - * @error: the #GError that made the channel request fail - * @request_context: a request context as passed to - * tp_channel_factory_iface_request(), or %NULL - * - * Emitted when a new channel has been created, but an error occurred - * before it could become useful. - * - * @request is the same as for #TpChannelFactoryIface::new-channel. - */ - signals[CHANNEL_ERROR] = g_signal_new ("channel-error", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, - 0, - NULL, NULL, - _tp_marshal_VOID__OBJECT_POINTER_POINTER, - G_TYPE_NONE, - 3, G_TYPE_OBJECT, G_TYPE_POINTER, G_TYPE_POINTER); - } -} - -GType -tp_channel_factory_iface_get_type (void) -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof (TpChannelFactoryIfaceClass), - tp_channel_factory_iface_base_init, /* base_init */ - NULL, /* base_finalize */ - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - 0, - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "TpChannelFactoryIface", - &info, 0); - } - - return type; -} - -/** - * tp_channel_factory_iface_close_all: - * @self: An object implementing #TpChannelFactoryIface - * - * Close all channels and shut down the channel factory. It is not expected - * to be usable afterwards. This is called when the connection goes to - * disconnected state, before either emitting the StatusChanged signal or - * calling disconnected(). - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -void -tp_channel_factory_iface_close_all (TpChannelFactoryIface *self) -{ - void (*virtual_method)(TpChannelFactoryIface *) = - TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->close_all; - g_assert (virtual_method != NULL); - virtual_method (self); -} - -/** - * tp_channel_factory_iface_connecting: - * @self: An implementation of the channel factory interface - * - * Indicate that the connection has gone from disconnected to connecting - * state. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -void -tp_channel_factory_iface_connecting (TpChannelFactoryIface *self) -{ - void (*virtual_method)(TpChannelFactoryIface *) = - TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->connecting; - if (virtual_method) - virtual_method (self); -} - -/** - * tp_channel_factory_iface_connected: - * @self: An implementation of the channel factory interface - * - * Indicate that the connection has gone from connecting to connected state. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -void -tp_channel_factory_iface_connected (TpChannelFactoryIface *self) -{ - void (*virtual_method)(TpChannelFactoryIface *) = - TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->connected; - if (virtual_method) - virtual_method (self); -} - -/** - * tp_channel_factory_iface_disconnected: - * @self: An implementation of the channel factory interface - * - * Indicate that the connection has become disconnected. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -void -tp_channel_factory_iface_disconnected (TpChannelFactoryIface *self) -{ - void (*virtual_method)(TpChannelFactoryIface *) = - TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->disconnected; - if (virtual_method) - virtual_method (self); -} - -/** - * tp_channel_factory_iface_foreach: - * @self: An implementation of the channel factory interface - * @func: A callback to be called once per channel - * @data: Extra data to be passed to @func - * - * Call func(channel, data) for each channel managed by this factory. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -void -tp_channel_factory_iface_foreach (TpChannelFactoryIface *self, - TpChannelFunc func, - gpointer data) -{ - void (*virtual_method)(TpChannelFactoryIface *, TpChannelFunc, gpointer) = - TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->foreach; - g_assert (virtual_method != NULL); - virtual_method (self, func, data); -} - -/** - * tp_channel_factory_iface_request: - * @self: An object implementing #TpChannelFactoryIface - * @chan_type: The channel type, e.g. %TP_IFACE_CHANNEL_TYPE_TEXT - * @handle_type: The handle type of the channel's associated handle, - * or 0 if the channel has no associated handle - * @handle: The channel's associated handle, of type @handle_type, - * or 0 if the channel has no associated handle - * @request: An opaque data structure representing the channel request; - * if this request is satisfied by a newly created channel, - * this structure MUST be included in the new-channel signal - * if the newly created channel has handle 0, and MAY be - * included in the signal if the newly created channel has - * nonzero handle. - * @ret: Set to the new channel if it is available immediately, as - * documented in the description of #TpChannelFactoryRequestStatus - * @error: Set to the error if the return is - * %TP_CHANNEL_FACTORY_REQUEST_STATUS_ERROR, unset otherwise - * - * Request a channel. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - * - * Returns: one of the values of #TpChannelFactoryRequestStatus, and - * behaves as documented for that return value - */ -TpChannelFactoryRequestStatus -tp_channel_factory_iface_request (TpChannelFactoryIface *self, - const gchar *chan_type, - TpHandleType handle_type, - TpHandle handle, - gpointer request, - TpChannelIface **ret, - GError **error) -{ - TpChannelFactoryRequestStatus (*virtual_method) (TpChannelFactoryIface *, - const gchar *, TpHandleType, guint, gpointer, TpChannelIface **, - GError **) = TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->request; - g_assert (virtual_method != NULL); - return virtual_method (self, chan_type, handle_type, handle, request, - ret, error); -} - -/** - * tp_channel_factory_iface_emit_new_channel: - * @instance: An object implementing #TpChannelFactoryIface - * @channel: The new channel - * @request: A request context as passed to tp_channel_factory_iface_request(), - * or %NULL - * - * Signal that a new channel has been created (new-channel signal). - * - * If the channel was created in response to a channel request, the request - * was for a nonzero handle type, and the channel has zero handle type, - * request will be the request context passed to - * tp_channel_factory_iface_request(). - * - * Otherwise, request may either be - * %NULL or a request that led to the channel's creation; callers are expected - * to determine which channels satisfy which requests based on the handle - * and handle-type. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -void -tp_channel_factory_iface_emit_new_channel (gpointer instance, - TpChannelIface *channel, - gpointer context) -{ - g_signal_emit (instance, signals[NEW_CHANNEL], 0, channel, context); -} - -/** - * tp_channel_factory_iface_emit_channel_error: - * @instance: An object implementing #TpChannelFactoryIface - * @channel: The new channel - * @error: The error that made the channel request fail - * @request: A request context as passed to tp_channel_factory_iface_request(), - * or %NULL - * - * Signal that a new channel was created, but an error occurred before it - * could become useful. - * - * request is as for tp_channel_factory_iface_emit_new_channel(). - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -void -tp_channel_factory_iface_emit_channel_error (gpointer instance, - TpChannelIface *channel, - GError *error, - gpointer context) -{ - g_signal_emit (instance, signals[CHANNEL_ERROR], 0, channel, error, context); -} diff --git a/telepathy-glib/channel-factory-iface.h b/telepathy-glib/channel-factory-iface.h deleted file mode 100644 index 6ae303b19..000000000 --- a/telepathy-glib/channel-factory-iface.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - * tp-channel-factory-iface.h - Headers for Telepathy Channel Factory interface - * - * Copyright (C) 2006 Collabora Ltd. - * Copyright (C) 2006 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 __TP_CHANNEL_FACTORY_IFACE_H__ -#define __TP_CHANNEL_FACTORY_IFACE_H__ - -#include <glib-object.h> - -#include <telepathy-glib/channel-iface.h> -#include <telepathy-glib/enums.h> -#include <telepathy-glib/handle.h> - -G_BEGIN_DECLS - -#ifndef TP_DISABLE_DEPRECATED - -#define TP_TYPE_CHANNEL_FACTORY_IFACE (tp_channel_factory_iface_get_type ()) - -#define TP_CHANNEL_FACTORY_IFACE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - TP_TYPE_CHANNEL_FACTORY_IFACE, TpChannelFactoryIface)) - -#define TP_IS_CHANNEL_FACTORY_IFACE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - TP_TYPE_CHANNEL_FACTORY_IFACE)) - -#define TP_CHANNEL_FACTORY_IFACE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ - TP_TYPE_CHANNEL_FACTORY_IFACE, TpChannelFactoryIfaceClass)) - -/** - * TpChannelFactoryIface: - * - * Opaque typedef representing any channel factory implementation. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -typedef struct _TpChannelFactoryIface TpChannelFactoryIface; - -/* documented below */ -typedef struct _TpChannelFactoryIfaceClass TpChannelFactoryIfaceClass; - -/** - * TpChannelFactoryRequestStatus: - * @TP_CHANNEL_FACTORY_REQUEST_STATUS_NOT_IMPLEMENTED: Same as the Telepathy - * error NotImplemented. The connection will try the next factory in its - * list; if all return this, the overall result of the request will be - * NotImplemented. *@ret and *@error are not set - * @TP_CHANNEL_FACTORY_REQUEST_STATUS_NOT_AVAILABLE: Same as the Telepathy - * error NotAvailable. *@ret and *@error are not set - * @TP_CHANNEL_FACTORY_REQUEST_STATUS_INVALID_HANDLE: Same as the Telepathy - * error InvalidHandle. *@ret and *@error are not set - * @TP_CHANNEL_FACTORY_REQUEST_STATUS_ERROR: An error other than the above. - * *@ret is not set, *@error is set - * @TP_CHANNEL_FACTORY_REQUEST_STATUS_CREATED: A new channel was created - * (possibly in response to more than one request). new-channel has already - * been emitted and *@ret is set to the new channel. - * @TP_CHANNEL_FACTORY_REQUEST_STATUS_QUEUED: A new channel will be created, - * or was created but is not ready yet. Either new-channel or channel-error - * will be emitted later. *@ret and *@error are not set. - * @TP_CHANNEL_FACTORY_REQUEST_STATUS_EXISTING: An existing channel - * satisfies the request: new-channel was not emitted. *@ret is set to the - * existing channel. - * - * Indicates the result of a channel request. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -typedef enum { /*< skip >*/ - TP_CHANNEL_FACTORY_REQUEST_STATUS_NOT_IMPLEMENTED = 0, - TP_CHANNEL_FACTORY_REQUEST_STATUS_NOT_AVAILABLE, - TP_CHANNEL_FACTORY_REQUEST_STATUS_INVALID_HANDLE, - TP_CHANNEL_FACTORY_REQUEST_STATUS_ERROR, - TP_CHANNEL_FACTORY_REQUEST_STATUS_CREATED, - TP_CHANNEL_FACTORY_REQUEST_STATUS_QUEUED, - TP_CHANNEL_FACTORY_REQUEST_STATUS_EXISTING -} TpChannelFactoryRequestStatus; - -/** - * TpChannelFactoryIfaceProc: - * @self: An object implementing #TpChannelFactoryIface - * - * A virtual method on a channel factory that takes no extra parameters - * and returns nothing. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -typedef void (*TpChannelFactoryIfaceProc) (TpChannelFactoryIface *self); - -/** - * TpChannelFactoryIfaceRequestImpl: - * @self: An object implementing #TpChannelFactoryIface - * @chan_type: The channel type, e.g. %TP_IFACE_CHANNEL_TYPE_TEXT - * @handle_type: The handle type of the channel's associated handle, - * or 0 if the channel has no associated handle - * @handle: The channel's associated handle, of type @handle_type, - * or 0 if the channel has no associated handle - * @request: An opaque data structure representing the channel request; - * if this request is satisfied by a newly created channel, - * this structure MUST be included in the new-channel signal - * if the newly created channel has handle 0, and MAY be - * included in the signal if the newly created channel has - * nonzero handle. - * @ret: Set to the new channel if it is available immediately, as - * documented in the description of #TpChannelFactoryRequestStatus - * @error: Set to the error if the return is - * %TP_CHANNEL_FACTORY_REQUEST_STATUS_ERROR, unset otherwise - * - * Signature of an implementation of RequestChannel. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - * - * Returns: one of the values of #TpChannelFactoryRequestStatus, and - * behaves as documented for that return value - */ -typedef TpChannelFactoryRequestStatus (*TpChannelFactoryIfaceRequestImpl) ( - TpChannelFactoryIface *self, const gchar *chan_type, - TpHandleType handle_type, guint handle, gpointer request, - TpChannelIface **ret, GError **error); - -/** - * TpChannelFactoryIfaceForeachImpl: - * @self: An object implementing #TpChannelFactoryIface - * @func: A function - * @data: Arbitrary data to pass to @func as the second argument - * - * Signature of an implementation of foreach, which must call - * func(channel, data) for each channel managed by this factory. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -typedef void (*TpChannelFactoryIfaceForeachImpl) (TpChannelFactoryIface *self, - TpChannelFunc func, gpointer data); - -/** - * TpChannelFactoryIfaceClass: - * @parent_class: Fields shared with GTypeInterface - * @close_all: Close all channels and shut down the channel factory. It is not - * expected to be usable afterwards. This is called when the connection goes - * to disconnected state, before emitting the StatusChanged signal or calling - * disconnected(). Must be filled in by implementations. - * @connecting: Called just after the connection goes from disconnected to - * connecting state. May be NULL if nothing special needs to happen. - * @connected: Called just after the connection goes from connecting to - * connected state. May be NULL if nothing special needs to happen. - * @disconnected: Called just after the connection goes to disconnected state. - * This is always called after @close_all. May be NULL if nothing special - * needs to happen. - * @foreach: Call func(channel, data) for each channel managed by this - * factory. Must be filled in by implementations. - * @request: Respond to a request for a channel. Must be filled in by - * implementations. See #TpChannelFactoryIfaceRequestImpl for details. - * - * The class structure and vtable for a channel factory implementation. - * - * Deprecated since version 0.11.7. Use #TpChannelManager instead. - * - * Deprecated: 0.11.7 - */ -struct _TpChannelFactoryIfaceClass { - GTypeInterface parent_class; - - TpChannelFactoryIfaceProc close_all; - TpChannelFactoryIfaceProc connecting; - TpChannelFactoryIfaceProc connected; - TpChannelFactoryIfaceProc disconnected; - TpChannelFactoryIfaceForeachImpl foreach; - TpChannelFactoryIfaceRequestImpl request; -} _TP_GNUC_DEPRECATED; - -GType tp_channel_factory_iface_get_type (void); - -void tp_channel_factory_iface_close_all (TpChannelFactoryIface *self); - -void tp_channel_factory_iface_connecting (TpChannelFactoryIface *self); - -void tp_channel_factory_iface_connected (TpChannelFactoryIface *self); - -void tp_channel_factory_iface_disconnected (TpChannelFactoryIface *self); - -void tp_channel_factory_iface_foreach (TpChannelFactoryIface *self, - TpChannelFunc func, gpointer data); - -TpChannelFactoryRequestStatus tp_channel_factory_iface_request ( - TpChannelFactoryIface *self, const gchar *chan_type, - TpHandleType handle_type, guint handle, gpointer request, - TpChannelIface **ret, GError **error); - -void tp_channel_factory_iface_emit_new_channel (gpointer instance, - TpChannelIface *channel, gpointer request); - -void tp_channel_factory_iface_emit_channel_error (gpointer instance, - TpChannelIface *channel, GError *error, gpointer request); - -#endif /* not TP_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* __TP_CHANNEL_FACTORY_IFACE_H__ */ diff --git a/tests/lib/simple-conn.c b/tests/lib/simple-conn.c index e3f6f7941..f21b2d369 100644 --- a/tests/lib/simple-conn.c +++ b/tests/lib/simple-conn.c @@ -175,7 +175,7 @@ create_handle_repos (TpBaseConnection *conn, } static GPtrArray * -create_channel_factories (TpBaseConnection *conn) +create_channel_managers (TpBaseConnection *conn) { return g_ptr_array_sized_new (0); } @@ -271,7 +271,7 @@ tp_tests_simple_connection_class_init (TpTestsSimpleConnectionClass *klass) base_class->create_handle_repos = create_handle_repos; base_class->get_unique_connection_name = get_unique_connection_name; - base_class->create_channel_factories = create_channel_factories; + base_class->create_channel_managers = create_channel_managers; base_class->start_connecting = start_connecting; base_class->shut_down = shut_down; |