Make msg view show from/to address as only the "display" version
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 26 Nov 2008 16:17:22 +0000 (16:17 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 26 Nov 2008 16:17:22 +0000 (16:17 +0000)
pmo-drop-split-view-r6425

src/widgets/modest-compact-mail-header-view.c

index 3a30d5e..e86dfac 100644 (file)
@@ -61,7 +61,6 @@ struct _ModestCompactMailHeaderViewPriv
 
        gboolean     is_outgoing;
        gboolean     is_draft;
-       gchar        *first_address;
        
        TnyHeader    *header;
        TnyHeaderFlags priority_flags;
@@ -320,7 +319,6 @@ modest_compact_mail_header_view_instance_init (GTypeInstance *instance, gpointer
        PangoAttrList *attr_list;
 
        priv->header = NULL;
-       priv->first_address = NULL;
        priv->custom_labels = NULL;
 
        main_vbox = gtk_vbox_new (FALSE, 0);
@@ -632,6 +630,7 @@ fill_address (ModestCompactMailHeaderView *self)
        gchar *recipients;
        const gchar *label;
        GSList *recipient_list;
+       gchar *first_address;
        
        g_return_if_fail (MODEST_IS_COMPACT_MAIL_HEADER_VIEW (self));
        priv = MODEST_COMPACT_MAIL_HEADER_VIEW_GET_PRIVATE (self);
@@ -644,24 +643,26 @@ fill_address (ModestCompactMailHeaderView *self)
                recipients = tny_header_dup_from (TNY_HEADER (priv->header));
        }
 
-       g_free (priv->first_address);
        recipient_list = modest_text_utils_split_addresses_list (recipients);
        if (recipient_list == NULL) {
-               priv->first_address = NULL;
+               first_address = NULL;
        } else {
                gchar *first_recipient;
 
                first_recipient = (gchar *) recipient_list->data;
-               priv->first_address = first_recipient?g_strdup (first_recipient):NULL;
+               first_address = first_recipient?g_strdup (first_recipient):NULL;
        }
        g_slist_foreach (recipient_list, (GFunc) g_free, NULL);
        g_slist_free (recipient_list);
 
        gtk_label_set_text (GTK_LABEL (priv->fromto_label), label);
-       if (recipients)
-               gtk_label_set_text (GTK_LABEL (priv->fromto_contents), priv->first_address);
+       if (recipients) {
+               modest_text_utils_get_display_address (first_address);
+               gtk_label_set_text (GTK_LABEL (priv->fromto_contents), first_address);
+               g_free (recipients);
+               g_free (first_address);
+       }
 
-       g_free (recipients);
 }
 
 static void