aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-dispatch-operation.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-06-20 02:54:38 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-06-20 02:54:38 +0800
commitf6e4c9ebc9374f787d623fbb787a2afd5407f5fe (patch)
tree90d4e27eb0310c84b1c4cac61a5979a5ce868ff9 /libempathy/empathy-dispatch-operation.c
parentc39c07e8c009170514ebcdfa0d9a639d673ee604 (diff)
downloadgsoc2013-empathy-f6e4c9ebc9374f787d623fbb787a2afd5407f5fe.tar
gsoc2013-empathy-f6e4c9ebc9374f787d623fbb787a2afd5407f5fe.tar.gz
gsoc2013-empathy-f6e4c9ebc9374f787d623fbb787a2afd5407f5fe.tar.bz2
gsoc2013-empathy-f6e4c9ebc9374f787d623fbb787a2afd5407f5fe.tar.lz
gsoc2013-empathy-f6e4c9ebc9374f787d623fbb787a2afd5407f5fe.tar.xz
gsoc2013-empathy-f6e4c9ebc9374f787d623fbb787a2afd5407f5fe.tar.zst
gsoc2013-empathy-f6e4c9ebc9374f787d623fbb787a2afd5407f5fe.zip
Always prepare both the Connection and the Channel
Diffstat (limited to 'libempathy/empathy-dispatch-operation.c')
-rw-r--r--libempathy/empathy-dispatch-operation.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c
index 68777a50e..83cf72483 100644
--- a/libempathy/empathy-dispatch-operation.c
+++ b/libempathy/empathy-dispatch-operation.c
@@ -217,6 +217,7 @@ dispatch_operation_connection_ready (TpConnection *connection,
EmpathyDispatchOperation *self = EMPATHY_DISPATCH_OPERATION (user_data);
EmpathyDispatchOperationPriv *priv = GET_PRIV (self);
TpHandle handle;
+ TpHandleType handle_type;
if (error != NULL)
goto out;
@@ -225,10 +226,18 @@ dispatch_operation_connection_ready (TpConnection *connection,
/* no point to get more information */
goto out;
- handle = tp_channel_get_handle (priv->channel, NULL);
-
- empathy_tp_contact_factory_get_from_handle (priv->connection, handle,
- dispatcher_operation_got_contact_cb, NULL, NULL, G_OBJECT (self));
+ handle = tp_channel_get_handle (priv->channel, &handle_type);
+ if (handle_type == TP_HANDLE_TYPE_CONTACT && priv->contact == NULL)
+ {
+ empathy_tp_contact_factory_get_from_handle (priv->connection, handle,
+ dispatcher_operation_got_contact_cb, NULL, NULL, G_OBJECT (self));
+ }
+ else
+ {
+ g_object_ref (self);
+ tp_channel_call_when_ready (priv->channel,
+ empathy_dispatch_operation_channel_ready_cb, self);
+ }
out:
g_object_unref (self);
@@ -239,8 +248,6 @@ empathy_dispatch_operation_constructed (GObject *object)
{
EmpathyDispatchOperation *self = EMPATHY_DISPATCH_OPERATION (object);
EmpathyDispatchOperationPriv *priv = GET_PRIV (self);
- TpHandle handle;
- TpHandleType handle_type;
empathy_dispatch_operation_set_status (self,
EMPATHY_DISPATCHER_OPERATION_STATE_PREPARING);
@@ -249,21 +256,9 @@ empathy_dispatch_operation_constructed (GObject *object)
g_signal_connect (priv->channel, "invalidated",
G_CALLBACK (empathy_dispatch_operation_invalidated), self);
- handle = tp_channel_get_handle (priv->channel, &handle_type);
-
- if (handle_type == TP_HANDLE_TYPE_CONTACT && priv->contact == NULL)
- {
- /* Ensure to keep the self object alive while the call_when_ready is
- * running */
- g_object_ref (self);
- tp_connection_call_when_ready (priv->connection,
- dispatch_operation_connection_ready, object);
- return;
- }
-
g_object_ref (self);
- tp_channel_call_when_ready (priv->channel,
- empathy_dispatch_operation_channel_ready_cb, self);
+ tp_connection_call_when_ready (priv->connection,
+ dispatch_operation_connection_ready, object);
}
static void