diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-11-01 05:11:35 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-11-01 10:54:30 +0800 |
commit | ccc2b3a14bf19b3db1d837887a07e74f50db078c (patch) | |
tree | 639b3deaf2fa7e15ebb149a705095fbb0d717a7b /composer | |
parent | 82925c6be94e9e48e4ef521a88a9feec24cf9eef (diff) | |
download | gsoc2013-evolution-ccc2b3a14bf19b3db1d837887a07e74f50db078c.tar.gz gsoc2013-evolution-ccc2b3a14bf19b3db1d837887a07e74f50db078c.tar.zst gsoc2013-evolution-ccc2b3a14bf19b3db1d837887a07e74f50db078c.zip |
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.
Diffstat (limited to 'composer')
-rw-r--r-- | composer/e-msg-composer.c | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 2bca57d3fd..48410f89dc 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -3499,9 +3499,12 @@ msg_composer_send_cb (EMsgComposer *composer, AsyncContext *context) { CamelMimeMessage *message; + EAlertSink *alert_sink; GtkhtmlEditor *editor; GError *error = NULL; + alert_sink = e_activity_get_alert_sink (context->activity); + message = e_msg_composer_get_message_finish (composer, result, &error); /* Ignore cancellations. */ @@ -3514,11 +3517,11 @@ msg_composer_send_cb (EMsgComposer *composer, if (error != NULL) { g_warn_if_fail (message == NULL); - async_context_free (context); e_alert_submit ( - E_ALERT_SINK (composer), + alert_sink, "mail-composer:no-build-message", error->message, NULL); + async_context_free (context); g_error_free (error); return; } @@ -3548,6 +3551,7 @@ void e_msg_composer_send (EMsgComposer *composer) { AsyncContext *context; + EAlertSink *alert_sink; EActivityBar *activity_bar; GCancellable *cancellable; gboolean proceed_with_send = TRUE; @@ -3563,6 +3567,9 @@ e_msg_composer_send (EMsgComposer *composer) context = g_slice_new0 (AsyncContext); context->activity = e_composer_activity_new (composer); + alert_sink = E_ALERT_SINK (composer); + e_activity_set_alert_sink (context->activity, alert_sink); + cancellable = camel_operation_new (); e_activity_set_cancellable (context->activity, cancellable); g_object_unref (cancellable); @@ -3582,9 +3589,12 @@ msg_composer_save_to_drafts_cb (EMsgComposer *composer, AsyncContext *context) { CamelMimeMessage *message; + EAlertSink *alert_sink; GtkhtmlEditor *editor; GError *error = NULL; + alert_sink = e_activity_get_alert_sink (context->activity); + message = e_msg_composer_get_message_draft_finish ( composer, result, &error); @@ -3598,11 +3608,11 @@ msg_composer_save_to_drafts_cb (EMsgComposer *composer, if (error != NULL) { g_warn_if_fail (message == NULL); - async_context_free (context); e_alert_submit ( - E_ALERT_SINK (composer), + alert_sink, "mail-composer:no-build-message", error->message, NULL); + async_context_free (context); g_error_free (error); return; } @@ -3632,6 +3642,7 @@ void e_msg_composer_save_to_drafts (EMsgComposer *composer) { AsyncContext *context; + EAlertSink *alert_sink; EActivityBar *activity_bar; GCancellable *cancellable; @@ -3640,6 +3651,9 @@ e_msg_composer_save_to_drafts (EMsgComposer *composer) context = g_slice_new0 (AsyncContext); context->activity = e_composer_activity_new (composer); + alert_sink = E_ALERT_SINK (composer); + e_activity_set_alert_sink (context->activity, alert_sink); + cancellable = camel_operation_new (); e_activity_set_cancellable (context->activity, cancellable); g_object_unref (cancellable); @@ -3659,9 +3673,12 @@ msg_composer_save_to_outbox_cb (EMsgComposer *composer, AsyncContext *context) { CamelMimeMessage *message; + EAlertSink *alert_sink; GtkhtmlEditor *editor; GError *error = NULL; + alert_sink = e_activity_get_alert_sink (context->activity); + message = e_msg_composer_get_message_finish (composer, result, &error); /* Ignore cancellations. */ @@ -3674,11 +3691,11 @@ msg_composer_save_to_outbox_cb (EMsgComposer *composer, if (error != NULL) { g_warn_if_fail (message == NULL); - async_context_free (context); e_alert_submit ( - E_ALERT_SINK (composer), + alert_sink, "mail-composer:no-build-message", error->message, NULL); + async_context_free (context); g_error_free (error); return; } @@ -3708,6 +3725,7 @@ void e_msg_composer_save_to_outbox (EMsgComposer *composer) { AsyncContext *context; + EAlertSink *alert_sink; EActivityBar *activity_bar; GCancellable *cancellable; gboolean proceed_with_save = TRUE; @@ -3723,6 +3741,9 @@ e_msg_composer_save_to_outbox (EMsgComposer *composer) context = g_slice_new0 (AsyncContext); context->activity = e_composer_activity_new (composer); + alert_sink = E_ALERT_SINK (composer); + e_activity_set_alert_sink (context->activity, alert_sink); + cancellable = camel_operation_new (); e_activity_set_cancellable (context->activity, cancellable); g_object_unref (cancellable); @@ -3742,8 +3763,11 @@ msg_composer_print_cb (EMsgComposer *composer, AsyncContext *context) { CamelMimeMessage *message; + EAlertSink *alert_sink; GError *error = NULL; + alert_sink = e_activity_get_alert_sink (context->activity); + message = e_msg_composer_get_message_print_finish ( composer, result, &error); @@ -3759,7 +3783,7 @@ msg_composer_print_cb (EMsgComposer *composer, g_warn_if_fail (message == NULL); async_context_free (context); e_alert_submit ( - E_ALERT_SINK (composer), + alert_sink, "mail-composer:no-build-message", error->message, NULL); g_error_free (error); @@ -3789,6 +3813,7 @@ e_msg_composer_print (EMsgComposer *composer, GtkPrintOperationAction print_action) { AsyncContext *context; + EAlertSink *alert_sink; EActivityBar *activity_bar; GCancellable *cancellable; @@ -3798,6 +3823,9 @@ e_msg_composer_print (EMsgComposer *composer, context->activity = e_composer_activity_new (composer); context->print_action = print_action; + alert_sink = E_ALERT_SINK (composer); + e_activity_set_alert_sink (context->activity, alert_sink); + cancellable = camel_operation_new (); e_activity_set_cancellable (context->activity, cancellable); g_object_unref (cancellable); |