diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-11-01 05:11:35 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2010-11-10 06:33:20 +0800 |
commit | 616f0b140bb937d7afeb46f834e32e8c51a67e1e (patch) | |
tree | e9a794d8f2722bb9034f01bf1192b0b16b2e3d57 /composer/e-msg-composer.c | |
parent | 4a929caada81820d7499b09875870b84e9900912 (diff) | |
download | gsoc2013-evolution-616f0b140bb937d7afeb46f834e32e8c51a67e1e.tar gsoc2013-evolution-616f0b140bb937d7afeb46f834e32e8c51a67e1e.tar.gz gsoc2013-evolution-616f0b140bb937d7afeb46f834e32e8c51a67e1e.tar.bz2 gsoc2013-evolution-616f0b140bb937d7afeb46f834e32e8c51a67e1e.tar.lz gsoc2013-evolution-616f0b140bb937d7afeb46f834e32e8c51a67e1e.tar.xz gsoc2013-evolution-616f0b140bb937d7afeb46f834e32e8c51a67e1e.tar.zst gsoc2013-evolution-616f0b140bb937d7afeb46f834e32e8c51a67e1e.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/e-msg-composer.c')
-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); |