diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-10-27 12:02:25 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-10-27 12:02:25 +0800 |
commit | d08917c280e5297873588cd2aba3d9c2ce89a1a3 (patch) | |
tree | 16d9c7854f3a4ae747cbed0cdc0a7d0cef29e15c /addressbook/backend/ebook | |
parent | 3ba538184234389a2798fc75c7148e8d255a6cbc (diff) | |
download | gsoc2013-evolution-d08917c280e5297873588cd2aba3d9c2ce89a1a3.tar.gz gsoc2013-evolution-d08917c280e5297873588cd2aba3d9c2ce89a1a3.tar.zst gsoc2013-evolution-d08917c280e5297873588cd2aba3d9c2ce89a1a3.zip |
Return on cancellation. (simple_query_sequence_complete_cb): Act if not
2001-10-26 Jon Trowbridge <trow@ximian.com>
* backend/ebook/e-book-util.c (simple_query_card_added_cb): Return
on cancellation.
(simple_query_sequence_complete_cb): Act if not cancelled.
(simple_query_book_view_cb): Free & return on cancellation.
(e_book_simple_query_cancel): Set cancellation flag.
* gui/component/e-address-popup.c (e_address_popup_query): Hold a
reference to ourselves for the duration of our addressbook fetch.
(start_query): Release when we've fetched our addressbook.
(e_address_popup_cleanup): Break out most of what we do in
_destroy into a separate function.
(e_address_popup_destroy): Class cleanup.
(contact_editor_cb): Paranoid clean-up.
(add_contacts_cb): Paranoid clean-up.
(e_address_popup_ambiguous_email_add): Paranoid clean-up.
svn path=/trunk/; revision=14199
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r-- | addressbook/backend/ebook/e-book-util.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c index ffe18c62f8..753ace8575 100644 --- a/addressbook/backend/ebook/e-book-util.c +++ b/addressbook/backend/ebook/e-book-util.c @@ -138,6 +138,7 @@ struct _SimpleQueryInfo { guint add_tag; guint seq_complete_tag; GList *cards; + gboolean cancelled; }; static void @@ -199,6 +200,7 @@ simple_query_new (EBook *book, const char *query, EBookSimpleQueryCallback cb, g sq->query = g_strdup_printf (query); sq->cb = cb; sq->closure = closure; + sq->cancelled = FALSE; /* Automatically add ourselves to the EBook's pending list. */ book_add_simple_query (book, sq); @@ -228,13 +230,13 @@ simple_query_disconnect (SimpleQueryInfo *sq) static void simple_query_free (SimpleQueryInfo *sq) { + simple_query_disconnect (sq); + /* Remove ourselves from the EBook's pending list. */ book_remove_simple_query (sq->book, sq); g_free (sq->query); - simple_query_disconnect (sq); - if (sq->book) gtk_object_unref (GTK_OBJECT (sq->book)); @@ -249,6 +251,9 @@ simple_query_card_added_cb (EBookView *view, const GList *cards, gpointer closur { SimpleQueryInfo *sq = closure; + if (sq->cancelled) + return; + sq->cards = g_list_concat (sq->cards, g_list_copy ((GList *) cards)); g_list_foreach ((GList *) cards, (GFunc) gtk_object_ref, NULL); } @@ -261,7 +266,8 @@ simple_query_sequence_complete_cb (EBookView *view, gpointer closure) /* Disconnect signals, so that we don't pick up any changes to the book that occur in our callback */ simple_query_disconnect (sq); - sq->cb (sq->book, E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS, sq->cards, sq->closure); + if (! sq->cancelled) + sq->cb (sq->book, E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS, sq->cards, sq->closure); simple_query_free (sq); } @@ -270,7 +276,13 @@ simple_query_book_view_cb (EBook *book, EBookStatus status, EBookView *book_view { SimpleQueryInfo *sq = closure; + if (sq->cancelled) { + simple_query_free (sq); + return; + } + if (status != E_BOOK_STATUS_SUCCESS) { + simple_query_disconnect (sq); sq->cb (sq->book, E_BOOK_SIMPLE_QUERY_STATUS_OTHER_ERROR, NULL, sq->closure); simple_query_free (sq); return; @@ -314,8 +326,8 @@ e_book_simple_query_cancel (EBook *book, guint tag) sq = book_lookup_simple_query (book, tag); if (sq) { + sq->cancelled = TRUE; sq->cb (sq->book, E_BOOK_SIMPLE_QUERY_STATUS_CANCELLED, NULL, sq->closure); - simple_query_free (sq); } else { g_warning ("Simple query tag %d is unknown", tag); } |