From 35f50e44ed36185c64dffb6380b69ddc8542258c Mon Sep 17 00:00:00 2001 From: Nat Friedman Date: Mon, 25 Oct 2004 16:11:08 +0000 Subject: Display mutlivalued contact attributes in the preview. (render_contact): 2004-10-25 Nat Friedman * gui/widgets/eab-contact-display.c (accum_multival_attribute): Display mutlivalued contact attributes in the preview. (render_contact): Render all IM fields using the new multival function. svn path=/trunk/; revision=27720 --- addressbook/ChangeLog | 7 +++++++ addressbook/gui/widgets/eab-contact-display.c | 25 +++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 76750a6836..e812500c6a 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,10 @@ +2004-10-25 Nat Friedman + + * gui/widgets/eab-contact-display.c (accum_multival_attribute): + Display mutlivalued contact attributes in the preview. + (render_contact): Render all IM fields using the new multival + function. + 2004-10-21 JP Rosevear * gui/widgets/eab-config.c (ecph_class_init): correct hook name diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c index c90d071192..9e7d66cf3e 100644 --- a/addressbook/gui/widgets/eab-contact-display.c +++ b/addressbook/gui/widgets/eab-contact-display.c @@ -248,6 +248,19 @@ accum_attribute (GString *gstr, EContact *contact, const char *html_label, ECont } } +static void +accum_multival_attribute (GString *gstr, EContact *contact, const char *html_label, EContactField field, const char *icon, unsigned int html_flags) +{ + GList *val_list, *l; + + val_list = e_contact_get (contact, field); + for (l = val_list; l; l = l->next) { + const char *str = (const char *) l->data; + accum_name_value (gstr, html_label, str, icon, html_flags); + } + g_list_foreach (val_list, (GFunc) g_free, NULL); + g_list_free (val_list); +} static void render_contact_list (GtkHTMLStream *html_stream, EContact *contact) @@ -330,12 +343,12 @@ render_contact (GtkHTMLStream *html_stream, EContact *contact) g_string_assign (accum, ""); - accum_attribute (accum, contact, _("AIM"), E_CONTACT_IM_AIM_HOME_1, AIM_ICON, 0); - accum_attribute (accum, contact, _("GroupWise"), E_CONTACT_IM_GROUPWISE_HOME_1, GROUPWISE_ICON, 0); - accum_attribute (accum, contact, _("ICQ"), E_CONTACT_IM_ICQ_HOME_1, ICQ_ICON, 0); - accum_attribute (accum, contact, _("Jabber"), E_CONTACT_IM_JABBER_HOME_1, JABBER_ICON, 0); - accum_attribute (accum, contact, _("MSN"), E_CONTACT_IM_MSN_HOME_1, MSN_ICON, 0); - accum_attribute (accum, contact, _("Yahoo"), E_CONTACT_IM_YAHOO_HOME_1, YAHOO_ICON, 0); + accum_multival_attribute (accum, contact, _("AIM"), E_CONTACT_IM_AIM, AIM_ICON, 0); + accum_multival_attribute (accum, contact, _("GroupWise"), E_CONTACT_IM_GROUPWISE, GROUPWISE_ICON, 0); + accum_multival_attribute (accum, contact, _("ICQ"), E_CONTACT_IM_ICQ, ICQ_ICON, 0); + accum_multival_attribute (accum, contact, _("Jabber"), E_CONTACT_IM_JABBER, JABBER_ICON, 0); + accum_multival_attribute (accum, contact, _("MSN"), E_CONTACT_IM_MSN, MSN_ICON, 0); + accum_multival_attribute (accum, contact, _("Yahoo"), E_CONTACT_IM_YAHOO, YAHOO_ICON, 0); if (accum->len > 0) gtk_html_stream_printf (html_stream, accum->str); -- cgit v1.2.3