From c2c7bc59520288e69939727fd768d848328bdcad Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Mon, 17 Dec 2001 02:00:59 +0000 Subject: Added 'cache_complete' flag to ESelectNamesCompletionPrivate. 2001-12-16 Jon Trowbridge * gui/component/select-names/e-select-names-completion.c: Added 'cache_complete' flag to ESelectNamesCompletionPrivate. (e_select_names_completion_seq_complete_cb): Set cache_complete to TRUE if our query wasn't interrupted. (e_select_names_completion_start_query): Set cache_complete to FALSE at the beginning of a potentially-cached query. (e_select_names_completion_do_query): Only reuse cached cards if cache_complete is TRUE. (Fixes bug #10241) svn path=/trunk/; revision=15096 --- addressbook/ChangeLog | 11 +++++++++++ .../gui/component/select-names/e-select-names-completion.c | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index f42f3a00fd..7baceea223 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,14 @@ +2001-12-16 Jon Trowbridge + + * gui/component/select-names/e-select-names-completion.c: Added + 'cache_complete' flag to ESelectNamesCompletionPrivate. + (e_select_names_completion_seq_complete_cb): Set cache_complete + to TRUE if our query wasn't interrupted. + (e_select_names_completion_start_query): Set cache_complete to + FALSE at the beginning of a potentially-cached query. + (e_select_names_completion_do_query): Only reuse cached cards + if cache_complete is TRUE. (Fixes bug #10241) + 2001-12-15 JP Rosevear * conduit/address-conduit.c (e_addr_context_destroy): don't free 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 8e7843f149..eb15c4f232 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -67,6 +67,7 @@ struct _ESelectNamesCompletionPrivate { gchar *cached_query_text; GList *cached_cards; + gboolean cache_complete; gboolean match_contact_lists; gboolean primary_only; @@ -300,7 +301,7 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest) if (match <= E_CARD_MATCH_NONE) return NULL; - + score = match_len * 3; /* three points per match character */ #if 0 @@ -897,6 +898,11 @@ e_select_names_completion_seq_complete_cb (EBookView *book_view, gpointer user_d return; } + if (comp->priv->cached_query_text + && !comp->priv->cache_complete + && !strcmp (comp->priv->cached_query_text, comp->priv->query_text)) + comp->priv->cache_complete = TRUE; + g_free (comp->priv->query_text); comp->priv->query_text = NULL; @@ -983,6 +989,7 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar g_free (comp->priv->cached_query_text); comp->priv->cached_query_text = g_strdup (query_text); + comp->priv->cache_complete = FALSE; sexp = book_query_sexp (comp); if (sexp && *sexp) { @@ -1046,6 +1053,7 @@ e_select_names_completion_do_query (ESelectNamesCompletion *comp, const gchar *q fprintf (out, "cached: %s\n", comp->priv->cached_query_text); can_reuse_cached_cards = (comp->priv->cached_query_text + && comp->priv->cache_complete && (!comp->priv->can_fail_due_to_too_many_hits || comp->priv->cached_cards != NULL) && (strlen (comp->priv->cached_query_text) <= strlen (clean)) && !g_utf8_strncasecmp (comp->priv->cached_query_text, clean, strlen (comp->priv->cached_query_text))); -- cgit