[evolution] Bug 768369 - Avoid "Quit with unsent messages" question without shell window



commit f65656ba23b7467bd581f20401d13ad030a12894
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jul 4 17:44:29 2016 +0200

    Bug 768369 - Avoid "Quit with unsent messages" question without shell window

 mail/e-mail-backend.c |   16 +++++++++++++++-
 mail/mail.error.xml   |    2 +-
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index f50049a..3483017 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -486,6 +486,7 @@ mail_backend_quit_requested_cb (EShell *shell,
        EMailSession *session;
        CamelFolder *folder;
        GtkWindow *window;
+       GList *app_windows;
        gint response;
 
        window = e_shell_get_active_window (shell);
@@ -514,8 +515,21 @@ mail_backend_quit_requested_cb (EShell *shell,
        if (camel_folder_summary_get_visible_count (folder->summary) == 0)
                return;
 
+       app_windows = gtk_application_get_windows (GTK_APPLICATION (shell));
+       while (app_windows) {
+               if (E_IS_SHELL_WINDOW (app_windows->data))
+                       break;
+
+               app_windows = g_list_next (app_windows);
+       }
+
+       /* Either there is any EShellWindow available, then the quit can be
+          truly cancelled, or there is none and the question is useless. */
+       if (!app_windows)
+               return;
+
        response = e_alert_run_dialog_for_args (
-               window, "mail:exit-unsaved", NULL);
+               window, "mail:exit-unsent-question", NULL);
 
        if (response == GTK_RESPONSE_YES)
                return;
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index 6853c9e..2293cf3 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -123,7 +123,7 @@ Many email systems add an Apparently-To header to messages that only have BCC re
     <button _label="_Open Messages" response="GTK_RESPONSE_YES"/>
   </error>
 
-  <error id="exit-unsaved" type="warning" default="GTK_RESPONSE_NO">
+  <error id="exit-unsent-question" type="warning" default="GTK_RESPONSE_NO">
     <_primary>You have unsent messages, do you wish to quit anyway?</_primary>
     <_secondary xml:space="preserve">If you quit, these messages will not be sent until Evolution is started 
again.</_secondary>
     <button stock="gtk-cancel" response="GTK_RESPONSE_NO"/>


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