diff options
author | Chris Toshok <toshok@ximian.com> | 2003-02-07 15:14:34 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2003-02-07 15:14:34 +0800 |
commit | aeec7106f7a3d6d1e4479c2ec596a506c4c281fa (patch) | |
tree | 1e84b323a01d8a2e88ca09d841d187643a564a85 | |
parent | fe77d02dd0637587aa417a329914feb37508a1ef (diff) | |
download | gsoc2013-evolution-aeec7106f7a3d6d1e4479c2ec596a506c4c281fa.tar gsoc2013-evolution-aeec7106f7a3d6d1e4479c2ec596a506c4c281fa.tar.gz gsoc2013-evolution-aeec7106f7a3d6d1e4479c2ec596a506c4c281fa.tar.bz2 gsoc2013-evolution-aeec7106f7a3d6d1e4479c2ec596a506c4c281fa.tar.lz gsoc2013-evolution-aeec7106f7a3d6d1e4479c2ec596a506c4c281fa.tar.xz gsoc2013-evolution-aeec7106f7a3d6d1e4479c2ec596a506c4c281fa.tar.zst gsoc2013-evolution-aeec7106f7a3d6d1e4479c2ec596a506c4c281fa.zip |
check the status, not the book, and unref the book here.
2003-02-06 Chris Toshok <toshok@ximian.com>
* 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
-rw-r--r-- | addressbook/ChangeLog | 53 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-util.c | 50 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-util.h | 4 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book.c | 23 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book.h | 2 | ||||
-rw-r--r-- | addressbook/backend/ebook/evolution-ldif-importer.c | 8 | ||||
-rw-r--r-- | addressbook/backend/ebook/evolution-vcard-importer.c | 8 | ||||
-rw-r--r-- | addressbook/backend/ebook/load-gnomecard-addressbook.c | 4 | ||||
-rw-r--r-- | addressbook/backend/ebook/load-pine-addressbook.c | 4 | ||||
-rw-r--r-- | addressbook/backend/ebook/test-client-list.c | 5 | ||||
-rw-r--r-- | addressbook/backend/ebook/test-client.c | 5 | ||||
-rw-r--r-- | addressbook/conduit/address-conduit.c | 4 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 26 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.h | 4 | ||||
-rw-r--r-- | addressbook/gui/component/e-address-popup.c | 37 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-quick-add.c | 18 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard-control.c | 10 | ||||
-rw-r--r-- | addressbook/gui/widgets/test-minicard-view.c | 5 |
18 files changed, 131 insertions, 139 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 84f7179b47..e913e1f81a 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,56 @@ +2003-02-06 Chris Toshok <toshok@ximian.com> + + * 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. + 2003-02-06 Ettore Perazzoli <ettore@ximian.com> * backend/ebook/Makefile.am (e-book-marshal.c, e-book-marshal.h): diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c index aaba56f8dc..40ec0fb446 100644 --- a/addressbook/backend/ebook/e-book-util.c +++ b/addressbook/backend/ebook/e-book-util.c @@ -73,32 +73,27 @@ got_uri_book_cb (EBook *book, EBookStatus status, gpointer closure) if (status == E_BOOK_STATUS_SUCCESS) { info->cb (book, info->closure); } else { + if (book) + g_object_unref (book); info->cb (NULL, info->closure); } g_free (info); } -gboolean +void e_book_load_address_book_by_uri (EBook *book, const char *uri, EBookCallback open_response, gpointer closure) { - gboolean rv; char *real_uri; - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (open_response != NULL, FALSE); + g_return_if_fail (book != NULL); + g_return_if_fail (E_IS_BOOK (book)); + g_return_if_fail (open_response != NULL); real_uri = e_book_expand_uri (uri); - rv = e_book_load_uri (book, real_uri, open_response, closure); - - if (!rv) { - g_warning ("Couldn't load addressbook %s", real_uri); - } + e_book_load_uri (book, real_uri, open_response, closure); g_free (real_uri); - - return rv; } void @@ -114,10 +109,7 @@ e_book_use_address_book_by_uri (const char *uri, EBookCommonCallback cb, gpointe info->closure = closure; book = e_book_new (); - if (! e_book_load_address_book_by_uri (book, uri, got_uri_book_cb, info)) { - g_object_unref (book); - g_free (info); - } + e_book_load_address_book_by_uri (book, uri, got_uri_book_cb, info); } EConfigListener * @@ -155,7 +147,8 @@ got_default_book_cb (EBook *book, EBookStatus status, gpointer closure) } } else { - + if (book) + g_object_unref (book); info->cb (NULL, info->closure); } @@ -180,10 +173,7 @@ e_book_use_default_book (EBookCommonCallback cb, gpointer closure) info->closure = closure; book = e_book_new (); - if (! e_book_load_default_book (book, got_default_book_cb, info)) { - g_object_unref (book); - g_free (info); - } + e_book_load_default_book (book, got_default_book_cb, info); } static char *default_book_uri; @@ -272,16 +262,15 @@ e_book_default_book_open (EBook *book, EBookStatus status, gpointer closure) } } -gboolean +void e_book_load_default_book (EBook *book, EBookCallback open_response, gpointer closure) { char *uri; - gboolean rv; DefaultBookClosure *default_book_closure; - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (open_response != NULL, FALSE); + g_return_if_fail (book != NULL); + g_return_if_fail (E_IS_BOOK (book)); + g_return_if_fail (open_response != NULL); uri = e_book_get_default_book_uri (); @@ -290,14 +279,9 @@ e_book_load_default_book (EBook *book, EBookCallback open_response, gpointer clo default_book_closure->closure = closure; default_book_closure->open_response = open_response; - rv = e_book_load_uri (book, uri, - e_book_default_book_open, default_book_closure); - - if (!rv) { - g_warning ("Couldn't load default addressbook"); - } + e_book_load_uri (book, uri, + e_book_default_book_open, default_book_closure); - return rv; } char* diff --git a/addressbook/backend/ebook/e-book-util.h b/addressbook/backend/ebook/e-book-util.h index 3ebea41ef0..3ea59df8aa 100644 --- a/addressbook/backend/ebook/e-book-util.h +++ b/addressbook/backend/ebook/e-book-util.h @@ -42,7 +42,7 @@ typedef void (*EBookHaveAddressCallback) (EBook *book, const gchar *addr, ECard /* expand file:///foo/foo/ to file:///foo/foo/addressbook.db */ char *e_book_expand_uri (const char *uri); -gboolean e_book_load_address_book_by_uri (EBook *book, +void e_book_load_address_book_by_uri (EBook *book, const char *uri, EBookCallback open_response, gpointer closure); @@ -52,7 +52,7 @@ void e_book_use_address_book_by_uri (const char void e_book_use_default_book (EBookCommonCallback cb, gpointer closure); -gboolean e_book_load_default_book (EBook *book, +void e_book_load_default_book (EBook *book, EBookCallback open_response, gpointer closure); char *e_book_get_default_book_uri (void); diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c index 195418d29b..fff07bcfb9 100644 --- a/addressbook/backend/ebook/e-book.c +++ b/addressbook/backend/ebook/e-book.c @@ -729,7 +729,7 @@ activate_factories_for_uri (EBook *book, const char *uri) return retval; } -gboolean +void e_book_load_uri (EBook *book, const char *uri, EBookCallback open_response, @@ -738,21 +738,21 @@ e_book_load_uri (EBook *book, EBookLoadURIData *load_uri_data; GNOME_Evolution_Addressbook_BookFactory factory; - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (uri != NULL, FALSE); - g_return_val_if_fail (open_response != NULL, FALSE); + g_return_if_fail (book != NULL); + g_return_if_fail (E_IS_BOOK (book)); + g_return_if_fail (uri != NULL); + g_return_if_fail (open_response != NULL); if (book->priv->load_state != URINotLoaded) { g_warning ("e_book_load_uri: Attempted to load a URI " "on a book which already has a URI loaded!\n"); - return FALSE; + open_response (book, E_BOOK_STATUS_OTHER_ERROR, closure); /* XXX need a new status code here */ + return; } /* try to find a list of factories that can handle the protocol */ if (!activate_factories_for_uri (book, uri)) { - open_response (NULL, E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED, closure); - return FALSE; + open_response (book, E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED, closure); } g_free (book->priv->uri); @@ -764,7 +764,8 @@ e_book_load_uri (EBook *book, book->priv->listener = e_book_listener_new (); if (book->priv->listener == NULL) { g_warning ("e_book_load_uri: Could not create EBookListener!\n"); - return FALSE; + open_response (NULL, E_BOOK_STATUS_OTHER_ERROR, closure); /* XXX need a new status code here */ + return; } g_signal_connect (book->priv->listener, "responses_queued", @@ -782,10 +783,6 @@ e_book_load_uri (EBook *book, e_book_load_uri_from_factory (book, factory, load_uri_data); book->priv->load_state = URILoading; - - /* Now we play the waiting game. */ - - return TRUE; } /** diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h index bbc49b711c..bee3a24907 100644 --- a/addressbook/backend/ebook/e-book.h +++ b/addressbook/backend/ebook/e-book.h @@ -65,7 +65,7 @@ typedef void (*EBookAuthMethodsCallback) (EBook *book, EBookStatus status, EList /* Creating a new addressbook. */ EBook *e_book_new (void); -gboolean e_book_load_uri (EBook *book, +void e_book_load_uri (EBook *book, const char *uri, EBookCallback open_response, gpointer closure); diff --git a/addressbook/backend/ebook/evolution-ldif-importer.c b/addressbook/backend/ebook/evolution-ldif-importer.c index d64a9a0c40..0ab8e872af 100644 --- a/addressbook/backend/ebook/evolution-ldif-importer.c +++ b/addressbook/backend/ebook/evolution-ldif-importer.c @@ -470,15 +470,11 @@ ebook_create (LDIFImporter *gci) uri = g_strdup_printf ("file://%s", path); g_free (path); - if (! e_book_load_uri (gci->book, uri, book_open_cb, gci)) { - printf ("error calling load_uri!\n"); - } + e_book_load_uri (gci->book, uri, book_open_cb, gci); g_free(uri); #endif - if (! e_book_load_default_book (gci->book, book_open_cb, gci)) { - g_warning ("Error calling load_default_book"); - } + e_book_load_default_book (gci->book, book_open_cb, gci); } /* EvolutionImporter methods */ diff --git a/addressbook/backend/ebook/evolution-vcard-importer.c b/addressbook/backend/ebook/evolution-vcard-importer.c index c16fab4019..51f29f1278 100644 --- a/addressbook/backend/ebook/evolution-vcard-importer.c +++ b/addressbook/backend/ebook/evolution-vcard-importer.c @@ -70,15 +70,11 @@ ebook_create (VCardImporter *gci) uri = g_strdup_printf ("%s/addressbook.db", epath); g_free (epath); - if (! e_book_load_uri (gci->book, uri, book_open_cb, gci)) { - printf ("error calling load_uri!\n"); - } + e_book_load_uri (gci->book, uri, book_open_cb, gci); g_free(uri); #endif - if (! e_book_load_default_book (gci->book, book_open_cb, gci)) { - g_warning ("Error calling load_default_book"); - } + e_book_load_default_book (gci->book, book_open_cb, gci); } /* EvolutionImporter methods */ diff --git a/addressbook/backend/ebook/load-gnomecard-addressbook.c b/addressbook/backend/ebook/load-gnomecard-addressbook.c index 30f4f5a5f2..b0478f3c9b 100644 --- a/addressbook/backend/ebook/load-gnomecard-addressbook.c +++ b/addressbook/backend/ebook/load-gnomecard-addressbook.c @@ -53,9 +53,7 @@ ebook_create (gpointer data) uri = g_strdup_printf ("file://%s", path); g_free (path); - if (! e_book_load_uri (book, uri, book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } + e_book_load_uri (book, uri, book_open_cb, NULL); g_free(uri); diff --git a/addressbook/backend/ebook/load-pine-addressbook.c b/addressbook/backend/ebook/load-pine-addressbook.c index 9dc495badf..7203c8160d 100644 --- a/addressbook/backend/ebook/load-pine-addressbook.c +++ b/addressbook/backend/ebook/load-pine-addressbook.c @@ -110,9 +110,7 @@ ebook_create (gpointer data) uri = g_strdup_printf ("file://%s", path); g_free (path); - if (! e_book_load_uri (book, uri, book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } + e_book_load_uri (book, uri, book_open_cb, NULL); g_free(uri); diff --git a/addressbook/backend/ebook/test-client-list.c b/addressbook/backend/ebook/test-client-list.c index 271d9fc3bf..6fa3d6b094 100644 --- a/addressbook/backend/ebook/test-client-list.c +++ b/addressbook/backend/ebook/test-client-list.c @@ -45,10 +45,7 @@ ebook_create (gpointer data) book = e_book_new (); - if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - + e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL); return FALSE; } diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c index bd11d93691..59419c3d36 100644 --- a/addressbook/backend/ebook/test-client.c +++ b/addressbook/backend/ebook/test-client.c @@ -137,10 +137,7 @@ ebook_create (gpointer data) } - if (! e_book_load_default_book (book, book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - + e_book_load_default_book (book, book_open_cb, NULL); return FALSE; } diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index a5dc026e1d..2f5c9e331a 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -553,13 +553,11 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure) static int start_addressbook_server (EAddrConduitContext *ctxt) { - gboolean result; - g_return_val_if_fail(ctxt!=NULL,-2); ctxt->ebook = e_book_new (); - result = e_book_load_default_book (ctxt->ebook, book_open_cb, ctxt); + e_book_load_default_book (ctxt->ebook, book_open_cb, ctxt); /* run a sub event loop to turn ebook's async loading into a synchronous call */ diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 9ab5d87320..5baaa05733 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -413,8 +413,7 @@ control_activate_cb (BonoboControl *control, book = e_book_new (); uri_data = e_book_expand_uri (view->uri); - if (! addressbook_load_uri (book, uri_data, book_open_cb, view)) - printf ("error calling load_uri!\n"); + addressbook_load_uri (book, uri_data, book_open_cb, view); g_free(uri_data); } @@ -729,39 +728,27 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure) g_free (load_uri_data); } -gboolean +void addressbook_load_uri (EBook *book, const char *uri, EBookCallback cb, gpointer closure) { LoadUriData *load_uri_data = g_new0 (LoadUriData, 1); - gboolean rv; load_uri_data->cb = cb; load_uri_data->closure = closure; - rv = e_book_load_uri (book, uri, load_uri_cb, load_uri_data); - - if (!rv) - g_free (load_uri_data); - - return rv; + e_book_load_uri (book, uri, load_uri_cb, load_uri_data); } -gboolean +void addressbook_load_default_book (EBook *book, EBookCallback cb, gpointer closure) { LoadUriData *load_uri_data = g_new (LoadUriData, 1); - gboolean rv; load_uri_data->cb = cb; load_uri_data->closure = closure; - rv = e_book_load_default_book (book, load_uri_cb, load_uri_data); - - if (!rv) - g_free (load_uri_data); - - return rv; + e_book_load_default_book (book, load_uri_cb, load_uri_data); } static void @@ -796,8 +783,7 @@ set_prop (BonoboPropertyBag *bag, uri_data = e_book_expand_uri (view->uri); - if (! addressbook_load_uri (book, uri_data, book_open_cb, view)) - printf ("error calling load_uri!\n"); + addressbook_load_uri (book, uri_data, book_open_cb, view); g_free(uri_data); diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h index 3524f24b0c..3d4bba5187 100644 --- a/addressbook/gui/component/addressbook.h +++ b/addressbook/gui/component/addressbook.h @@ -9,8 +9,8 @@ /* use this instead of e_book_load_uri everywhere where you want the authentication to be handled for you. */ -gboolean addressbook_load_uri (EBook *book, const char *uri, EBookCallback cb, gpointer closure); -gboolean addressbook_load_default_book (EBook *book, EBookCallback open_response, gpointer closure); +void addressbook_load_uri (EBook *book, const char *uri, EBookCallback cb, gpointer closure); +void addressbook_load_default_book (EBook *book, EBookCallback open_response, gpointer closure); BonoboControl *addressbook_new_control (void); 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); } /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ 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 diff --git a/addressbook/gui/widgets/e-minicard-control.c b/addressbook/gui/widgets/e-minicard-control.c index 36f40d86d5..7cbcfb028a 100644 --- a/addressbook/gui/widgets/e-minicard-control.c +++ b/addressbook/gui/widgets/e-minicard-control.c @@ -249,13 +249,14 @@ static void book_open_cb (EBook *book, EBookStatus status, gpointer closure) { GList *list = closure; - if (book) { + if (status == E_BOOK_STATUS_SUCCESS) { GList *p; for (p = list; p; p = p->next) { e_card_merging_book_add_card(book, p->data, NULL, NULL); } - g_object_unref (book); } + if (book) + g_object_unref (book); e_free_object_list (list); } @@ -273,10 +274,7 @@ save_in_addressbook(GtkWidget *button, gpointer data) for (p = list; p; p = p->next) g_object_ref (p->data); - if (!addressbook_load_default_book (book, book_open_cb, list)) { - g_object_unref (book); - book_open_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, list); - } + addressbook_load_default_book (book, book_open_cb, list); } static void diff --git a/addressbook/gui/widgets/test-minicard-view.c b/addressbook/gui/widgets/test-minicard-view.c index 7abe611711..1a4ff8e07f 100644 --- a/addressbook/gui/widgets/test-minicard-view.c +++ b/addressbook/gui/widgets/test-minicard-view.c @@ -132,10 +132,7 @@ ebook_create (gpointer data) } - if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - + e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL); return FALSE; } |