diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-04-21 00:30:04 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-04-21 01:15:27 +0800 |
commit | 5e1934425ddedb3848a66f16100e4ee1ea12aeb1 (patch) | |
tree | a08a157983f52a29cf44e6e458b712efc63a47c0 | |
parent | 513789838df36eb201187f05835591ef680ca181 (diff) | |
download | gsoc2013-evolution-5e1934425ddedb3848a66f16100e4ee1ea12aeb1.tar gsoc2013-evolution-5e1934425ddedb3848a66f16100e4ee1ea12aeb1.tar.gz gsoc2013-evolution-5e1934425ddedb3848a66f16100e4ee1ea12aeb1.tar.bz2 gsoc2013-evolution-5e1934425ddedb3848a66f16100e4ee1ea12aeb1.tar.lz gsoc2013-evolution-5e1934425ddedb3848a66f16100e4ee1ea12aeb1.tar.xz gsoc2013-evolution-5e1934425ddedb3848a66f16100e4ee1ea12aeb1.tar.zst gsoc2013-evolution-5e1934425ddedb3848a66f16100e4ee1ea12aeb1.zip |
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.
-rw-r--r-- | e-util/e-photo-cache.c | 31 |
1 files changed, 24 insertions, 7 deletions
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; } |