aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-04-24 04:32:02 +0800
committerChris Toshok <toshok@src.gnome.org>2003-04-24 04:32:02 +0800
commit3fa9162b67f4ef126264c38af659af610b01efd4 (patch)
tree387bddc5cf82a50e8df72622cd87c4156ba18930 /addressbook
parentfd2a3bcf17970eeea602fbcf2404f58a92afd77a (diff)
downloadgsoc2013-evolution-3fa9162b67f4ef126264c38af659af610b01efd4.tar.gz
gsoc2013-evolution-3fa9162b67f4ef126264c38af659af610b01efd4.tar.zst
gsoc2013-evolution-3fa9162b67f4ef126264c38af659af610b01efd4.zip
[ either mostly or entirely fixes #33708 ] new function, factor it out of
2003-04-23 Chris Toshok <toshok@ximian.com> [ either mostly or entirely fixes #33708 ] * gui/component/select-names/e-select-names-completion.c (e_select_names_completion_done): new function, factor it out of _seq_complete_cb because we need to run the same code in a couple of places. (e_select_names_completion_got_book_view_cb): treat an error from a book as getting a "sequence_complete", and decrement the count of pending complete signals. (e_select_names_completion_got_book_view_cb): remove the increment of pending_completion_seq from here. (e_select_names_completion_seq_complete_cb): factor out the body of e_select_names_completion_done from here, and call it. (e_select_names_completion_start_query): increment pending_completion_seq here. remove the async variable, as we can now use pending_completion_seq for that purpose (it's > 0 iff async would have been TRUE). svn path=/trunk/; revision=20943
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog19
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c49
2 files changed, 48 insertions, 20 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 691aeea2e8..293572bbd5 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,22 @@
+2003-04-23 Chris Toshok <toshok@ximian.com>
+
+ [ either mostly or entirely fixes #33708 ]
+ * gui/component/select-names/e-select-names-completion.c
+ (e_select_names_completion_done): new function, factor it out of
+ _seq_complete_cb because we need to run the same code in a couple
+ of places.
+ (e_select_names_completion_got_book_view_cb): treat an error from
+ a book as getting a "sequence_complete", and decrement the count
+ of pending complete signals.
+ (e_select_names_completion_got_book_view_cb): remove the increment
+ of pending_completion_seq from here.
+ (e_select_names_completion_seq_complete_cb): factor out the body
+ of e_select_names_completion_done from here, and call it.
+ (e_select_names_completion_start_query): increment
+ pending_completion_seq here. remove the async variable, as we can
+ now use pending_completion_seq for that purpose (it's > 0 iff
+ async would have been TRUE).
+
2003-04-19 Chris Toshok <toshok@ximian.com>
[ fixes bug #40954 ]
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 06e890f468..eb69f33afb 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ b/addressbook/gui/component/select-names/e-select-names-completion.c
@@ -731,17 +731,38 @@ e_select_names_completion_clear_cache (ESelectNamesCompletionBookData *book_data
}
static void
+e_select_names_completion_done (ESelectNamesCompletion *comp)
+{
+ g_free (comp->priv->query_text);
+ comp->priv->query_text = NULL;
+
+ e_completion_end_search (E_COMPLETION (comp)); /* That's all folks! */
+
+ /* Need to launch a new completion if another one is pending. */
+ if (comp->priv->waiting_query) {
+ gchar *s = comp->priv->waiting_query;
+ comp->priv->waiting_query = NULL;
+ e_completion_begin_search (E_COMPLETION (comp), s, comp->priv->waiting_pos, comp->priv->waiting_limit);
+ g_free (s);
+ }
+}
+
+static void
e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBookView *view, gpointer user_data)
{
ESelectNamesCompletion *comp;
ESelectNamesCompletionBookData *book_data;
- if (status != E_BOOK_STATUS_SUCCESS)
- return;
-
book_data = (ESelectNamesCompletionBookData*)user_data;
comp = book_data->comp;
+ if (status != E_BOOK_STATUS_SUCCESS) {
+ comp->priv->pending_completion_seq--;
+ if (!comp->priv->pending_completion_seq)
+ e_select_names_completion_done (comp);
+ return;
+ }
+
book_data->book_view_tag = 0;
if (book_data->card_added_tag) {
@@ -772,7 +793,6 @@ e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBo
G_CALLBACK (e_select_names_completion_seq_complete_cb),
book_data);
book_data->sequence_complete_received = FALSE;
- comp->priv->pending_completion_seq++;
}
static void
@@ -842,18 +862,7 @@ e_select_names_completion_seq_complete_cb (EBookView *book_view, EBookViewStatus
return;
}
- g_free (comp->priv->query_text);
- comp->priv->query_text = NULL;
-
- e_completion_end_search (E_COMPLETION (comp)); /* That's all folks! */
-
- /* Need to launch a new completion if another one is pending. */
- if (comp->priv->waiting_query) {
- gchar *s = comp->priv->waiting_query;
- comp->priv->waiting_query = NULL;
- e_completion_begin_search (E_COMPLETION (comp), s, comp->priv->waiting_pos, comp->priv->waiting_limit);
- g_free (s);
- }
+ e_select_names_completion_done (comp);
}
static void
@@ -923,7 +932,6 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar
sexp = book_query_sexp (comp);
if (sexp && *sexp) {
GList *l;
- gboolean async = FALSE;
if (out)
fprintf (out, "\n\n**** starting query: \"%s\"\n", comp->priv->query_text);
@@ -966,7 +974,6 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar
book_query_process_card_list (comp, book_data->cached_cards);
}
else {
- async = TRUE;
e_select_names_completion_clear_cache (book_data);
book_data->cached_query_text = g_strdup (query_text);
@@ -975,6 +982,8 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar
e_select_names_completion_got_book_view_cb, book_data);
if (! book_data->book_view_tag)
g_warning ("Exception calling e_book_get_completion_view");
+ else
+ comp->priv->pending_completion_seq++;
}
if (out)
@@ -985,8 +994,8 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar
and were able to complete based
solely on our cached cards, signal
that the search is over. */
- if (!async)
- e_completion_end_search (E_COMPLETION (comp));
+ if (!comp->priv->pending_completion_seq)
+ e_select_names_completion_done (E_COMPLETION (comp));
} else {
g_free (comp->priv->query_text);
comp->priv->query_text = NULL;