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 /e-util | |
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 'e-util')
-rw-r--r-- | e-util/e-file-request.c | 15 | ||||
-rw-r--r-- | e-util/e-file-utils.c | 2 | ||||
-rw-r--r-- | e-util/e-stock-request.c | 15 |
3 files changed, 22 insertions, 10 deletions
diff --git a/e-util/e-file-request.c b/e-util/e-file-request.c index 62c64e34a8..08d8682261 100644 --- a/e-util/e-file-request.c +++ b/e-util/e-file-request.c @@ -93,7 +93,7 @@ file_request_send_async (SoupRequest *request, GAsyncReadyCallback callback, gpointer user_data) { - GSimpleAsyncResult *result; + GSimpleAsyncResult *simple; d(printf("received request for %s\n", soup_uri_to_string (uri, FALSE))); @@ -102,10 +102,15 @@ file_request_send_async (SoupRequest *request, * which WebKit thinks it's remote, but in fact it behaves like * oridnary file:// */ - result = g_simple_async_result_new (G_OBJECT (request), callback, - user_data, file_request_send_async); - g_simple_async_result_run_in_thread (result, handle_file_request, - G_PRIORITY_DEFAULT, cancellable); + simple = g_simple_async_result_new ( + G_OBJECT (request), callback, user_data, + file_request_send_async); + + g_simple_async_result_set_check_cancellable (simple, cancellable); + + g_simple_async_result_run_in_thread ( + simple, handle_file_request, + G_PRIORITY_DEFAULT, cancellable); } static GInputStream * diff --git a/e-util/e-file-utils.c b/e-util/e-file-utils.c index ebb65f460e..90b2e77205 100644 --- a/e-util/e-file-utils.c +++ b/e-util/e-file-utils.c @@ -172,6 +172,8 @@ e_file_replace_contents_async (GFile *file, G_OBJECT (file), callback, user_data, e_file_replace_contents_async); + g_simple_async_result_set_check_cancellable (simple, cancellable); + g_simple_async_result_set_op_res_gpointer ( simple, context, (GDestroyNotify) async_context_free); diff --git a/e-util/e-stock-request.c b/e-util/e-stock-request.c index 2b805f471e..c9a2e5fc1b 100644 --- a/e-util/e-stock-request.c +++ b/e-util/e-stock-request.c @@ -180,14 +180,19 @@ stock_request_send_async (SoupRequest *request, GAsyncReadyCallback callback, gpointer user_data) { - GSimpleAsyncResult *result; + GSimpleAsyncResult *simple; d(printf("received request for %s\n", soup_uri_to_string (uri, FALSE))); - result = g_simple_async_result_new (G_OBJECT (request), callback, - user_data, stock_request_send_async); - g_simple_async_result_run_in_thread (result, handle_stock_request, - G_PRIORITY_DEFAULT, cancellable); + simple = g_simple_async_result_new ( + G_OBJECT (request), callback, user_data, + stock_request_send_async); + + g_simple_async_result_set_check_cancellable (simple, cancellable); + + g_simple_async_result_run_in_thread ( + simple, handle_stock_request, + G_PRIORITY_DEFAULT, cancellable); } static GInputStream * |