From a9491dff65271a8c6b643450938df0af74bad52c Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Sun, 28 Oct 2001 03:04:53 +0000 Subject: change to EBookCallback signature, and unref the book. (add_card_idle_cb): 2001-10-27 Chris Toshok * gui/component/e-address-popup.c (email_table_save_card_cb): change to EBookCallback signature, and unref the book. (add_card_idle_cb): use addressbook_load_default_book, and call the cb if it fails. (e_address_popup_cleanup): fix type -- should be "pop->card = NULL", not "pop = NULL". (contact_editor_cb): change to EBookCallback signature. (edit_contact_info_cb): use addressbook_load_default_book. (start_query): change to EBookCallback signature. (e_address_popup_query): use addressbook_load_default_book. * gui/widgets/e-minicard-control.c (book_open_cb): change to EBookCallback signature, and unref the book. (save_in_addressbook): use addressbook_load_default_book instead of e_book_use_local_address_book. * gui/widgets/Makefile.am (INCLUDES): change includes since we're including addressbook.h which has it's own set of funky include path requirements. svn path=/trunk/; revision=14268 --- addressbook/gui/component/e-address-popup.c | 36 +++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'addressbook/gui/component') diff --git a/addressbook/gui/component/e-address-popup.c b/addressbook/gui/component/e-address-popup.c index c554fd8d9b..7c04cc0130 100644 --- a/addressbook/gui/component/e-address-popup.c +++ b/addressbook/gui/component/e-address-popup.c @@ -29,6 +29,7 @@ */ #include +#include "addressbook.h" #include "e-address-popup.h" #include #include @@ -384,12 +385,13 @@ email_table_to_card (EMailTable *et) } static void -email_table_save_card_cb (EBook *book, gpointer closure) +email_table_save_card_cb (EBook *book, EBookStatus status, gpointer closure) { ECard *card = E_CARD (closure); if (book) { e_book_commit_card (book, card, NULL, NULL); + gtk_object_unref (GTK_OBJECT (book)); } gtk_object_unref (GTK_OBJECT (card)); } @@ -401,7 +403,14 @@ email_table_save_card_cb (EBook *book, gpointer closure) static gint add_card_idle_cb (gpointer closure) { - e_book_use_local_address_book (email_table_save_card_cb, closure); + EBook *book; + + book = e_book_new (); + if (!addressbook_load_default_book (book, email_table_save_card_cb, closure)) { + gtk_object_unref (GTK_OBJECT (book)); + email_table_save_card_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, closure); + } + return 0; } @@ -680,7 +689,7 @@ e_address_popup_cleanup (EAddressPopup *pop) { if (pop->card) { gtk_object_unref (GTK_OBJECT (pop->card)); - pop = NULL; + pop->card = NULL; } if (pop->scheduled_refresh) { @@ -923,7 +932,7 @@ emit_event (EAddressPopup *pop, const char *event) } static void -contact_editor_cb (EBook *book, gpointer closure) +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); @@ -935,8 +944,14 @@ contact_editor_cb (EBook *book, gpointer closure) static void edit_contact_info_cb (EAddressPopup *pop) { + EBook *book; emit_event (pop, "Hide"); - e_book_use_local_address_book (contact_editor_cb, pop); + + book = e_book_new (); + if (!addressbook_load_default_book (book, contact_editor_cb, pop)) { + gtk_object_unref (GTK_OBJECT (book)); + contact_editor_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, pop); + } } static void @@ -1113,7 +1128,7 @@ query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpoint } static void -start_query (EBook *book, gpointer closure) +start_query (EBook *book, EBookStatus status, gpointer closure) { EAddressPopup *pop = E_ADDRESS_POPUP (closure); @@ -1135,10 +1150,17 @@ start_query (EBook *book, gpointer closure) static void e_address_popup_query (EAddressPopup *pop) { + EBook *book; + g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop)); + book = e_book_new (); gtk_object_ref (GTK_OBJECT (pop)); - e_book_use_local_address_book (start_query, pop); + + if (!addressbook_load_default_book (book, start_query, pop)) { + gtk_object_unref (GTK_OBJECT (book)); + start_query (NULL, E_BOOK_STATUS_OTHER_ERROR, pop); + } } /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ -- cgit v1.2.3