diff options
-rw-r--r-- | addressbook/ChangeLog | 5 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-completion.c | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index afcb37ba55..1034cb0f2f 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,10 @@ 2001-09-17 Jon Trowbridge <trow@ximian.com> + * gui/component/select-names/e-select-names-completion.c + (match_name): Fixed a stupid bug was causing completion to fail + for contacts who have only one name. (The classic example we all + know and love is 'George <jirka@5z.com>') (bug #8353) + * backend/ebook/e-card.c (e_card_list_send): Do the right thing if the card we are trying to send to has no valid e-mail addresses. (bug #10137) diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c index 178728fe9f..ff31e1d42e 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -250,10 +250,10 @@ sexp_name (ESelectNamesCompletion *comp) } enum { - MATCHED_NOTHING = 0, - MATCHED_GIVEN_NAME = 1<<0, + MATCHED_NOTHING = 0, + MATCHED_GIVEN_NAME = 1<<0, MATCHED_ADDITIONAL_NAME = 1<<1, - MATCHED_FAMILY_NAME = 1<<2 + MATCHED_FAMILY_NAME = 1<<2 }; /* @@ -287,7 +287,7 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest) const gchar *email; gchar *cpy, **strv; gint len, i, match_len = 0; - gint match = 0, first_match = 0; + gint match = MATCHED_NOTHING, first_match = MATCHED_NOTHING; double score = 0; gboolean have_given, have_additional, have_family; @@ -301,8 +301,8 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest) cpy = g_strdup (comp->priv->query_text); strv = g_strsplit (cpy, " ", 0); - for (i=0; strv[i] && !(match & MATCHED_NOTHING); ++i) { - gint this_match = 0; + for (i=0; strv[i] != NULL; ++i) { + gint this_match = MATCHED_NOTHING; g_strstrip (strv[i]); len = strlen (strv[i]); @@ -334,10 +334,10 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest) if (this_match != MATCHED_NOTHING) { match_len += len; match |= this_match; - if (first_match == 0) + if (i == 0) first_match = this_match; } else { - match = first_match = 0; + match = first_match = MATCHED_NOTHING; break; } @@ -371,7 +371,7 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest) if (have_family) menu_text = g_strdup_printf ("%s %s <%s>", card->name->given, card->name->family, email); else - menu_text = g_strdup_printf (card->name->given); + menu_text = g_strdup_printf ("%s <%s>", card->name->given, email); } else if (first_match == MATCHED_ADDITIONAL_NAME) { |