Show a placeholder when an email body was not able to be loaded

This commit is contained in:
Michael Gratton 2019-01-24 18:45:47 +11:00 committed by Michael James Gratton
parent 2769373358
commit ee8383a001
3 changed files with 67 additions and 1 deletions

View file

@ -926,10 +926,12 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
private void handle_load_failure() {
this.message_body_state = FAILED;
this.primary_message.show_load_error_pane();
}
private void handle_load_offline() {
this.message_body_state = FAILED;
this.primary_message.show_offline_pane();
}
private inline bool is_online() {

View file

@ -215,6 +215,8 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
[GtkChild]
private Gtk.InfoBar remote_images_infobar;
private Gtk.Widget? body_placeholder = null;
// The web_view's context menu
private Gtk.Menu? context_menu = null;
@ -505,6 +507,59 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
body_revealer.set_reveal_child(false);
}
/** Shows an error panel when email loading failed. */
public void show_load_error_pane() {
Components.PlaceholderPane pane = new Components.PlaceholderPane();
pane.icon_name = "network-error-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);
stop_progress_pulse();
}
/** Shows an error panel when offline. */
public void show_offline_pane() {
show_message_body(true);
Components.PlaceholderPane pane = new Components.PlaceholderPane();
pane.icon_name = "network-offline-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 loading a
// // message for display but the account is offline.
// pane.title = _("Offline");
// // Translators: Sub-title label for placeholder when loading a
// // message for display but the account is offline.
// pane.subtitle = _(
// "This email will be downloaded when reconnected to the Internet"
// );
this.body_placeholder = pane;
this.web_view.hide();
this.body_container.add(pane);
show_message_body(true);
stop_progress_pulse();
}
/** Shows and starts pulsing the progress meter. */
public void start_progress_pulse() {
this.body_progress.show();
@ -561,6 +616,11 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
throw new GLib.IOError.CANCELLED("Conversation load cancelled");
}
this.web_view.show();
if (this.body_placeholder != null) {
this.body_placeholder.hide();
}
string? body_text = null;
try {
body_text = (message.has_html_body())

View file

@ -166,11 +166,15 @@ grid.geary-message-summary {
margin-right: 6px;
}
.geary-submessages .geary-message {
background-image: linear-gradient(rgba(0,0,0,0.2), @bg_color 6px);
}
.geary-message .geary-placeholder-pane {
margin: 36px 16px;
}
/* Composer */
.geary-composer-embed headerbar {