diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-10-06 21:35:14 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-10-06 21:37:01 +0800 |
commit | 126aa2398abc1bbab0fd0cd76fda5042cc83fe76 (patch) | |
tree | a56dac4e77d7fad6901468564caa09644a1a806b /mail | |
parent | 938505da180727fbc56b68b80851adc3cf676523 (diff) | |
download | gsoc2013-evolution-126aa2398abc1bbab0fd0cd76fda5042cc83fe76.tar gsoc2013-evolution-126aa2398abc1bbab0fd0cd76fda5042cc83fe76.tar.gz gsoc2013-evolution-126aa2398abc1bbab0fd0cd76fda5042cc83fe76.tar.bz2 gsoc2013-evolution-126aa2398abc1bbab0fd0cd76fda5042cc83fe76.tar.lz gsoc2013-evolution-126aa2398abc1bbab0fd0cd76fda5042cc83fe76.tar.xz gsoc2013-evolution-126aa2398abc1bbab0fd0cd76fda5042cc83fe76.tar.zst gsoc2013-evolution-126aa2398abc1bbab0fd0cd76fda5042cc83fe76.zip |
Prefer g_simple_async_result_take_error().
Slightly more efficient and convenient than:
g_simple_async_result_set_from_error (simple, error);
g_error_free (error);
One less GError to copy and destroy.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-folder-utils.c | 42 | ||||
-rw-r--r-- | mail/e-mail-session-utils.c | 33 | ||||
-rw-r--r-- | mail/e-mail-session.c | 18 | ||||
-rw-r--r-- | mail/e-mail-store-utils.c | 24 |
4 files changed, 39 insertions, 78 deletions
diff --git a/mail/e-mail-folder-utils.c b/mail/e-mail-folder-utils.c index 77a9708e5f..fe093adb21 100644 --- a/mail/e-mail-folder-utils.c +++ b/mail/e-mail-folder-utils.c @@ -84,10 +84,8 @@ mail_folder_append_message_thread (GSimpleAsyncResult *simple, context->info, &context->message_uid, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } gboolean @@ -199,10 +197,8 @@ mail_folder_build_attachment_thread (GSimpleAsyncResult *simple, CAMEL_FOLDER (object), context->ptr_array, &context->fwd_subject, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } CamelMimePart * @@ -359,10 +355,8 @@ mail_folder_find_duplicate_messages_thread (GSimpleAsyncResult *simple, CAMEL_FOLDER (object), context->ptr_array, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } GHashTable * @@ -559,10 +553,8 @@ mail_folder_get_multiple_messages_thread (GSimpleAsyncResult *simple, CAMEL_FOLDER (object), context->ptr_array, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } GHashTable * @@ -685,10 +677,8 @@ mail_folder_remove_thread (GSimpleAsyncResult *simple, e_mail_folder_remove_sync ( CAMEL_FOLDER (object), cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } static gboolean @@ -912,10 +902,8 @@ mail_folder_remove_attachments_thread (GSimpleAsyncResult *simple, CAMEL_FOLDER (object), context->ptr_array, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } /* Helper for e_mail_folder_remove_attachments_sync() */ @@ -1128,10 +1116,8 @@ mail_folder_save_messages_thread (GSimpleAsyncResult *simple, CAMEL_FOLDER (object), context->ptr_array, context->destination, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } /* Helper for e_mail_folder_save_messages_sync() */ diff --git a/mail/e-mail-session-utils.c b/mail/e-mail-session-utils.c index 217e7e2e8e..eca58bcad0 100644 --- a/mail/e-mail-session-utils.c +++ b/mail/e-mail-session-utils.c @@ -131,10 +131,8 @@ mail_session_handle_draft_headers_thread (GSimpleAsyncResult *simple, e_mail_session_handle_draft_headers_sync ( session, context->message, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } gboolean @@ -249,10 +247,8 @@ mail_session_handle_source_headers_thread (GSimpleAsyncResult *simple, e_mail_session_handle_source_headers_sync ( session, context->message, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } gboolean @@ -426,8 +422,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple, /* XXX This API does not allow for cancellation. */ if (!em_utils_connect_service_sync (service, cancellable, &error)) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); + g_simple_async_result_take_error (simple, error); return; } } @@ -448,8 +443,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple, cancellable, error ? NULL : &error); if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); + g_simple_async_result_take_error (simple, error); return; } } @@ -466,8 +460,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple, if (error != NULL) { g_warn_if_fail (folder == NULL); - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); + g_simple_async_result_take_error (simple, error); return; } @@ -480,8 +473,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple, g_object_unref (folder); if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); + g_simple_async_result_take_error (simple, error); return; } } @@ -615,8 +607,7 @@ exit: /* If we were cancelled, disregard any other errors. */ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); + g_simple_async_result_take_error (simple, error); /* Stuff the accumulated error messages in a GError. */ } else if (error_messages->len > 0) { @@ -843,10 +834,8 @@ mail_session_unsubscribe_folder_thread (GSimpleAsyncResult *simple, e_mail_session_unsubscribe_folder_sync ( session, context->folder_uri, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } gboolean diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index 45c8e0209c..0687d7561f 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -1249,10 +1249,8 @@ mail_session_get_inbox_thread (GSimpleAsyncResult *simple, context->folder = e_mail_session_get_inbox_sync ( session, context->uid, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } CamelFolder * @@ -1348,10 +1346,8 @@ mail_session_get_trash_thread (GSimpleAsyncResult *simple, context->folder = e_mail_session_get_trash_sync ( session, context->uid, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } CamelFolder * @@ -1448,10 +1444,8 @@ mail_session_uri_to_folder_thread (GSimpleAsyncResult *simple, session, context->uri, context->flags, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } CamelFolder * diff --git a/mail/e-mail-store-utils.c b/mail/e-mail-store-utils.c index 0bf70ae94d..7f978c8b7f 100644 --- a/mail/e-mail-store-utils.c +++ b/mail/e-mail-store-utils.c @@ -54,10 +54,8 @@ mail_store_create_folder_thread (GSimpleAsyncResult *simple, CAMEL_STORE (object), context->full_name, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); } gboolean @@ -191,10 +189,8 @@ mail_store_go_offline_thread (GSimpleAsyncResult *simple, } else em_utils_disconnect_service_sync (service, TRUE, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); camel_operation_pop_message (cancellable); } @@ -270,10 +266,8 @@ mail_store_go_online_thread (GSimpleAsyncResult *simple, CAMEL_OFFLINE_STORE (store), TRUE, cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); camel_operation_pop_message (cancellable); } @@ -343,10 +337,8 @@ mail_store_prepare_for_offline_thread (GSimpleAsyncResult *simple, camel_offline_store_prepare_for_offline_sync ( CAMEL_OFFLINE_STORE (store), cancellable, &error); - if (error != NULL) { - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); - } + if (error != NULL) + g_simple_async_result_take_error (simple, error); camel_operation_pop_message (cancellable); } |