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
This commit is contained in:
Milan Crha
2022-01-24 14:35:27 +01:00
parent 34286e5201
commit 0654ff2e70
3 changed files with 24 additions and 2 deletions
+5
View File
@@ -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>
+11 -2
View File
@@ -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;
}
+8
View File
@@ -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