From c64eb72e69854b66fa06b24dbf04897c55d96f76 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sat, 2 Feb 2019 13:03:10 +1100 Subject: [PATCH] Display a placeholder when email body loading is taking a long time --- .../conversation-email.vala | 6 ++++- .../conversation-message.vala | 26 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/client/conversation-viewer/conversation-email.vala b/src/client/conversation-viewer/conversation-email.vala index 875f43ec..44f6724b 100644 --- a/src/client/conversation-viewer/conversation-email.vala +++ b/src/client/conversation-viewer/conversation-email.vala @@ -551,7 +551,7 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface { ); this.body_loading_timeout = new Geary.TimeoutManager.milliseconds( - BODY_LOAD_TIMEOUT_MSEC, this.primary_message.start_progress_pulse + BODY_LOAD_TIMEOUT_MSEC, this.on_body_loading_timeout ); pack_start(this.primary_message, true, true, 0); @@ -1006,6 +1006,10 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface { op.run_dialog(window); } + private void on_body_loading_timeout() { + this.primary_message.show_loading_pane(); + } + private void on_flag_remote_images(ConversationMessage view) { // XXX check we aren't already auto loading the image mark_email(Geary.EmailFlags.LOAD_REMOTE_IMAGES, null); diff --git a/src/client/conversation-viewer/conversation-message.vala b/src/client/conversation-viewer/conversation-message.vala index 4ab3bbf1..c1712851 100644 --- a/src/client/conversation-viewer/conversation-message.vala +++ b/src/client/conversation-viewer/conversation-message.vala @@ -504,6 +504,32 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface { body_revealer.set_reveal_child(false); } + /** Shows a panel when an email is being loaded. */ + public void show_loading_pane() { + Components.PlaceholderPane pane = new Components.PlaceholderPane(); + pane.icon_name = "content-loading-symbolic"; + pane.title = ""; + pane.subtitle = ""; + + // Don't want to break the announced freeze for 0.13, so just + // hope the icon gets the message across for now and replace + // them with the ones below for 0.14. + + // Translators: Title label for placeholder when multiple + // an error occurs loading a message for display. + //pane.title = _("A problem occurred"); + // Translators: Sub-title label for placeholder when multiple + // an error occurs loading a message for display. + //pane.subtitle = _( + // "This email cannot currently be displayed" + //); + this.body_placeholder = pane; + this.web_view.hide(); + this.body_container.add(pane); + show_message_body(true); + start_progress_pulse(); + } + /** Shows an error panel when email loading failed. */ public void show_load_error_pane() { Components.PlaceholderPane pane = new Components.PlaceholderPane();