[empathy] Update FolksPersona:alias when updating EmpathyContact:alias



commit d64a31579c0cdaa7013f5165f5111d57feb9b92e
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Jul 7 16:25:53 2010 +0100

    Update FolksPersona:alias when updating EmpathyContact:alias

 libempathy/empathy-contact.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 57a4449..20fe986 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -629,6 +629,16 @@ empathy_contact_set_alias (EmpathyContact *contact,
 
   g_object_ref (contact);
 
+  /* Set the alias on the persona if possible */
+  persona = empathy_contact_get_persona (contact);
+  if (persona != NULL && FOLKS_IS_ALIAS (persona))
+    {
+      DEBUG ("Setting alias for contact %s to %s",
+          empathy_contact_get_id (contact), alias);
+
+      folks_alias_set_alias (FOLKS_ALIAS (persona), alias);
+    }
+
   if (tp_strdiff (alias, priv->alias))
     {
       g_free (priv->alias);
@@ -768,6 +778,11 @@ empathy_contact_set_persona (EmpathyContact *contact,
   priv->persona = g_object_ref (persona);
 
   g_object_notify (G_OBJECT (contact), "persona");
+
+  /* Set the persona's alias, since ours could've been set using
+   * empathy_contact_set_alias() before we had a persona; this happens when
+   * adding a contact. */
+  empathy_contact_set_alias (contact, priv->alias);
 }
 
 TpConnection *



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