diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-05-13 21:29:38 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-05-13 21:40:23 +0800 |
commit | 53a3d2f4e1473dd93fee8e7367bc329b8dc5ef23 (patch) | |
tree | f4cdd57586ad4bd1af4669a429af0938e8d6e845 /mail | |
parent | 89777f0726a0127daddd593c8a28384204cb7aaf (diff) | |
download | gsoc2013-evolution-53a3d2f4e1473dd93fee8e7367bc329b8dc5ef23.tar.gz gsoc2013-evolution-53a3d2f4e1473dd93fee8e7367bc329b8dc5ef23.tar.zst gsoc2013-evolution-53a3d2f4e1473dd93fee8e7367bc329b8dc5ef23.zip |
Use g_simple_async_result_set_check_cancellable().
Always call it immediately after g_simple_async_result_new().
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-http-request.c | 15 | ||||
-rw-r--r-- | mail/e-mail-request.c | 15 |
2 files changed, 20 insertions, 10 deletions
diff --git a/mail/e-http-request.c b/mail/e-http-request.c index a8417efb95..edf13152df 100644 --- a/mail/e-http-request.c +++ b/mail/e-http-request.c @@ -430,7 +430,7 @@ http_request_send_async (SoupRequest *request, gpointer user_data) { EHTTPRequest *ehr; - GSimpleAsyncResult *result; + GSimpleAsyncResult *simple; gchar *mail_uri; SoupURI *uri; const gchar *enc; @@ -464,10 +464,15 @@ http_request_send_async (SoupRequest *request, /* Make sure the formatter lives until we are finished here */ g_object_ref (ehr->priv->efh); - result = g_simple_async_result_new (G_OBJECT (request), callback, - user_data, http_request_send_async); - g_simple_async_result_run_in_thread (result, handle_http_request, - G_PRIORITY_DEFAULT, cancellable); + simple = g_simple_async_result_new ( + G_OBJECT (request), callback, + user_data, http_request_send_async); + + g_simple_async_result_set_check_cancellable (simple, cancellable); + + g_simple_async_result_run_in_thread ( + simple, handle_http_request, + G_PRIORITY_DEFAULT, cancellable); g_hash_table_destroy (query); } diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c index 8a51b2a226..d36e0cba2e 100644 --- a/mail/e-mail-request.c +++ b/mail/e-mail-request.c @@ -180,7 +180,7 @@ mail_request_send_async (SoupRequest *request, { SoupSession *session; EMailRequest *emr = E_MAIL_REQUEST (request); - GSimpleAsyncResult *result; + GSimpleAsyncResult *simple; SoupURI *uri; GHashTable *formatters; gchar *uri_str; @@ -209,10 +209,15 @@ mail_request_send_async (SoupRequest *request, /* Make sure the formatter lives until we are finished here */ g_object_ref (emr->priv->efh); - result = g_simple_async_result_new (G_OBJECT (request), callback, - user_data, mail_request_send_async); - g_simple_async_result_run_in_thread (result, handle_mail_request, - G_PRIORITY_DEFAULT, cancellable); + simple = g_simple_async_result_new ( + G_OBJECT (request), callback, + user_data, mail_request_send_async); + + g_simple_async_result_set_check_cancellable (simple, cancellable); + + g_simple_async_result_run_in_thread ( + simple, handle_mail_request, + G_PRIORITY_DEFAULT, cancellable); } static GInputStream * |