GNOME Bugzilla – Bug 349069
e_book_async_get_contact() fails
Last modified: 2018-12-11 07:23:00 UTC
When calling: result = e_book_async_get_contact (book, id, (EBookContactCallback) func, NULL); where "id" is given by calling e_book_get_self() or any other legitimate "id" (in the format of "pas-id-4474A1EA00000000", the result does not evaluate as TRUE. There is no error condition returned here either so I don't know why. If I call e_book_async_get_contacts() instead and go through the list returned, I can easily match the E_CONTACT_UID to the owner of the book and find out the information I need, so I know the UID is correct. Also, func is never called (which I guess is correct given the return value). I have a test case if needed.
The API docs say this: /** * e_book_async_get_contact: * @book: an #EBook * @id: a unique string ID specifying the contact * @cb: function to call when operation finishes * @closure: data to pass to callback function * * Retrieves a contact specified by @id from @book. * * Return value: %FALSE if successful, %TRUE otherwise **/ Now returning FALSE for success, TRUE for error is odd. Very odd. Especially considering some of the other e_book_async_* functions return TRUE on success, and FALSE otherwise.
This function was deprecated but it's replacement still does the same according to the api docs. The new one is called e_book_get_contact_async().
> Also, func is never called (which I guess is correct given the return value). I guess it's because the async version requires a main loop (or the main context) to be running, because it's the place where the response is received. > * Return value: %FALSE if successful, %TRUE otherwise The developer documentation is wrong, still, though the function doesn't need to return anything, because it's an asynchronous version. I fixed that with [1] for 3.31.4+ and 3.30.4+. [1] https://gitlab.gnome.org/GNOME/evolution-data-server/commit/29ed6579a