From 3cef144c507b7b51a02df43b7aea7499fa91924c Mon Sep 17 00:00:00 2001 From: Sean Gao Date: Thu, 23 Jan 2003 21:52:42 +0000 Subject: [ fixes bug #34898 ] handle modifications to email addresses in contact 2003-01-23 Sean Gao [ fixes bug #34898 ] * gui/widgets/e-minicard.c (field_changed): handle modifications to email addresses in contact lists. svn path=/trunk/; revision=19604 --- addressbook/gui/widgets/e-minicard.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'addressbook/gui') diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 4fa9ace991..dc679aad55 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -732,6 +732,8 @@ field_changed (EText *text, EMinicard *e_minicard) { ECardSimpleType type; char *string; + char *new_string; + gboolean is_list = FALSE; type = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(text), @@ -739,6 +741,31 @@ field_changed (EText *text, EMinicard *e_minicard) g_object_get(text, "text", &string, NULL); + + /* + * If the card is coresponding with a contact list and the field be + * changed is e-mail address, should wrap it before write it back. + */ + new_string = (char*)e_card_simple_get_const (e_minicard->simple, + E_CARD_SIMPLE_FIELD_IS_LIST); + + is_list = (NULL != new_string); + + if (is_list && (E_CARD_SIMPLE_FIELD_EMAIL == type || + E_CARD_SIMPLE_FIELD_EMAIL_2 == type || + E_CARD_SIMPLE_FIELD_EMAIL_3 == type)) { + if (string && *string) { + EDestination *dest = e_destination_new (); + if (dest != NULL){ + e_destination_set_email (dest, string); + new_string = e_destination_export(dest); + g_free(string); + string=new_string; + gtk_object_unref (GTK_OBJECT (dest)); + } + } + } + e_card_simple_set(e_minicard->simple, type, string); -- cgit v1.2.3