From: Tristan Van Berkom Date: Tue, 26 Feb 2013 11:52:20 +0000 (+0900) Subject: Fixed error reporting for direct access apis X-Git-Tag: upstream/3.7.91~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c92b85473861c91e5b1da0b27071a6a6307f4eba;p=platform%2Fupstream%2Fevolution-data-server.git Fixed error reporting for direct access apis When e_data_book_get_contacts[_uids]_finish() is called, the return value is FALSE if there is any error reported, otherwise it returns TRUE even if there are no results. --- diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c index 7a168b4..bc71850 100644 --- a/addressbook/libedata-book/e-data-book.c +++ b/addressbook/libedata-book/e-data-book.c @@ -2684,7 +2684,6 @@ e_data_book_get_contacts_finish (EDataBook *book, g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE); ret_contacts = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result)); - g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error); if (contacts) { if (ret_contacts) @@ -2693,9 +2692,12 @@ e_data_book_get_contacts_finish (EDataBook *book, *contacts = NULL; } - /* How can we tell if it failed ? ... we need to check the error but - * GSimpleAsyncResult doesnt tell us if there was an error, only propagates it + /* If there was an error, the return is FALSE, otherwise + * the call was successfull even if no results were found */ + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error)) + return FALSE; + return TRUE; } @@ -2803,7 +2805,6 @@ e_data_book_get_contacts_uids_finish (EDataBook *book, g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE); ret_uids = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result)); - g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error); if (contacts_uids) { if (ret_uids) @@ -2812,9 +2813,12 @@ e_data_book_get_contacts_uids_finish (EDataBook *book, *contacts_uids = NULL; } - /* How can we tell if it failed ? ... we need to check the error but - * GSimpleAsyncResult doesnt tell us if there was an error, only propagates it + /* If there was an error, the return is FALSE, otherwise + * the call was successfull even if no results were found */ + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error)) + return FALSE; + return TRUE; }