[empathy: 68/80] Don't reset the alias when using empathy_contact_from_tpl_contact



commit f68071937c2340fd5560c29f4502db146a459b5a
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date:   Mon May 16 18:25:48 2011 +0100

    Don't reset the alias when using empathy_contact_from_tpl_contact
    
    contact_set_property() calls empathy_contact_set_alias(), which
    tries to set the alias on the FolksPersona, but we don't want to
    do that when creating an EmpathyContact from a TplEntity. So just
    set priv->alias instead of passing it to g_object_new() instead.

 libempathy/empathy-contact.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 5acf2ba..7c66a28 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -680,10 +680,20 @@ empathy_contact_from_tpl_contact (TpAccount *account,
 
   if (existing_contact != NULL)
     {
+      EmpathyContactPriv *priv;
+
       retval = g_object_new (EMPATHY_TYPE_CONTACT,
           "tp-contact", empathy_contact_get_tp_contact (existing_contact),
-          "alias", tpl_entity_get_alias (tpl_entity),
           NULL);
+
+      priv = GET_PRIV (retval);
+
+      /* contact_set_property() calls empathy_contact_set_alias(), which
+       * tries to set the alias on the FolksPersona, but we don't want to
+       * do that when creating an EmpathyContact from a TplEntity. So just
+       * set priv->alias instead of passing it to g_object_new() instead. */
+      g_free (priv->alias);
+      priv->alias = g_strdup (tpl_entity_get_alias (tpl_entity));
     }
   else
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]