[evolution] Use g_simple_async_result_set_check_cancellable().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Use g_simple_async_result_set_check_cancellable().
- Date: Sun, 13 May 2012 14:10:00 +0000 (UTC)
commit 53a3d2f4e1473dd93fee8e7367bc329b8dc5ef23
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun May 13 09:29:38 2012 -0400
Use g_simple_async_result_set_check_cancellable().
Always call it immediately after g_simple_async_result_new().
addressbook/gui/widgets/eab-contact-formatter.c | 13 +++++++------
composer/e-msg-composer.c | 8 ++++++++
e-util/e-file-request.c | 15 ++++++++++-----
e-util/e-file-utils.c | 2 ++
e-util/e-stock-request.c | 15 ++++++++++-----
em-format/em-format.c | 15 ++++++++++-----
libemail-engine/e-mail-folder-utils.c | 14 ++++++++++++++
libemail-engine/e-mail-session-utils.c | 8 ++++++++
libemail-engine/e-mail-session.c | 6 ++++++
libemail-engine/e-mail-store-utils.c | 8 ++++++++
mail/e-http-request.c | 15 ++++++++++-----
mail/e-mail-request.c | 15 ++++++++++-----
modules/composer-autosave/e-autosave-utils.c | 4 ++++
13 files changed, 107 insertions(+), 31 deletions(-)
---
diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c
index 57ce415..c436ea8 100644
--- a/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/addressbook/gui/widgets/eab-contact-formatter.c
@@ -1237,7 +1237,7 @@ eab_contact_formatter_format_contact_async (EABContactFormatter *formatter,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GSimpleAsyncResult *result;
+ GSimpleAsyncResult *simple;
g_return_if_fail (EAB_IS_CONTACT_FORMATTER (formatter));
g_return_if_fail (E_IS_CONTACT (contact));
@@ -1249,13 +1249,14 @@ eab_contact_formatter_format_contact_async (EABContactFormatter *formatter,
formatter->priv->contact = contact;
- result = g_simple_async_result_new (
- G_OBJECT (formatter),
- callback, user_data,
- eab_contact_formatter_format_contact_async);
+ simple = g_simple_async_result_new (
+ G_OBJECT (formatter), callback, user_data,
+ eab_contact_formatter_format_contact_async);
+
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
g_simple_async_result_run_in_thread (
- result, do_start_async_formatter,
+ simple, do_start_async_formatter,
G_PRIORITY_DEFAULT, cancellable);
}
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index f033e9d..50c51b6 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1081,6 +1081,8 @@ composer_build_message (EMsgComposer *composer,
G_OBJECT (composer), callback,
user_data, composer_build_message);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -4574,6 +4576,8 @@ e_msg_composer_get_message (EMsgComposer *composer,
G_OBJECT (composer), callback,
user_data, e_msg_composer_get_message);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
if (gtkhtml_editor_get_html_mode (GTKHTML_EDITOR (composer)))
flags |= COMPOSER_FLAG_HTML_CONTENT;
@@ -4649,6 +4653,8 @@ e_msg_composer_get_message_print (EMsgComposer *composer,
G_OBJECT (composer), callback,
user_data, e_msg_composer_get_message_print);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
flags |= COMPOSER_FLAG_HTML_CONTENT;
flags |= COMPOSER_FLAG_SAVE_OBJECT_DATA;
@@ -4698,6 +4704,8 @@ e_msg_composer_get_message_draft (EMsgComposer *composer,
G_OBJECT (composer), callback,
user_data, e_msg_composer_get_message_draft);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
if (gtkhtml_editor_get_html_mode (GTKHTML_EDITOR (composer)))
flags |= COMPOSER_FLAG_HTML_CONTENT;
diff --git a/e-util/e-file-request.c b/e-util/e-file-request.c
index 62c64e3..08d8682 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 ebb65f4..90b2e77 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 2b805f4..c9a2e5f 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 *
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 6b08705..23b2fd6 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1996,7 +1996,7 @@ em_format_parse_async (EMFormat *emf,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GSimpleAsyncResult *result;
+ GSimpleAsyncResult *simple;
g_return_if_fail (EM_IS_FORMAT (emf));
@@ -2023,10 +2023,15 @@ em_format_parse_async (EMFormat *emf,
}
- result = g_simple_async_result_new (G_OBJECT (emf), callback,
- user_data, em_format_parse_async);
- g_simple_async_result_run_in_thread (result, emf_start_async_parser,
- G_PRIORITY_DEFAULT, cancellable);
+ simple = g_simple_async_result_new (
+ G_OBJECT (emf), callback,
+ user_data, em_format_parse_async);
+
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
+ g_simple_async_result_run_in_thread (
+ simple, emf_start_async_parser,
+ G_PRIORITY_DEFAULT, cancellable);
}
void
diff --git a/libemail-engine/e-mail-folder-utils.c b/libemail-engine/e-mail-folder-utils.c
index ddf2bcf..6d2f3f4 100644
--- a/libemail-engine/e-mail-folder-utils.c
+++ b/libemail-engine/e-mail-folder-utils.c
@@ -147,6 +147,8 @@ e_mail_folder_append_message (CamelFolder *folder,
G_OBJECT (folder), callback, user_data,
e_mail_folder_append_message);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -301,6 +303,8 @@ e_mail_folder_build_attachment (CamelFolder *folder,
G_OBJECT (folder), callback, user_data,
e_mail_folder_build_attachment);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -558,6 +562,8 @@ e_mail_folder_find_duplicate_messages (CamelFolder *folder,
G_OBJECT (folder), callback, user_data,
e_mail_folder_find_duplicate_messages);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -686,6 +692,8 @@ e_mail_folder_get_multiple_messages (CamelFolder *folder,
G_OBJECT (folder), callback, user_data,
e_mail_folder_get_multiple_messages);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -916,6 +924,8 @@ e_mail_folder_remove (CamelFolder *folder,
G_OBJECT (folder), callback,
user_data, e_mail_folder_remove);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_run_in_thread (
simple, mail_folder_remove_thread,
io_priority, cancellable);
@@ -1127,6 +1137,8 @@ e_mail_folder_remove_attachments (CamelFolder *folder,
G_OBJECT (folder), callback, user_data,
e_mail_folder_remove_attachments);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -1377,6 +1389,8 @@ e_mail_folder_save_messages (CamelFolder *folder,
G_OBJECT (folder), callback, user_data,
e_mail_folder_save_messages);
+ 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/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c
index 81ad83e..403ba57 100644
--- a/libemail-engine/e-mail-session-utils.c
+++ b/libemail-engine/e-mail-session-utils.c
@@ -205,6 +205,8 @@ e_mail_session_handle_draft_headers (EMailSession *session,
G_OBJECT (session), callback, user_data,
e_mail_session_handle_draft_headers);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -356,6 +358,8 @@ e_mail_session_handle_source_headers (EMailSession *session,
G_OBJECT (session), callback, user_data,
e_mail_session_handle_source_headers);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -819,6 +823,8 @@ e_mail_session_send_to (EMailSession *session,
G_OBJECT (session), callback,
user_data, e_mail_session_send_to);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -927,6 +933,8 @@ e_mail_session_unsubscribe_folder (EMailSession *session,
G_OBJECT (session), callback, user_data,
e_mail_session_unsubscribe_folder);
+ 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/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c
index 0b1625f..475f802 100644
--- a/libemail-engine/e-mail-session.c
+++ b/libemail-engine/e-mail-session.c
@@ -1738,6 +1738,8 @@ e_mail_session_get_inbox (EMailSession *session,
G_OBJECT (session), callback,
user_data, e_mail_session_get_inbox);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -1835,6 +1837,8 @@ e_mail_session_get_trash (EMailSession *session,
G_OBJECT (session), callback,
user_data, e_mail_session_get_trash);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -1948,6 +1952,8 @@ e_mail_session_uri_to_folder (EMailSession *session,
G_OBJECT (session), callback,
user_data, e_mail_session_uri_to_folder);
+ 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/libemail-engine/e-mail-store-utils.c b/libemail-engine/e-mail-store-utils.c
index 2f5b044..9719c0d 100644
--- a/libemail-engine/e-mail-store-utils.c
+++ b/libemail-engine/e-mail-store-utils.c
@@ -122,6 +122,8 @@ e_mail_store_create_folder (CamelStore *store,
G_OBJECT (store), callback, user_data,
e_mail_store_create_folder);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) async_context_free);
@@ -216,6 +218,8 @@ e_mail_store_go_offline (CamelStore *store,
G_OBJECT (store), callback,
user_data, e_mail_store_go_offline);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_run_in_thread (
simple, (GSimpleAsyncThreadFunc)
mail_store_go_offline_thread,
@@ -291,6 +295,8 @@ e_mail_store_go_online (CamelStore *store,
G_OBJECT (store), callback,
user_data, e_mail_store_go_online);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_run_in_thread (
simple, (GSimpleAsyncThreadFunc)
mail_store_go_online_thread,
@@ -364,6 +370,8 @@ e_mail_store_prepare_for_offline (CamelStore *store,
G_OBJECT (store), callback, user_data,
e_mail_store_prepare_for_offline);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_run_in_thread (
simple, (GSimpleAsyncThreadFunc)
mail_store_prepare_for_offline_thread,
diff --git a/mail/e-http-request.c b/mail/e-http-request.c
index a8417ef..edf1315 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 8a51b2a..d36e0cb 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 *
diff --git a/modules/composer-autosave/e-autosave-utils.c b/modules/composer-autosave/e-autosave-utils.c
index 8d03aaa..88f6dde 100644
--- a/modules/composer-autosave/e-autosave-utils.c
+++ b/modules/composer-autosave/e-autosave-utils.c
@@ -410,6 +410,8 @@ e_composer_load_snapshot (EShell *shell,
G_OBJECT (shell), callback, user_data,
e_composer_load_snapshot);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) load_context_free);
@@ -464,6 +466,8 @@ e_composer_save_snapshot (EMsgComposer *composer,
G_OBJECT (composer), callback, user_data,
e_composer_save_snapshot);
+ g_simple_async_result_set_check_cancellable (simple, cancellable);
+
g_simple_async_result_set_op_res_gpointer (
simple, context, (GDestroyNotify) save_context_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]