Display a placeholder when email body loading is taking a long time

This commit is contained in:
Michael Gratton 2019-02-02 13:03:10 +11:00
parent f223564829
commit c64eb72e69
2 changed files with 31 additions and 1 deletions

View file

@ -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);

View file

@ -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();