aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-12-17 10:00:59 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-12-17 10:00:59 +0800
commitc2c7bc59520288e69939727fd768d848328bdcad (patch)
treecaf1bf06d742c6c6279f63d2817cc78b08139915
parentfc59dc8c6f4429daf21f4251ae7f281784b54c55 (diff)
downloadgsoc2013-evolution-c2c7bc59520288e69939727fd768d848328bdcad.tar
gsoc2013-evolution-c2c7bc59520288e69939727fd768d848328bdcad.tar.gz
gsoc2013-evolution-c2c7bc59520288e69939727fd768d848328bdcad.tar.bz2
gsoc2013-evolution-c2c7bc59520288e69939727fd768d848328bdcad.tar.lz
gsoc2013-evolution-c2c7bc59520288e69939727fd768d848328bdcad.tar.xz
gsoc2013-evolution-c2c7bc59520288e69939727fd768d848328bdcad.tar.zst
gsoc2013-evolution-c2c7bc59520288e69939727fd768d848328bdcad.zip
Added 'cache_complete' flag to ESelectNamesCompletionPrivate.
2001-12-16 Jon Trowbridge <trow@ximian.com> * 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
-rw-r--r--addressbook/ChangeLog11
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c10
2 files changed, 20 insertions, 1 deletions
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 <trow@ximian.com>
+
+ * 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 <jpr@ximian.com>
* 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)));