[evolution/gnome-3-30] [mail-send-receive] Try harder when searching for mail shell view



commit e77b70c3c6686efff0a67cc5ccbc06c11689501c
Author: Milan Crha <mcrha redhat com>
Date:   Mon Sep 10 18:03:55 2018 +0200

    [mail-send-receive] Try harder when searching for mail shell view
    
    When there was selected another window than EShellWindow, even
    with the shell window being still there, the code didn't look
    for it and simply gave up, showing possible error message
    on a console as a runtime warning, instead of passing it to UI,
    where it belongs.

 src/mail/mail-send-recv.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
---
diff --git a/src/mail/mail-send-recv.c b/src/mail/mail-send-recv.c
index 8b379db046..3fe9595f18 100644
--- a/src/mail/mail-send-recv.c
+++ b/src/mail/mail-send-recv.c
@@ -462,6 +462,35 @@ mail_send_receive_get_mail_shell_view (void)
                        EShellWindow *shell_window = E_SHELL_WINDOW (active_window);
 
                        shell_view = e_shell_window_get_shell_view (shell_window, "mail");
+               } else {
+                       GList *windows, *link;
+                       EShellView *adept_mail_view = NULL;
+                       EShellWindow *first_shell_window = NULL;
+
+                       windows = gtk_application_get_windows (GTK_APPLICATION (shell));
+                       for (link = windows; link; link = g_list_next (link)) {
+                               GtkWindow *window = link->data;
+
+                               if (E_IS_SHELL_WINDOW (window)) {
+                                       EShellWindow *shell_window = E_SHELL_WINDOW (window);
+
+                                       if (!first_shell_window)
+                                               first_shell_window = shell_window;
+
+                                       if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "mail") 
== 0) {
+                                               shell_view = e_shell_window_get_shell_view (shell_window, 
"mail");
+                                               break;
+                                       } else if (!adept_mail_view) {
+                                               adept_mail_view = e_shell_window_peek_shell_view 
(shell_window, "mail");
+                                       }
+                               }
+                       }
+
+                       if (!shell_view)
+                               shell_view = adept_mail_view;
+
+                       if (!shell_view && first_shell_window)
+                               shell_view = e_shell_window_get_shell_view (first_shell_window, "mail");
                }
        }
 


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