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/component/e-address-popup.c | 37 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'addressbook/gui/component/e-address-popup.c') diff --git a/addressbook/gui/component/e-address-popup.c b/addressbook/gui/component/e-address-popup.c index 13baf28eec..39c51a3720 100644 --- a/addressbook/gui/component/e-address-popup.c +++ b/addressbook/gui/component/e-address-popup.c @@ -389,10 +389,11 @@ email_table_save_card_cb (EBook *book, EBookStatus status, gpointer closure) { ECard *card = E_CARD (closure); - if (book) { + if (status == E_BOOK_STATUS_SUCCESS) { e_book_commit_card (book, card, NULL, NULL); - g_object_unref (book); } + if (book) + g_object_unref (book); g_object_unref (card); } @@ -406,10 +407,7 @@ add_card_idle_cb (gpointer closure) EBook *book; book = e_book_new (); - if (!addressbook_load_default_book (book, email_table_save_card_cb, closure)) { - g_object_unref (book); - email_table_save_card_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, closure); - } + addressbook_load_default_book (book, email_table_save_card_cb, closure); return 0; } @@ -956,11 +954,16 @@ emit_event (EAddressPopup *pop, const char *event) static void contact_editor_cb (EBook *book, EBookStatus status, gpointer closure) { - EAddressPopup *pop = E_ADDRESS_POPUP (closure); - EContactEditor *ce = e_addressbook_show_contact_editor (book, pop->card, FALSE, TRUE); - e_address_popup_cleanup (pop); - emit_event (pop, "Destroy"); - e_contact_editor_raise (ce); + if (status == E_BOOK_STATUS_SUCCESS) { + EAddressPopup *pop = E_ADDRESS_POPUP (closure); + EContactEditor *ce = e_addressbook_show_contact_editor (book, pop->card, FALSE, TRUE); + e_address_popup_cleanup (pop); + emit_event (pop, "Destroy"); + e_contact_editor_raise (ce); + } + + if (book) + g_object_unref (book); } static void @@ -970,10 +973,7 @@ edit_contact_info_cb (EAddressPopup *pop) emit_event (pop, "Hide"); book = e_book_new (); - if (!addressbook_load_default_book (book, contact_editor_cb, pop)) { - g_object_unref (book); - contact_editor_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, pop); - } + addressbook_load_default_book (book, contact_editor_cb, pop); } static void @@ -1156,6 +1156,8 @@ start_query (EBook *book, EBookStatus status, gpointer closure) if (status != E_BOOK_STATUS_SUCCESS) { e_address_popup_no_matches (pop); + if (book) + g_object_unref (book); return; } @@ -1184,10 +1186,7 @@ e_address_popup_query (EAddressPopup *pop) book = e_book_new (); g_object_ref (pop); - if (!addressbook_load_default_book (book, start_query, pop)) { - g_object_unref (book); - start_query (NULL, E_BOOK_STATUS_OTHER_ERROR, pop); - } + addressbook_load_default_book (book, start_query, pop); } /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ -- cgit v1.2.3