[evolution-data-server] Use g_simple_async_result_set_check_cancellable().



commit 30054fa892ffdfc12e7ef575a77a9b0e39008aea
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun May 13 09:50:28 2012 -0400

    Use g_simple_async_result_set_check_cancellable().
    
    Always call it immediately after g_simple_async_result_new().

 camel/camel-cipher-context.c        |   12 ++++++++++++
 camel/camel-data-wrapper.c          |    6 ++++++
 camel/camel-folder.c                |   20 ++++++++++++++++++++
 camel/camel-mime-part.c             |    2 ++
 camel/camel-offline-folder.c        |    2 ++
 camel/camel-sasl.c                  |    6 ++++++
 camel/camel-service.c               |    4 ++++
 camel/camel-session.c               |    5 +++++
 camel/camel-store.c                 |   20 ++++++++++++++++++++
 camel/camel-subscribable.c          |    4 ++++
 camel/camel-transport.c             |    2 ++
 libedataserver/e-client.c           |   11 +++++++++--
 libedataserver/e-data-server-util.c |    2 ++
 libedataserverui/e-book-auth-util.c |    2 ++
 14 files changed, 96 insertions(+), 2 deletions(-)
---
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index 72d27d8..fa46bd6 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -321,6 +321,8 @@ cipher_context_sign (CamelCipherContext *context,
 	simple = g_simple_async_result_new (
 		G_OBJECT (context), callback, user_data, cipher_context_sign);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -383,6 +385,8 @@ cipher_context_verify (CamelCipherContext *context,
 		G_OBJECT (context), callback,
 		user_data, cipher_context_verify);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -468,6 +472,8 @@ cipher_context_encrypt (CamelCipherContext *context,
 		G_OBJECT (context), callback,
 		user_data, cipher_context_encrypt);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -533,6 +539,8 @@ cipher_context_decrypt (CamelCipherContext *context,
 		G_OBJECT (context), callback,
 		user_data, cipher_context_decrypt);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -604,6 +612,8 @@ cipher_context_import_keys (CamelCipherContext *context,
 		G_OBJECT (context), callback,
 		user_data, cipher_context_import_keys);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -676,6 +686,8 @@ cipher_context_export_keys (CamelCipherContext *context,
 		G_OBJECT (context), callback,
 		user_data, cipher_context_export_keys);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index ac83359..649bde1 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -303,6 +303,8 @@ data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
 		G_OBJECT (data_wrapper), callback,
 		user_data, data_wrapper_write_to_stream);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -373,6 +375,8 @@ data_wrapper_decode_to_stream (CamelDataWrapper *data_wrapper,
 		G_OBJECT (data_wrapper), callback,
 		user_data, data_wrapper_decode_to_stream);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -441,6 +445,8 @@ data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper,
 		G_OBJECT (data_wrapper), callback, user_data,
 		data_wrapper_construct_from_stream);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index f3599e2..45dd1d2 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -992,6 +992,8 @@ folder_append_message (CamelFolder *folder,
 		G_OBJECT (folder), callback,
 		user_data, folder_append_message);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -1053,6 +1055,8 @@ folder_expunge (CamelFolder *folder,
 	simple = g_simple_async_result_new (
 		G_OBJECT (folder), callback, user_data, folder_expunge);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_run_in_thread (
 		simple, folder_expunge_thread, io_priority, cancellable);
 
@@ -1112,6 +1116,8 @@ fetch_messages (CamelFolder *folder,
 	simple = g_simple_async_result_new (
 		G_OBJECT (folder), callback, user_data, fetch_messages);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -1176,6 +1182,8 @@ folder_get_message (CamelFolder *folder,
 	simple = g_simple_async_result_new (
 		G_OBJECT (folder), callback, user_data, folder_get_message);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -1252,6 +1260,8 @@ folder_get_quota_info (CamelFolder *folder,
 		G_OBJECT (folder), callback,
 		user_data, folder_get_quota_info);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -1323,6 +1333,8 @@ purge_message_cache (CamelFolder *folder,
 	simple = g_simple_async_result_new (
 		G_OBJECT (folder), callback, user_data, purge_message_cache);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -1378,6 +1390,8 @@ folder_refresh_info (CamelFolder *folder,
 	simple = g_simple_async_result_new (
 		G_OBJECT (folder), callback, user_data, folder_refresh_info);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_run_in_thread (
 		simple, folder_refresh_info_thread, io_priority, cancellable);
 
@@ -1436,6 +1450,8 @@ folder_synchronize (CamelFolder *folder,
 	simple = g_simple_async_result_new (
 		G_OBJECT (folder), callback, user_data, folder_synchronize);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -1498,6 +1514,8 @@ folder_synchronize_message (CamelFolder *folder,
 		G_OBJECT (folder), callback,
 		user_data, folder_synchronize_message);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -1573,6 +1591,8 @@ folder_transfer_messages_to (CamelFolder *source,
 		G_OBJECT (source), callback,
 		user_data, folder_transfer_messages_to);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 1d4d2cd..3ce19fe 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -817,6 +817,8 @@ mime_part_construct_from_parser (CamelMimePart *mime_part,
 		G_OBJECT (mime_part), callback, user_data,
 		mime_part_construct_from_parser);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/camel/camel-offline-folder.c b/camel/camel-offline-folder.c
index 7e52bbc..bb61b13 100644
--- a/camel/camel-offline-folder.c
+++ b/camel/camel-offline-folder.c
@@ -276,6 +276,8 @@ offline_folder_downsync (CamelOfflineFolder *folder,
 		G_OBJECT (folder), callback,
 		user_data, offline_folder_downsync);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/camel/camel-sasl.c b/camel/camel-sasl.c
index c0e4170..9b21c56 100644
--- a/camel/camel-sasl.c
+++ b/camel/camel-sasl.c
@@ -322,6 +322,8 @@ sasl_challenge (CamelSasl *sasl,
 	simple = g_simple_async_result_new (
 		G_OBJECT (sasl), callback, user_data, sasl_challenge);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -384,6 +386,8 @@ sasl_try_empty_password (CamelSasl *sasl,
 	simple = g_simple_async_result_new (
 		G_OBJECT (sasl), callback, user_data, sasl_try_empty_password);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_run_in_thread (
 		simple, sasl_try_empty_password_thread,
 		io_priority, cancellable);
@@ -907,6 +911,8 @@ camel_sasl_challenge_base64 (CamelSasl *sasl,
 		G_OBJECT (sasl), callback, user_data,
 		camel_sasl_challenge_base64);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/camel/camel-service.c b/camel/camel-service.c
index b5e7090..bf3e7f1 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -465,6 +465,8 @@ service_authenticate (CamelService *service,
 	simple = g_simple_async_result_new (
 		G_OBJECT (service), callback, user_data, service_authenticate);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -529,6 +531,8 @@ service_query_auth_types (CamelService *service,
 		G_OBJECT (service), callback,
 		user_data, service_query_auth_types);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/camel/camel-session.c b/camel/camel-session.c
index cb60fd8..2226241 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -185,6 +185,9 @@ session_start_job_cb (JobData *job_data)
 		(GAsyncReadyCallback) session_finish_job_cb,
 		NULL, camel_session_submit_job);
 
+	g_simple_async_result_set_check_cancellable (
+		simple, job_data->cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, job_data, (GDestroyNotify) job_data_free);
 
@@ -580,6 +583,8 @@ session_authenticate (CamelSession *session,
 	simple = g_simple_async_result_new (
 		G_OBJECT (session), callback, user_data, session_authenticate);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 6f92de0..9f98123 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -454,6 +454,8 @@ store_get_folder (CamelStore *store,
 	simple = g_simple_async_result_new (
 		G_OBJECT (store), callback, user_data, store_get_folder);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -522,6 +524,8 @@ store_get_folder_info (CamelStore *store,
 		G_OBJECT (store), callback,
 		user_data, store_get_folder_info);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -590,6 +594,8 @@ store_get_inbox_folder (CamelStore *store,
 		G_OBJECT (store), callback,
 		user_data, store_get_inbox_folder);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -654,6 +660,8 @@ store_get_junk_folder (CamelStore *store,
 		G_OBJECT (store), callback,
 		user_data, store_get_junk_folder);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -718,6 +726,8 @@ store_get_trash_folder (CamelStore *store,
 		G_OBJECT (store), callback,
 		user_data, store_get_trash_folder);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -786,6 +796,8 @@ store_create_folder (CamelStore *store,
 	simple = g_simple_async_result_new (
 		G_OBJECT (store), callback, user_data, store_create_folder);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -855,6 +867,8 @@ store_delete_folder (CamelStore *store,
 	simple = g_simple_async_result_new (
 		G_OBJECT (store), callback, user_data, store_delete_folder);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -918,6 +932,8 @@ store_rename_folder (CamelStore *store,
 	simple = g_simple_async_result_new (
 		G_OBJECT (store), callback, user_data, store_rename_folder);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -979,6 +995,8 @@ store_synchronize (CamelStore *store,
 	simple = g_simple_async_result_new (
 		G_OBJECT (store), callback, user_data, store_synchronize);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -1030,6 +1048,8 @@ store_noop (CamelStore *store,
 	simple = g_simple_async_result_new (
 		G_OBJECT (store), callback, user_data, store_noop);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_run_in_thread (
 		simple, store_noop_thread, io_priority, cancellable);
 
diff --git a/camel/camel-subscribable.c b/camel/camel-subscribable.c
index b6b16da..7d1f3c4 100644
--- a/camel/camel-subscribable.c
+++ b/camel/camel-subscribable.c
@@ -162,6 +162,8 @@ subscribable_subscribe_folder (CamelSubscribable *subscribable,
 		G_OBJECT (subscribable), callback,
 		user_data, subscribable_subscribe_folder);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
@@ -227,6 +229,8 @@ subscribable_unsubscribe_folder (CamelSubscribable *subscribable,
 		G_OBJECT (subscribable), callback,
 		user_data, subscribable_unsubscribe_folder);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/camel/camel-transport.c b/camel/camel-transport.c
index a46418a..c935918 100644
--- a/camel/camel-transport.c
+++ b/camel/camel-transport.c
@@ -119,6 +119,8 @@ transport_send_to (CamelTransport *transport,
 	simple = g_simple_async_result_new (
 		G_OBJECT (transport), callback, user_data, transport_send_to);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_context, (GDestroyNotify) async_context_free);
 
diff --git a/libedataserver/e-client.c b/libedataserver/e-client.c
index e04a49b..4896cbe 100644
--- a/libedataserver/e-client.c
+++ b/libedataserver/e-client.c
@@ -1940,9 +1940,16 @@ e_client_finish_async_without_dbus (EClient *client,
 	opid = e_client_register_op (client, use_cancellable);
 	g_return_if_fail (opid > 0);
 
-	simple = g_simple_async_result_new (G_OBJECT (client), callback, user_data, source_tag);
-	g_simple_async_result_set_op_res_gpointer (simple, op_res, destroy_op_res);
+	simple = g_simple_async_result_new (
+		G_OBJECT (client), callback, user_data, source_tag);
+
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
+	g_simple_async_result_set_op_res_gpointer (
+		simple, op_res, destroy_op_res);
+
 	g_simple_async_result_complete_in_idle (simple);
+
 	g_object_unref (simple);
 
 	if (use_cancellable != cancellable)
diff --git a/libedataserver/e-data-server-util.c b/libedataserver/e-data-server-util.c
index 219637c..0d7e891 100644
--- a/libedataserver/e-data-server-util.c
+++ b/libedataserver/e-data-server-util.c
@@ -1102,6 +1102,8 @@ e_file_recursive_delete (GFile *file,
 		G_OBJECT (file), callback, user_data,
 		e_file_recursive_delete);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_run_in_thread (
 		simple, file_recursive_delete_thread,
 		io_priority, cancellable);
diff --git a/libedataserverui/e-book-auth-util.c b/libedataserverui/e-book-auth-util.c
index 03e0e14..f4001e4 100644
--- a/libedataserverui/e-book-auth-util.c
+++ b/libedataserverui/e-book-auth-util.c
@@ -593,6 +593,8 @@ e_load_book_source_async (ESource *source,
 		G_OBJECT (source), callback,
 		user_data, e_load_book_source_async);
 
+	g_simple_async_result_set_check_cancellable (simple, cancellable);
+
 	g_simple_async_result_set_op_res_gpointer (
 		simple, context, (GDestroyNotify)
 		load_book_source_context_free);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]