diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-11 23:25:48 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-11 23:25:48 +0800 |
commit | 0acfe96c871769588618423e547ffbf5b64556a7 (patch) | |
tree | bdd3586737dee8df7d814512a10848c30d35aa73 | |
parent | c0237abded41bde3f50d0434de3475e6a140a7b7 (diff) | |
download | gsoc2013-empathy-0acfe96c871769588618423e547ffbf5b64556a7.tar gsoc2013-empathy-0acfe96c871769588618423e547ffbf5b64556a7.tar.gz gsoc2013-empathy-0acfe96c871769588618423e547ffbf5b64556a7.tar.bz2 gsoc2013-empathy-0acfe96c871769588618423e547ffbf5b64556a7.tar.lz gsoc2013-empathy-0acfe96c871769588618423e547ffbf5b64556a7.tar.xz gsoc2013-empathy-0acfe96c871769588618423e547ffbf5b64556a7.tar.zst gsoc2013-empathy-0acfe96c871769588618423e547ffbf5b64556a7.zip |
EmpathyTpContactFactory: split on-ready code out of got_self_handle_cb
svn path=/trunk/; revision=1671
-rw-r--r-- | libempathy/empathy-tp-contact-factory.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c index b8e2ca37e..85921d0b2 100644 --- a/libempathy/empathy-tp-contact-factory.c +++ b/libempathy/empathy-tp-contact-factory.c @@ -60,6 +60,10 @@ enum { PROP_READY }; +/* Prototypes */ +static void tp_contact_factory_maybe_ready (EmpathyTpContactFactory *tp_factory); + + static EmpathyContact * tp_contact_factory_find_by_handle (EmpathyTpContactFactory *tp_factory, guint handle) @@ -727,22 +731,36 @@ tp_contact_factory_got_self_handle_cb (TpConnection *proxy, GObject *tp_factory) { EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); + + if (error) { + DEBUG ("Failed to get self handles: %s", error->message); + return; + } + + empathy_contact_set_handle (priv->user, handle); + + tp_contact_factory_maybe_ready (EMPATHY_TP_CONTACT_FACTORY (tp_factory)); +} + +static void +tp_contact_factory_maybe_ready (EmpathyTpContactFactory *tp_factory) +{ + EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); GList *l; GArray *handle_needed; GArray *id_needed; GList *handle_needed_contacts = NULL; GList *id_needed_contacts = NULL; - if (error) { - DEBUG ("Failed to get self handles: %s", error->message); + if (empathy_contact_get_handle (priv->user) == 0) { + DEBUG ("Connection not ready: still waiting for self handle"); return; } DEBUG ("Connection ready"); - empathy_contact_set_handle (priv->user, handle); priv->ready = TRUE; - g_object_notify (tp_factory, "ready"); + g_object_notify (G_OBJECT (tp_factory), "ready"); /* Connect signals */ tp_cli_connection_interface_aliasing_connect_to_aliases_changed (priv->connection, |