aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-08-18 08:30:30 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-08-18 08:30:30 +0800
commitf0b16735709dfa6d7a4bbdc53dfb120b5d1ee13d (patch)
tree44e0edbfbc98426cc15e96ed89d2435330eda080 /addressbook
parentc351fabe58b6eabc5ff3915e15dbb90d5f10792f (diff)
downloadgsoc2013-evolution-f0b16735709dfa6d7a4bbdc53dfb120b5d1ee13d.tar
gsoc2013-evolution-f0b16735709dfa6d7a4bbdc53dfb120b5d1ee13d.tar.gz
gsoc2013-evolution-f0b16735709dfa6d7a4bbdc53dfb120b5d1ee13d.tar.bz2
gsoc2013-evolution-f0b16735709dfa6d7a4bbdc53dfb120b5d1ee13d.tar.lz
gsoc2013-evolution-f0b16735709dfa6d7a4bbdc53dfb120b5d1ee13d.tar.xz
gsoc2013-evolution-f0b16735709dfa6d7a4bbdc53dfb120b5d1ee13d.tar.zst
gsoc2013-evolution-f0b16735709dfa6d7a4bbdc53dfb120b5d1ee13d.zip
If we get the "sequence_complete" signal when we aren't searching, it
2001-08-17 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names-completion.c (e_select_names_completion_seq_complete_cb): If we get the "sequence_complete" signal when we aren't searching, it means the addressbook changed out from under us. Clear the search cache, so that future completion requests won't use the out-of-date cached data. Also, don't unref book_view... we leave the EBookView open so that we can catch these addressbook changes. (e_select_names_completion_do_query): Don't use the book_view being non-NULL as a sign that another query is still running. (e_select_names_completion_got_book_view_cb): Properly unref any previous value in book_view. svn path=/trunk/; revision=12184
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog14
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c43
2 files changed, 39 insertions, 18 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 997c8a480b..a0a006be3f 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,17 @@
+2001-08-17 Jon Trowbridge <trow@ximian.com>
+
+ * gui/component/select-names/e-select-names-completion.c
+ (e_select_names_completion_seq_complete_cb): If we get the
+ "sequence_complete" signal when we aren't searching, it means the
+ addressbook changed out from under us. Clear the search cache, so
+ that future completion requests won't use the out-of-date cached
+ data. Also, don't unref book_view... we leave the EBookView open
+ so that we can catch these addressbook changes.
+ (e_select_names_completion_do_query): Don't use the book_view
+ being non-NULL as a sign that another query is still running.
+ (e_select_names_completion_got_book_view_cb): Properly unref any
+ previous value in book_view.
+
2001-08-17 Christopher James Lahey <clahey@ximian.com>
* gui/widgets/e-addressbook-reflow-adapter.c
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 e0568311ae..d8a8d69ea7 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ b/addressbook/gui/component/select-names/e-select-names-completion.c
@@ -782,7 +782,9 @@ e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBo
comp->priv->cancelled = FALSE;
comp->priv->book_view_tag = 0;
-
+
+ if (comp->priv->book_view)
+ gtk_object_unref (GTK_OBJECT (comp->priv->book_view));
comp->priv->book_view = view;
gtk_object_ref (GTK_OBJECT (view));
@@ -790,6 +792,7 @@ e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBo
"card_added",
GTK_SIGNAL_FUNC (e_select_names_completion_card_added_cb),
comp);
+
gtk_signal_connect (GTK_OBJECT (view),
"sequence_complete",
GTK_SIGNAL_FUNC (e_select_names_completion_seq_complete_cb),
@@ -801,14 +804,16 @@ e_select_names_completion_card_added_cb (EBookView *book_view, const GList *card
{
ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (user_data);
- if (! comp->priv->cancelled)
+
+ if (! comp->priv->cancelled) {
book_query_process_card_list (comp, cards);
- /* Save the list of matching cards. */
- while (cards) {
- comp->priv->cached_cards = g_list_prepend (comp->priv->cached_cards, cards->data);
- gtk_object_ref (GTK_OBJECT (cards->data));
- cards = g_list_next (cards);
+ /* Save the list of matching cards. */
+ while (cards) {
+ comp->priv->cached_cards = g_list_prepend (comp->priv->cached_cards, cards->data);
+ gtk_object_ref (GTK_OBJECT (cards->data));
+ cards = g_list_next (cards);
+ }
}
}
@@ -817,19 +822,21 @@ e_select_names_completion_seq_complete_cb (EBookView *book_view, gpointer user_d
{
ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (user_data);
- gtk_object_unref (GTK_OBJECT (comp->priv->book_view));
-
- comp->priv->book_view = NULL;
+ /*
+ * We aren't searching, but the addressbook has changed -- clear our card cache so that
+ * future completion requests will take the changes into account.
+ */
+ if (! e_completion_searching (E_COMPLETION (comp))) {
+ e_select_names_completion_clear_cache (comp);
+ return;
+ }
g_free (comp->priv->query_text);
comp->priv->query_text = NULL;
if (out)
- fprintf (out, "ending search ");
- if (out && !e_completion_searching (E_COMPLETION (comp)))
- fprintf (out, "while not searching!");
- if (out)
- fprintf (out, "\n");
+ fprintf (out, "ending search\n");
+
e_completion_end_search (E_COMPLETION (comp)); /* That's all folks! */
/* Need to launch a new completion if another one is pending. */
@@ -936,7 +943,7 @@ e_select_names_completion_do_query (ESelectNamesCompletion *comp, const gchar *q
return;
}
- query_is_still_running = comp->priv->book_view_tag || comp->priv->book_view;
+ query_is_still_running = comp->priv->book_view_tag;
if (out) {
fprintf (out, "do_query: %s => %s\n", query_text, clean);
@@ -1094,9 +1101,7 @@ e_select_names_completion_book_ready (EBook *book, EBookStatus status, ESelectNa
{
comp->priv->book_ready = TRUE;
- g_return_if_fail (book != NULL);
g_return_if_fail (E_IS_BOOK (book));
- g_return_if_fail (comp != NULL);
g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp));
/* If waiting_query is non-NULL, someone tried to start a query before the book was ready.
@@ -1139,9 +1144,11 @@ e_select_names_completion_new (EBook *book, ESelectNamesModel *model)
e_book_load_local_address_book (comp->priv->book, (EBookCallback) e_select_names_completion_book_ready, comp);
} else {
+
comp->priv->book = book;
gtk_object_ref (GTK_OBJECT (comp->priv->book));
comp->priv->book_ready = TRUE;
+
}
comp->priv->model = model;