[geary/wip/conversation-polish: 1/26] Show a placeholder when an email body was not able to be loaded
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/conversation-polish: 1/26] Show a placeholder when an email body was not able to be loaded
- Date: Sat, 2 Feb 2019 02:10:04 +0000 (UTC)
commit ee8383a0014d8b460abac30cdc245a4747714dc5
Author: Michael Gratton <mike vee net>
Date: Thu Jan 24 18:45:47 2019 +1100
Show a placeholder when an email body was not able to be loaded
.../conversation-viewer/conversation-email.vala | 2 +
.../conversation-viewer/conversation-message.vala | 60 ++++++++++++++++++++++
ui/geary.css | 6 ++-
3 files changed, 67 insertions(+), 1 deletion(-)
---
diff --git a/src/client/conversation-viewer/conversation-email.vala
b/src/client/conversation-viewer/conversation-email.vala
index 1800950f..28dc720d 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -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() {
diff --git a/src/client/conversation-viewer/conversation-message.vala
b/src/client/conversation-viewer/conversation-message.vala
index c7186e67..b0b276b4 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -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())
diff --git a/ui/geary.css b/ui/geary.css
index 4546bab5..e18e8ceb 100644
--- a/ui/geary.css
+++ b/ui/geary.css
@@ -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 {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]