1 /* * Copyright (C) 2007-2009 Collabora Ltd.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 * Authors: Xavier Claessens <xclaesse@gmail.com>
18 * Sjoerd Simons <sjoerd.simons@collabora.co.uk>
19 * Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
22 #define DISPATCHER_BUS_NAME TP_CLIENT_BUS_NAME_BASE "Empathy"
23 #define DISPATCHER_OBJECT_PATH TP_CLIENT_OBJECT_PATH_BASE "Empathy"
29 #include <glib/gi18n-lib.h>
31 #include <telepathy-glib/account-manager.h>
32 #include <telepathy-glib/enums.h>
33 #include <telepathy-glib/connection.h>
34 #include <telepathy-glib/channel-dispatcher.h>
35 #include <telepathy-glib/channel-request.h>
36 #include <telepathy-glib/util.h>
37 #include <telepathy-glib/dbus.h>
38 #include <telepathy-glib/proxy-subclass.h>
39 #include <telepathy-glib/gtypes.h>
40 #include <telepathy-glib/defs.h>
41 #include <telepathy-glib/svc-client.h>
42 #include <telepathy-glib/svc-generic.h>
43 #include <telepathy-glib/interfaces.h>
45 #include <extensions/extensions.h>
47 #include "empathy-dispatcher.h"
48 #include "empathy-utils.h"
49 #include "empathy-tp-contact-factory.h"
50 #include "empathy-chatroom-manager.h"
51 #include "empathy-utils.h"
53 #define DEBUG_FLAG EMPATHY_DEBUG_DISPATCHER
54 #include <libempathy/empathy-debug.h>
56 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyDispatcher)
59 gboolean dispose_has_run;
61 TpAccountManager *account_manager;
62 /* connection to connection data mapping */
63 GHashTable *connections;
64 GHashTable *outstanding_classes_requests;
67 /* channels which the dispatcher is listening "invalidated" */
71 GHashTable *request_channel_class_async_ids;
72 /* reffed (TpAccount *) => gulong
73 * Signal handler ID of the "status-changed" signal */
74 GHashTable *status_changed_handlers;
76 TpChannelDispatcher *channel_dispatcher;
78 } EmpathyDispatcherPriv;
80 G_DEFINE_TYPE (EmpathyDispatcher, empathy_dispatcher, G_TYPE_OBJECT);
82 static EmpathyDispatcher *dispatcher = NULL;
84 static void dispatcher_init_connection_if_needed (
85 EmpathyDispatcher *dispatcher,
86 TpConnection *connection);
88 static GList * empathy_dispatcher_find_channel_classes
89 (EmpathyDispatcher *dispatcher, TpConnection *connection,
90 const gchar *channel_type, guint handle_type, GArray *fixed_properties);
95 /* Channel type specific wrapper object */
96 GObject *channel_wrapper;
101 /* ObjectPath -> EmpathyDispatchOperations */
102 GHashTable *dispatching_channels;
104 /* List of requestable channel classes */
105 GPtrArray *requestable_channels;
110 EmpathyDispatcher *dispatcher;
111 TpConnection *connection;
115 EmpathyDispatcherFindChannelClassCb *callback;
117 } FindChannelRequest;
119 static ConnectionData *
120 new_connection_data (void)
122 ConnectionData *cd = g_slice_new0 (ConnectionData);
124 cd->dispatching_channels = g_hash_table_new_full (g_str_hash, g_str_equal,
125 g_free, g_object_unref);
131 free_connection_data (ConnectionData *cd)
135 g_hash_table_destroy (cd->dispatching_channels);
137 if (cd->requestable_channels != NULL)
139 for (i = 0 ; i < cd->requestable_channels->len ; i++)
141 g_ptr_array_index (cd->requestable_channels, i));
142 g_ptr_array_free (cd->requestable_channels, TRUE);
147 free_find_channel_request (FindChannelRequest *r)
152 g_object_unref (r->dispatcher);
153 g_free (r->channel_type);
155 if (r->properties != NULL)
157 for (idx = 0; idx < r->properties->len ; idx++)
159 str = g_array_index (r->properties, char *, idx);
163 g_array_free (r->properties, TRUE);
166 g_slice_free (FindChannelRequest, r);
170 dispatcher_connection_invalidated_cb (TpConnection *connection,
174 EmpathyDispatcher *self)
176 EmpathyDispatcherPriv *priv = GET_PRIV (self);
178 DEBUG ("Error: %s", message);
180 g_hash_table_remove (priv->connections, connection);
184 dispatcher_channel_invalidated_cb (TpProxy *proxy,
188 EmpathyDispatcher *self)
190 /* Channel went away... */
191 EmpathyDispatcherPriv *priv = GET_PRIV (self);
192 TpConnection *connection;
194 const gchar *object_path;
196 connection = tp_channel_borrow_connection (TP_CHANNEL (proxy));
198 priv->channels = g_list_remove (priv->channels, proxy);
200 cd = g_hash_table_lookup (priv->connections, connection);
201 /* Connection itself invalidated? */
205 object_path = tp_proxy_get_object_path (proxy);
207 DEBUG ("Channel %s invalidated", object_path);
209 g_hash_table_remove (cd->dispatching_channels, object_path);
213 got_connection_rcc (EmpathyDispatcher *self,
214 TpConnection *connection)
216 EmpathyDispatcherPriv *priv = GET_PRIV (self);
217 TpCapabilities *caps;
220 FindChannelRequest *request;
223 caps = tp_connection_get_capabilities (connection);
224 g_assert (caps != NULL);
226 cd = g_hash_table_lookup (priv->connections, connection);
227 g_assert (cd != NULL);
229 cd->requestable_channels = g_boxed_copy (
230 TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST,
231 tp_capabilities_get_channel_classes (caps));
233 requests = g_hash_table_lookup (priv->outstanding_classes_requests,
236 for (l = requests; l != NULL; l = l->next)
240 retval = empathy_dispatcher_find_channel_classes (self,
241 connection, request->channel_type,
242 request->handle_type, request->properties);
243 request->callback (retval, request->user_data);
245 free_find_channel_request (request);
246 g_list_free (retval);
249 g_list_free (requests);
251 g_hash_table_remove (priv->outstanding_classes_requests, connection);
255 connection_prepare_cb (GObject *source,
256 GAsyncResult *result,
259 EmpathyDispatcher *self = EMPATHY_DISPATCHER (user_data);
260 GError *error = NULL;
261 TpConnection *connection = (TpConnection *) source;
263 if (!tp_proxy_prepare_finish (source, result, &error))
265 DEBUG ("Error: %s", error->message);
267 g_error_free (error);
271 got_connection_rcc (self, connection);
274 g_object_unref (self);
278 dispatcher_init_connection_if_needed (EmpathyDispatcher *self,
279 TpConnection *connection)
281 EmpathyDispatcherPriv *priv = GET_PRIV (self);
282 GQuark features[] = { TP_CONNECTION_FEATURE_CORE,
283 TP_CONNECTION_FEATURE_CAPABILITIES,
286 if (g_hash_table_lookup (priv->connections, connection) != NULL)
289 g_hash_table_insert (priv->connections, g_object_ref (connection),
290 new_connection_data ());
292 g_signal_connect (connection, "invalidated",
293 G_CALLBACK (dispatcher_connection_invalidated_cb), self);
295 /* Ensure to keep the self object alive while preparing the connection */
298 tp_proxy_prepare_async (connection, features, connection_prepare_cb, self);
302 dispatcher_status_changed_cb (TpAccount *account,
306 gchar *dbus_error_name,
308 EmpathyDispatcher *self)
310 TpConnection *conn = tp_account_get_connection (account);
313 dispatcher_init_connection_if_needed (self, conn);
317 remove_idle_handlers (gpointer key,
323 source_id = GPOINTER_TO_UINT (value);
324 g_source_remove (source_id);
328 dispatcher_constructor (GType type,
329 guint n_construct_params,
330 GObjectConstructParam *construct_params)
333 EmpathyDispatcherPriv *priv;
335 if (dispatcher != NULL)
336 return g_object_ref (dispatcher);
338 retval = G_OBJECT_CLASS (empathy_dispatcher_parent_class)->constructor
339 (type, n_construct_params, construct_params);
341 dispatcher = EMPATHY_DISPATCHER (retval);
342 g_object_add_weak_pointer (retval, (gpointer) &dispatcher);
344 priv = GET_PRIV (dispatcher);
350 dispatcher_dispose (GObject *object)
352 EmpathyDispatcherPriv *priv = GET_PRIV (object);
356 if (priv->dispose_has_run)
359 priv->dispose_has_run = TRUE;
361 g_hash_table_iter_init (&iter, priv->connections);
362 while (g_hash_table_iter_next (&iter, &connection, NULL))
364 g_signal_handlers_disconnect_by_func (connection,
365 dispatcher_connection_invalidated_cb, object);
368 g_hash_table_destroy (priv->connections);
369 priv->connections = NULL;
371 if (priv->channel_dispatcher != NULL)
372 g_object_unref (priv->channel_dispatcher);
373 priv->channel_dispatcher = NULL;
375 if (priv->dbus != NULL)
376 g_object_unref (priv->dbus);
379 G_OBJECT_CLASS (empathy_dispatcher_parent_class)->dispose (object);
383 dispatcher_finalize (GObject *object)
385 EmpathyDispatcherPriv *priv = GET_PRIV (object);
390 gpointer account, id;
392 if (priv->request_channel_class_async_ids != NULL)
394 g_hash_table_foreach (priv->request_channel_class_async_ids,
395 remove_idle_handlers, NULL);
396 g_hash_table_destroy (priv->request_channel_class_async_ids);
399 for (l = priv->channels; l; l = l->next)
401 g_signal_handlers_disconnect_by_func (l->data,
402 dispatcher_channel_invalidated_cb, object);
405 g_list_free (priv->channels);
407 g_hash_table_iter_init (&iter, priv->outstanding_classes_requests);
408 while (g_hash_table_iter_next (&iter, &connection, (gpointer *) &list))
410 g_list_foreach (list, (GFunc) free_find_channel_request, NULL);
414 g_hash_table_iter_init (&iter, priv->status_changed_handlers);
415 while (g_hash_table_iter_next (&iter, &account, &id))
417 g_signal_handler_disconnect (account, GPOINTER_TO_UINT (id));
419 g_hash_table_destroy (priv->status_changed_handlers);
421 g_object_unref (priv->account_manager);
423 g_hash_table_destroy (priv->outstanding_classes_requests);
427 empathy_dispatcher_class_init (EmpathyDispatcherClass *klass)
429 GObjectClass *object_class = G_OBJECT_CLASS (klass);
431 object_class->dispose = dispatcher_dispose;
432 object_class->finalize = dispatcher_finalize;
433 object_class->constructor = dispatcher_constructor;
435 g_type_class_add_private (object_class, sizeof (EmpathyDispatcherPriv));
439 connect_account (EmpathyDispatcher *self,
442 EmpathyDispatcherPriv *priv = GET_PRIV (self);
443 TpConnection *conn = tp_account_get_connection (account);
446 id = GPOINTER_TO_UINT (g_hash_table_lookup (priv->status_changed_handlers,
453 dispatcher_status_changed_cb (account, 0, 0, 0, NULL, NULL, self);
455 id = g_signal_connect (account, "status-changed",
456 G_CALLBACK (dispatcher_status_changed_cb), self);
458 g_hash_table_insert (priv->status_changed_handlers, g_object_ref (account),
459 GUINT_TO_POINTER (id));
463 account_manager_prepared_cb (GObject *source_object,
464 GAsyncResult *result,
468 EmpathyDispatcher *self = user_data;
469 TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
470 GError *error = NULL;
472 if (!tp_account_manager_prepare_finish (account_manager, result, &error))
474 DEBUG ("Failed to prepare account manager: %s", error->message);
475 g_error_free (error);
479 accounts = tp_account_manager_get_valid_accounts (account_manager);
480 for (l = accounts; l; l = l->next)
482 TpAccount *a = l->data;
484 connect_account (self, a);
487 g_list_foreach (accounts, (GFunc) g_object_ref, NULL);
488 g_list_free (accounts);
492 account_prepare_cb (GObject *source_object,
493 GAsyncResult *result,
496 EmpathyDispatcher *self = user_data;
497 TpAccount *account = TP_ACCOUNT (source_object);
498 GError *error = NULL;
500 if (!tp_account_prepare_finish (account, result, &error))
502 DEBUG ("Failed to prepare account: %s", error->message);
503 g_error_free (error);
507 connect_account (self, account);
511 account_validity_changed_cb (TpAccountManager *manager,
519 tp_account_prepare_async (account, NULL, account_prepare_cb, user_data);
523 empathy_dispatcher_init (EmpathyDispatcher *self)
525 EmpathyDispatcherPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
526 EMPATHY_TYPE_DISPATCHER, EmpathyDispatcherPriv);
529 priv->account_manager = tp_account_manager_dup ();
531 priv->connections = g_hash_table_new_full (g_direct_hash, g_direct_equal,
532 g_object_unref, (GDestroyNotify) free_connection_data);
534 priv->outstanding_classes_requests = g_hash_table_new_full (g_direct_hash,
535 g_direct_equal, g_object_unref, NULL);
537 priv->channels = NULL;
539 tp_account_manager_prepare_async (priv->account_manager, NULL,
540 account_manager_prepared_cb, self);
542 tp_g_signal_connect_object (priv->account_manager,
543 "account-validity-changed", G_CALLBACK (account_validity_changed_cb),
546 priv->request_channel_class_async_ids = g_hash_table_new (g_direct_hash,
548 priv->status_changed_handlers = g_hash_table_new_full (NULL, NULL,
549 (GDestroyNotify) g_object_unref, NULL);
551 priv->dbus = tp_dbus_daemon_dup (NULL);
552 priv->channel_dispatcher = tp_channel_dispatcher_new (priv->dbus);
556 empathy_dispatcher_dup_singleton (void)
558 return EMPATHY_DISPATCHER (g_object_new (EMPATHY_TYPE_DISPATCHER, NULL));
562 empathy_dispatcher_chat_with_contact (EmpathyContact *contact,
565 empathy_dispatcher_chat_with_contact_id (
566 empathy_contact_get_account (contact), empathy_contact_get_id (contact),
571 ensure_text_channel_cb (GObject *source,
572 GAsyncResult *result,
575 GError *error = NULL;
577 if (!tp_account_channel_request_ensure_channel_finish (
578 TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error))
580 DEBUG ("Failed to ensure text channel: %s", error->message);
581 g_error_free (error);
586 empathy_dispatcher_chat_with_contact_id (TpAccount *account,
587 const gchar *contact_id,
591 TpAccountChannelRequest *req;
593 request = tp_asv_new (
594 TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
595 TP_IFACE_CHANNEL_TYPE_TEXT,
596 TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
597 TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, contact_id,
600 req = tp_account_channel_request_new (account, request, timestamp);
602 tp_account_channel_request_ensure_channel_async (req, NULL, NULL,
603 ensure_text_channel_cb, NULL);
605 g_hash_table_unref (request);
606 g_object_unref (req);
610 empathy_dispatcher_join_muc (TpAccount *account,
611 const gchar *room_name,
615 TpAccountChannelRequest *req;
617 request = tp_asv_new (
618 TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
619 TP_IFACE_CHANNEL_TYPE_TEXT,
620 TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_ROOM,
621 TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, room_name,
624 req = tp_account_channel_request_new (account, request, timestamp);
626 tp_account_channel_request_ensure_channel_async (req, NULL, NULL,
627 ensure_text_channel_cb, NULL);
629 g_hash_table_unref (request);
630 g_object_unref (req);
634 channel_class_matches (GValueArray *class,
635 const char *channel_type,
637 GArray *fixed_properties)
645 v = g_value_array_get_nth (class, 0);
647 /* if the class doesn't match channel type discard it. */
648 fprops = g_value_get_boxed (v);
649 c_type = tp_asv_get_string (fprops, TP_IFACE_CHANNEL ".ChannelType");
651 if (tp_strdiff (channel_type, c_type))
654 /* we have the right channel type, see if the handle type matches */
655 h_type = tp_asv_get_uint32 (fprops,
656 TP_IFACE_CHANNEL ".TargetHandleType", &valid);
658 if (!valid || (handle_type != h_type && handle_type != TP_UNKNOWN_HANDLE_TYPE))
661 if (fixed_properties != NULL)
663 gpointer h_key, h_val;
668 g_hash_table_iter_init (&iter, fprops);
670 while (g_hash_table_iter_next (&iter, &h_key, &h_val))
672 /* discard ChannelType and TargetHandleType, as we already
675 if (!tp_strdiff ((char *) h_key, TP_IFACE_CHANNEL ".ChannelType") ||
677 ((char *) h_key, TP_IFACE_CHANNEL ".TargetHandleType"))
682 for (idx = 0; idx < fixed_properties->len; idx++)
684 /* if |key| doesn't exist in |fixed_properties|, discard
689 g_array_index (fixed_properties, char *, idx)))
692 /* exit the for() loop */
703 /* if no fixed_properties are specified, discard the classes
704 * with some fixed properties other than the two we already
707 if (g_hash_table_size (fprops) > 2)
715 empathy_dispatcher_find_channel_classes (EmpathyDispatcher *self,
716 TpConnection *connection,
717 const gchar *channel_type,
719 GArray *fixed_properties)
721 EmpathyDispatcherPriv *priv = GET_PRIV (self);
724 GList *matching_classes;
728 g_return_val_if_fail (channel_type != NULL, NULL);
730 cd = g_hash_table_lookup (priv->connections, connection);
735 classes = cd->requestable_channels;
739 matching_classes = NULL;
741 for (i = 0; i < classes->len; i++)
743 class = g_ptr_array_index (classes, i);
745 if (!channel_class_matches
746 (class, channel_type, handle_type, fixed_properties))
749 matching_classes = g_list_prepend (matching_classes, class);
752 return matching_classes;
756 find_channel_class_idle_cb (gpointer user_data)
760 FindChannelRequest *request = user_data;
762 gboolean is_ready = TRUE;
763 EmpathyDispatcherPriv *priv = GET_PRIV (request->dispatcher);
765 g_hash_table_remove (priv->request_channel_class_async_ids, request);
767 cd = g_hash_table_lookup (priv->connections, request->connection);
771 else if (cd->requestable_channels == NULL)
776 retval = empathy_dispatcher_find_channel_classes (request->dispatcher,
777 request->connection, request->channel_type, request->handle_type,
778 request->properties);
780 request->callback (retval, request->user_data);
781 free_find_channel_request (request);
782 g_list_free (retval);
787 requests = g_hash_table_lookup (priv->outstanding_classes_requests,
788 request->connection);
789 requests = g_list_prepend (requests, request);
791 g_hash_table_insert (priv->outstanding_classes_requests,
792 request->connection, requests);
798 setup_varargs (va_list var_args,
799 const char *channel_namespace,
800 const char *first_property_name)
806 if (first_property_name == NULL)
809 name = first_property_name;
810 properties = g_array_new (TRUE, TRUE, sizeof (char *));
814 name_full = g_strdup (name);
815 properties = g_array_append_val (properties, name_full);
816 name = va_arg (var_args, char *);
823 * empathy_dispatcher_find_requestable_channel_classes:
824 * @dispatcher: an #EmpathyDispatcher
825 * @connection: a #TpConnection
826 * @channel_type: a string identifying the type of the channel to lookup
827 * @handle_type: the handle type for the channel, or %TP_UNKNOWN_HANDLE_TYPE
828 * if you don't care about the channel's target handle type
829 * @first_property_name: %NULL, or the name of the first fixed property,
830 * followed optionally by more names, followed by %NULL.
832 * Returns all the channel classes that a client can request for the connection
833 * @connection, of the type identified by @channel_type, @handle_type and the
834 * fixed properties list.
835 * The classes which are compatible with a fixed properties list (i.e. those
836 * that will be returned by this function) are intended as those that do not
837 * contain any fixed property other than those in the list; note that this
838 * doesn't guarantee that all the classes compatible with the list will contain
839 * all the requested fixed properties, so the clients will have to filter
840 * the returned list themselves.
841 * If @first_property_name is %NULL, only the classes with no other fixed
842 * properties than ChannelType and TargetHandleType will be returned.
843 * Note that this function may return %NULL without performing any lookup if
844 * @connection is not ready. To ensure that @connection is always ready,
845 * use the empathy_dispatcher_find_requestable_channel_classes_async() variant.
847 * Return value: a #GList of #GValueArray objects, where the first element in
848 * the array is a #GHashTable of the fixed properties, and the second is
849 * a #GStrv of the allowed properties for the class. The list should be free'd
850 * with g_list_free() when done, but the objects inside the list are owned
851 * by the #EmpathyDispatcher and must not be modified.
854 empathy_dispatcher_find_requestable_channel_classes
855 (EmpathyDispatcher *self,
856 TpConnection *connection,
857 const gchar *channel_type,
859 const char *first_property_name,
864 EmpathyDispatcherPriv *priv;
869 g_return_val_if_fail (EMPATHY_IS_DISPATCHER (self), NULL);
870 g_return_val_if_fail (TP_IS_CONNECTION (connection), NULL);
871 g_return_val_if_fail (channel_type != NULL, NULL);
873 priv = GET_PRIV (self);
875 va_start (var_args, first_property_name);
877 properties = setup_varargs (var_args, channel_type, first_property_name);
881 retval = empathy_dispatcher_find_channel_classes (self, connection,
882 channel_type, handle_type, properties);
884 if (properties != NULL)
886 /* free the properties array */
887 for (idx = 0; idx < properties->len ; idx++)
889 str = g_array_index (properties, char *, idx);
893 g_array_free (properties, TRUE);
900 * empathy_dispatcher_find_requestable_channel_classes_async:
901 * @dispatcher: an #EmpathyDispatcher
902 * @connection: a #TpConnection
903 * @channel_type: a string identifying the type of the channel to lookup
904 * @handle_type: the handle type for the channel
905 * @callback: the callback to call when @connection is ready
906 * @user_data: the user data to pass to @callback
907 * @first_property_name: %NULL, or the name of the first fixed property,
908 * followed optionally by more names, followed by %NULL.
910 * Please see the documentation of
911 * empathy_dispatcher_find_requestable_channel_classes() for a detailed
912 * description of this function.
915 empathy_dispatcher_find_requestable_channel_classes_async
916 (EmpathyDispatcher *self,
917 TpConnection *connection,
918 const gchar *channel_type,
920 EmpathyDispatcherFindChannelClassCb callback,
922 const char *first_property_name,
927 FindChannelRequest *request;
928 EmpathyDispatcherPriv *priv;
931 g_return_if_fail (EMPATHY_IS_DISPATCHER (self));
932 g_return_if_fail (TP_IS_CONNECTION (connection));
933 g_return_if_fail (channel_type != NULL);
934 g_return_if_fail (handle_type != 0);
936 priv = GET_PRIV (self);
938 va_start (var_args, first_property_name);
940 properties = setup_varargs (var_args, channel_type, first_property_name);
944 /* append another request for this connection */
945 request = g_slice_new0 (FindChannelRequest);
946 request->dispatcher = g_object_ref (self);
947 request->channel_type = g_strdup (channel_type);
948 request->handle_type = handle_type;
949 request->connection = connection;
950 request->callback = callback;
951 request->user_data = user_data;
952 request->properties = properties;
954 source_id = g_idle_add (find_channel_class_idle_cb, request);
956 g_hash_table_insert (priv->request_channel_class_async_ids,
957 request, GUINT_TO_POINTER (source_id));