[evolution/gnome-3-28] [Composer] Message generated twice when using 'Send through Outbox'



commit 647d28579fdf697092528ce2b6ec09e76513367d
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jul 4 12:32:56 2018 +0200

    [Composer] Message generated twice when using 'Send through Outbox'
    
    There is no need to generate the message twice while saving to Outbox
    when it is already available. It also meant that the user could be
    asked for S/MIME or GPG key unlock multiple times, among other things.

 src/mail/em-composer-utils.c | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/src/mail/em-composer-utils.c b/src/mail/em-composer-utils.c
index 748180ebd7..31b1049418 100644
--- a/src/mail/em-composer-utils.c
+++ b/src/mail/em-composer-utils.c
@@ -637,7 +637,12 @@ composer_send_completed (GObject *source_object,
                e_alert_run_dialog_for_args (
                        GTK_WINDOW (async_context->composer),
                        "mail-composer:saving-to-outbox", NULL);
-               e_msg_composer_save_to_outbox (async_context->composer);
+               if (async_context->message)
+                       g_signal_emit_by_name (
+                               async_context->composer, "save-to-outbox",
+                               async_context->message, activity);
+               else
+                       e_msg_composer_save_to_outbox (async_context->composer);
                goto exit;
        }
 
@@ -671,8 +676,14 @@ composer_send_completed (GObject *source_object,
                        local_error->message, NULL);
                if (response == GTK_RESPONSE_OK)  /* Try Again */
                        e_msg_composer_send (async_context->composer);
-               if (response == GTK_RESPONSE_ACCEPT)  /* Save to Outbox */
-                       e_msg_composer_save_to_outbox (async_context->composer);
+               if (response == GTK_RESPONSE_ACCEPT) { /* Save to Outbox */
+                       if (async_context->message)
+                               g_signal_emit_by_name (
+                                       async_context->composer, "save-to-outbox",
+                                       async_context->message, activity);
+                       else
+                               e_msg_composer_save_to_outbox (async_context->composer);
+               }
                set_changed = TRUE;
                goto exit;
        }
@@ -715,7 +726,12 @@ em_utils_composer_real_send (EMsgComposer *composer,
 
        settings = e_util_ref_settings ("org.gnome.evolution.mail");
        if (g_settings_get_boolean (settings, "composer-use-outbox")) {
-               e_msg_composer_save_to_outbox (composer);
+               /* Using e_msg_composer_save_to_outbox() means building
+                  the message again; better to use the built message here. */
+               g_signal_emit_by_name (
+                       composer, "save-to-outbox",
+                       message, activity);
+
                g_object_unref (settings);
                return;
        }
@@ -726,7 +742,13 @@ em_utils_composer_real_send (EMsgComposer *composer,
                e_alert_run_dialog_for_args (
                        GTK_WINDOW (composer),
                        "mail-composer:saving-to-outbox", NULL);
-               e_msg_composer_save_to_outbox (composer);
+
+               /* Using e_msg_composer_save_to_outbox() means building
+                  the message again; better to use the built message here. */
+               g_signal_emit_by_name (
+                       composer, "save-to-outbox",
+                       message, activity);
+
                return;
        }
 


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