[evolution] MessageList: Show regen error in GUI, rather than in the terminal



commit 0654ff2e7011e843a4664e4e4d222bd205a4d013
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 24 14:35:27 2022 +0100

    MessageList: Show regen error in GUI, rather than in the terminal
    
    This will help to diagnose any error, which could happen during
    the regen of the message list.
    
    Related to https://gitlab.gnome.org/GNOME/evolution/-/issues/1780

 src/mail/mail.error.xml     |  5 +++++
 src/mail/message-list.c     | 13 +++++++++++--
 src/shell/e-shell-taskbar.c |  8 ++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/mail/mail.error.xml b/src/mail/mail.error.xml
index 421bf1f587..50dd00c490 100644
--- a/src/mail/mail.error.xml
+++ b/src/mail/mail.error.xml
@@ -661,4 +661,9 @@ in the folder will be available in offline mode.</_secondary>
     <_primary>Cannot archive messages</_primary>
     <_secondary>No Archive folder is configured. Please configure one for the account in order to be able to 
archive messages.</_secondary>
   </error>
+
+  <error id="message-list-regen-failed" type="error">
+    <_primary>Failed to generate message list</_primary>
+    <secondary>{0}</secondary>
+  </error>
 </error-list>
diff --git a/src/mail/message-list.c b/src/mail/message-list.c
index fa384d2413..7f46260e8e 100644
--- a/src/mail/message-list.c
+++ b/src/mail/message-list.c
@@ -6728,9 +6728,18 @@ message_list_regen_done_cb (GObject *source_object,
                g_error_free (local_error);
                return;
 
-       /* FIXME This should be handed off to an EAlertSink. */
        } else if (local_error != NULL) {
-               g_warning ("%s: %s", G_STRFUNC, local_error->message);
+               EAlertSink *alert_sink = e_activity_get_alert_sink (activity);
+               gboolean handled = FALSE;
+
+               if (alert_sink) {
+                       e_alert_submit (alert_sink, "mail:message-list-regen-failed", local_error->message, 
NULL);
+                       handled = TRUE;
+               }
+
+               if (!handled)
+                       g_warning ("%s: %s", G_STRFUNC, local_error->message);
+
                g_error_free (local_error);
                return;
        }
diff --git a/src/shell/e-shell-taskbar.c b/src/shell/e-shell-taskbar.c
index 44928ac353..fb98dd7fb4 100644
--- a/src/shell/e-shell-taskbar.c
+++ b/src/shell/e-shell-taskbar.c
@@ -181,6 +181,14 @@ shell_taskbar_activity_add (EShellTaskbar *shell_taskbar,
                shell_taskbar_weak_notify_cb, shell_taskbar);
 
        g_hash_table_insert (proxy_table, activity, proxy);
+
+       /* Ensure there's an alert sink set, thus the errors are shown in the GUI */
+       if (!e_activity_get_alert_sink (activity)) {
+               EShellView *shell_view = e_shell_taskbar_get_shell_view (shell_taskbar);
+               EShellContent *shell_content = e_shell_view_get_shell_content (shell_view);
+
+               e_activity_set_alert_sink (activity, E_ALERT_SINK (shell_content));
+       }
 }
 
 static gboolean


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