From d64f3f956b5bc89e2c046d3c881f916a914ff7fe Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 20 Apr 2013 12:30:04 -0400 Subject: EPhotoCache: Fix a runtime warning. Stop searching address books on the first error but don't indicate failure if we've managed to accumulate contacts prior to the error. (cherry picked from commit 5e1934425ddedb3848a66f16100e4ee1ea12aeb1) --- e-util/e-photo-cache.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'e-util') diff --git a/e-util/e-photo-cache.c b/e-util/e-photo-cache.c index 38d86a780f..74de1e9b7c 100644 --- a/e-util/e-photo-cache.c +++ b/e-util/e-photo-cache.c @@ -378,6 +378,7 @@ photo_cache_find_contacts (EPhotoCache *photo_cache, ESource *source = E_SOURCE (link->data); EClient *client; GSList *contact_list = NULL; + GError *local_error = NULL; /* Skip disabled sources. */ if (!e_source_get_enabled (source)) @@ -386,21 +387,37 @@ photo_cache_find_contacts (EPhotoCache *photo_cache, client = e_client_cache_get_client_sync ( client_cache, source, E_SOURCE_EXTENSION_ADDRESS_BOOK, - cancellable, error); - - if (client == NULL) { - success = FALSE; + cancellable, &local_error); + + if (local_error != NULL) { + g_warn_if_fail (client == NULL); + if (g_queue_is_empty (out_contacts)) { + g_propagate_error (error, local_error); + success = FALSE; + } else { + /* Clear the error if we already + * have matching contacts queued. */ + g_clear_error (&local_error); + } break; } - success = e_book_client_get_contacts_sync ( + e_book_client_get_contacts_sync ( E_BOOK_CLIENT (client), book_query_string, - &contact_list, cancellable, error); + &contact_list, cancellable, &local_error); g_object_unref (client); - if (!success) { + if (local_error != NULL) { g_warn_if_fail (contact_list == NULL); + if (g_queue_is_empty (out_contacts)) { + g_propagate_error (error, local_error); + success = FALSE; + } else { + /* Clear the error if we already + * have matching contacts queued. */ + g_clear_error (&local_error); + } break; } -- cgit v1.2.3