diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-12-09 19:31:18 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-12-14 17:52:33 +0800 |
commit | aa802500fc09133e196a5087867a1743d3911100 (patch) | |
tree | 1f5af1acd5dc963f4dad2403b68d66d863a6d1a5 /libempathy/empathy-contact.c | |
parent | 844b932834beb6f15d454d14662ca7719bb28981 (diff) | |
download | gsoc2013-empathy-aa802500fc09133e196a5087867a1743d3911100.tar gsoc2013-empathy-aa802500fc09133e196a5087867a1743d3911100.tar.gz gsoc2013-empathy-aa802500fc09133e196a5087867a1743d3911100.tar.bz2 gsoc2013-empathy-aa802500fc09133e196a5087867a1743d3911100.tar.lz gsoc2013-empathy-aa802500fc09133e196a5087867a1743d3911100.tar.xz gsoc2013-empathy-aa802500fc09133e196a5087867a1743d3911100.tar.zst gsoc2013-empathy-aa802500fc09133e196a5087867a1743d3911100.zip |
empathy_contact_get_persona: use tpf_persona_dup_for_contact()
We can finally get rid of this horrible code iterating over all the
individuals. \o/
https://bugzilla.gnome.org/show_bug.cgi?id=665853
Diffstat (limited to 'libempathy/empathy-contact.c')
-rw-r--r-- | libempathy/empathy-contact.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 216ef6d73..c947fad62 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -1003,46 +1003,14 @@ empathy_contact_get_persona (EmpathyContact *contact) if (priv->persona == NULL && priv->tp_contact != NULL) { - /* FIXME: This is disgustingly slow */ - /* Query for the persona */ - EmpathyIndividualManager *manager; - GList *individuals, *l; + TpfPersona *persona; - manager = empathy_individual_manager_dup_singleton (); - individuals = empathy_individual_manager_get_members (manager); - - for (l = individuals; l != NULL; l = l->next) + persona = tpf_persona_dup_for_contact (priv->tp_contact); + if (persona != NULL) { - FolksIndividual *individual = FOLKS_INDIVIDUAL (l->data); - GeeSet *personas; - GeeIterator *iter; - gboolean persona_found = FALSE; - - personas = folks_individual_get_personas (individual); - iter = gee_iterable_iterator (GEE_ITERABLE (personas)); - while (!persona_found && gee_iterator_next (iter)) - { - TpfPersona *persona = gee_iterator_get (iter); - - if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (persona))) - { - TpContact *tp_contact = tpf_persona_get_contact (persona); - - if (tp_contact == priv->tp_contact) - { - /* Found the right persona */ - empathy_contact_set_persona (contact, - (FolksPersona *) persona); - persona_found = TRUE; - } - g_clear_object (&persona); - } - } - g_clear_object (&iter); + empathy_contact_set_persona (contact, (FolksPersona *) persona); + g_object_unref (persona); } - - g_list_free (individuals); - g_object_unref (manager); } return priv->persona; |