From 6c9c376c96da32a105598c7a10aba976599d350a Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Fri, 4 Jun 2004 18:39:34 +0000 Subject: only resolve destinations against persons, not contact lists. 2004-06-04 Chris Toshok * gui/component/select-names/e-select-names-model.c (name_and_email_simple_query_cb): only resolve destinations against persons, not contact lists. svn path=/trunk/; revision=26219 --- addressbook/ChangeLog | 6 +++ .../component/select-names/e-select-names-model.c | 48 ++++++++++++++-------- 2 files changed, 36 insertions(+), 18 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index fde4d317ad..b74468b05d 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,9 @@ +2004-06-04 Chris Toshok + + * gui/component/select-names/e-select-names-model.c + (name_and_email_simple_query_cb): only resolve destinations + against persons, not contact lists. + 2004-06-03 Hans Petter Jansson Fixes #53643 and #26903. diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c index 877f03a01a..60ad924dcd 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -600,30 +600,42 @@ name_and_email_simple_query_cb (EBook *book, EBookStatus status, GList *contacts ModelDestClosure *c = closure; EDestination *dest = c->dest; ESelectNamesModel *model = c->model; + EContact *contact; + int num_non_list_contacts = 0; + GList *l; g_free (c); - if (status == E_BOOK_ERROR_OK && g_list_length (contacts) == 1) { - EContact *contact = E_CONTACT (contacts->data); - const char *email = e_destination_get_email (dest); - int email_num = 0; - - if (email && *email) { - GList *email_list = e_contact_get (contact, E_CONTACT_EMAIL); - GList *l; - - for (l = email_list; l; l = l->next) { - if (!g_ascii_strcasecmp (email, l->data)) - break; - email_num++; + if (status == E_BOOK_ERROR_OK) { + for (l = contacts; l; l = l->next) { + EContact *c = E_CONTACT (l->data); + if (!e_contact_get (c, E_CONTACT_IS_LIST)) { + num_non_list_contacts++; + contact = c; } - if (l == NULL) - email_num = -1; } + + if (num_non_list_contacts == 1) { + const char *email = e_destination_get_email (dest); + int email_num = 0; - if (email_num >= 0) { - e_destination_set_contact (dest, contact, email_num); - e_select_names_model_changed (model); + if (email && *email) { + GList *email_list = e_contact_get (contact, E_CONTACT_EMAIL); + GList *l; + + for (l = email_list; l; l = l->next) { + if (!g_ascii_strcasecmp (email, l->data)) + break; + email_num++; + } + if (l == NULL) + email_num = -1; + } + + if (email_num >= 0) { + e_destination_set_contact (dest, contact, email_num); + e_select_names_model_changed (model); + } } } -- cgit v1.2.3