From ccc2b3a14bf19b3db1d837887a07e74f50db078c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 31 Oct 2010 17:11:35 -0400 Subject: EActivity: Add an "alert-sink" property. This is just for convenience, EActivity does not use this property. Especially useful in async function callbacks when the operation failed and now you have to do something useful with the GError. --- mail/em-composer-utils.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'mail') diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 85d5bb26d4..99df9ed1a7 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -598,9 +598,14 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder, AsyncContext *context) { CamelSession *session; + EAlertSink *alert_sink; GCancellable *cancellable; GError *error = NULL; + session = e_msg_composer_get_session (context->composer); + alert_sink = e_activity_get_alert_sink (context->activity); + cancellable = e_activity_get_cancellable (context->activity); + e_mail_folder_append_message_finish ( drafts_folder, result, &context->message_uid, &error); @@ -615,7 +620,7 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder, if (error != NULL) { g_warn_if_fail (context->message_uid == NULL); e_alert_submit ( - E_ALERT_SINK (context->composer), + alert_sink, "mail-composer:save-to-drafts-error", error->message, NULL); async_context_free (context); @@ -623,9 +628,6 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder, return; } - session = e_msg_composer_get_session (context->composer); - cancellable = e_activity_get_cancellable (context->activity); - /* Mark the previously saved draft message for deletion. * Note: This is just a nice-to-have; ignore failures. */ e_mail_session_handle_draft_headers ( @@ -761,8 +763,11 @@ composer_save_to_outbox_completed (CamelFolder *outbox_folder, GAsyncResult *result, AsyncContext *context) { + EAlertSink *alert_sink; GError *error = NULL; + alert_sink = e_activity_get_alert_sink (context->activity); + e_mail_folder_append_message_finish ( outbox_folder, result, NULL, &error); @@ -775,7 +780,7 @@ composer_save_to_outbox_completed (CamelFolder *outbox_folder, if (error != NULL) { e_alert_submit ( - E_ALERT_SINK (context->composer), + alert_sink, "mail-composer:append-to-outbox-error", error->message, NULL); g_error_free (error); -- cgit