diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-08-25 18:40:16 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-25 19:03:49 +0800 |
commit | fefe898e2ccbca4a0aa75d849073faef5d37bb65 (patch) | |
tree | 059c200c368ef2b5d6de342601c8f877c59a20f2 | |
parent | c2967dfd3643cd14dde26ad7e1a08479c0d6ee1f (diff) | |
download | gsoc2013-empathy-fefe898e2ccbca4a0aa75d849073faef5d37bb65.tar gsoc2013-empathy-fefe898e2ccbca4a0aa75d849073faef5d37bb65.tar.gz gsoc2013-empathy-fefe898e2ccbca4a0aa75d849073faef5d37bb65.tar.bz2 gsoc2013-empathy-fefe898e2ccbca4a0aa75d849073faef5d37bb65.tar.lz gsoc2013-empathy-fefe898e2ccbca4a0aa75d849073faef5d37bb65.tar.xz gsoc2013-empathy-fefe898e2ccbca4a0aa75d849073faef5d37bb65.tar.zst gsoc2013-empathy-fefe898e2ccbca4a0aa75d849073faef5d37bb65.zip |
Wait for the connection to be ready before requesting contacts from it.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | libempathy/empathy-dispatch-operation.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c index 79fe8c62d..d7afcbea6 100644 --- a/libempathy/empathy-dispatch-operation.c +++ b/libempathy/empathy-dispatch-operation.c @@ -201,6 +201,26 @@ dispatcher_operation_got_contact_cb (EmpathyTpContactFactory *factory, } static void +dispatch_operation_connection_ready (TpConnection *connection, + const GError *error, + gpointer user_data) +{ + EmpathyDispatchOperation *self = EMPATHY_DISPATCH_OPERATION (user_data); + EmpathyDispatchOperationPriv *priv = GET_PRIV (self); + EmpathyTpContactFactory *factory; + TpHandle handle; + + handle = tp_channel_get_handle (priv->channel, NULL); + + factory = empathy_tp_contact_factory_dup_singleton (priv->connection); + + empathy_tp_contact_factory_get_from_handle (factory, handle, + dispatcher_operation_got_contact_cb, NULL, NULL, G_OBJECT (self)); + + g_object_unref (factory); +} + +static void empathy_dispatch_operation_constructed (GObject *object) { EmpathyDispatchOperation *self = EMPATHY_DISPATCH_OPERATION (object); @@ -219,12 +239,8 @@ empathy_dispatch_operation_constructed (GObject *object) if (handle_type == TP_HANDLE_TYPE_CONTACT && priv->contact == NULL) { - EmpathyTpContactFactory *factory; - - factory = empathy_tp_contact_factory_dup_singleton (priv->connection); - empathy_tp_contact_factory_get_from_handle (factory, handle, - dispatcher_operation_got_contact_cb, NULL, NULL, object); - g_object_unref (factory); + tp_connection_call_when_ready (priv->connection, + dispatch_operation_connection_ready, object); return; } |