From aeec7106f7a3d6d1e4479c2ec596a506c4c281fa Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Fri, 7 Feb 2003 07:14:34 +0000 Subject: check the status, not the book, and unref the book here. 2003-02-06 Chris Toshok * gui/component/e-address-popup.c (email_table_save_card_cb): check the status, not the book, and unref the book here. (contact_editor_cb): same. (start_query): unref the book in the failure case. (add_card_idle_cb): addressbook_load_default_book returns void now. (edit_contact_info_cb): same. (e_address_popup_query): same. * gui/component/addressbook.c (control_activate_cb): track change to addressbook_load_uri return type. (set_prop): same. (addressbook_load_uri): return type is void now. (addressbook_load_default_book): same. * gui/component/addressbook.h: addressbook_load_uri/addressbook_load_default_book return void now. * conduit/address-conduit.c (start_addressbook_server): e_book_load_default_book returns void now. * backend/ebook/e-book-util.h: track changes to return types. * backend/ebook/e-book-util.c (e_book_load_address_book_by_uri): fallout from change to e_book_load_uri. return type for this function is void now too. (e_book_use_address_book_by_uri): same. (e_book_use_default_book): same. (e_book_load_default_book): same. (got_uri_book_cb): if unsuccessful and book is non-NULL, unref it here. (got_default_book_cb): same. * backend/ebook/e-book.c (e_book_load_uri): no longer return a gboolean. any error is communicated to the callback. * backend/ebook/e-book.h: e_book_load_uri no longer returns a gboolean (it's void.) * backend/ebook/evolution-ldif-importer.c (ebook_create): track change to the e_book_load_uri family of functions. * backend/ebook/test-client-list.c (ebook_create): same. * backend/ebook/test-client.c (ebook_create): same. * backend/ebook/load-pine-addressbook.c (ebook_create): same. * backend/ebook/evolution-vcard-importer.c (ebook_create): same. svn path=/trunk/; revision=19839 --- addressbook/gui/contact-editor/e-contact-quick-add.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'addressbook/gui/contact-editor') diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index d19ffb364f..1ad469a0ed 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -132,13 +132,15 @@ merge_cb (EBook *book, EBookStatus status, gpointer closure) { QuickAdd *qa = (QuickAdd *) closure; - if (book != NULL) { + if (status == E_BOOK_STATUS_SUCCESS) { e_card_merging_book_add_card (book, qa->card, NULL, NULL); if (qa->cb) qa->cb (qa->card, qa->closure); g_object_unref (book); } else { /* Something went wrong. */ + if (book) + g_object_unref (book); if (qa->cb) qa->cb (NULL, qa->closure); } @@ -154,10 +156,7 @@ quick_add_merge_card (QuickAdd *qa) quick_add_ref (qa); book = e_book_new (); - if (!addressbook_load_default_book (book, merge_cb, qa)) { - g_object_unref (book); - merge_cb (book, E_BOOK_STATUS_OTHER_ERROR, qa); - } + addressbook_load_default_book (book, merge_cb, qa); } @@ -197,7 +196,9 @@ ce_have_book (EBook *book, EBookStatus status, gpointer closure) { QuickAdd *qa = (QuickAdd *) closure; - if (book == NULL) { + if (status != E_BOOK_STATUS_SUCCESS) { + if (book) + g_object_unref (book); g_warning ("Couldn't open local address book."); quick_add_unref (qa); } else { @@ -232,10 +233,7 @@ edit_card (QuickAdd *qa) { EBook *book; book = e_book_new (); - if (!addressbook_load_default_book (book, ce_have_book, qa)) { - g_object_unref (book); - ce_have_book (book, E_BOOK_STATUS_OTHER_ERROR, qa); - } + addressbook_load_default_book (book, ce_have_book, qa); } #define QUICK_ADD_RESPONSE_EDIT_FULL 2 -- cgit v1.2.3