[geary/wip/765516-gtk-widget-conversation-viewer: 86/119] Gracefully handle messages with no from address in conversation viewer.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/765516-gtk-widget-conversation-viewer: 86/119] Gracefully handle messages with no from address in conversation viewer.
- Date: Mon, 15 Aug 2016 00:23:41 +0000 (UTC)
commit 9c91fdc31df789a77eb18b686215820cf386eb3d
Author: Michael James Gratton <mike vee net>
Date: Tue Jul 26 10:05:28 2016 +1000
Gracefully handle messages with no from address in conversation viewer.
.../conversation-viewer/conversation-message.vala | 50 ++++++++++++++------
1 files changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala
b/src/client/conversation-viewer/conversation-message.vala
index f466b46..cc16027 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -226,7 +226,21 @@ public class ConversationMessage : Gtk.Box {
// Full headers
- set_flowbox_addresses(from, message.from, "bold");
+ if (message.from != null && message.from.size > 0) {
+ set_flowbox_addresses(this.from, message.from, "bold");
+ } else {
+ Gtk.Label label = new Gtk.Label(null);
+ label.set_markup(format_sender_preview(message.from));
+
+ // XXX This is copied from set_flowbox_addresses below
+ Gtk.FlowBoxChild child = new Gtk.FlowBoxChild();
+ child.add(label);
+ child.set_halign(Gtk.Align.START);
+ //child.set_valign(Gtk.Align.START);
+ child.show_all();
+
+ this.from.add(child);
+ }
date.set_text(message_date ?? "");
if (message.subject != null) {
subject.set_text(message.subject.value);
@@ -518,22 +532,28 @@ public class ConversationMessage : Gtk.Box {
string dim_color = GtkUtil.pango_color_from_theme(
get_style_context(), "insensitive_fg_color"
);
- int i = 0;
string value = "";
- Gee.List<Geary.RFC822.MailboxAddress> list = addresses.get_all();
- foreach (Geary.RFC822.MailboxAddress addr in list) {
- string address = Geary.HTML.escape_markup(addr.address);
- if (!Geary.String.is_empty(addr.name)) {
- string name = Geary.HTML.escape_markup(addr.name);
- value += "<span weight=\"bold\">%s</span> <span color=\"%s\">%s</span>".printf(
- name, dim_color, address
- );
- } else {
- value += "<span weight=\"bold\">%s</span>".printf(address);
+ if (addresses != null && addresses.size > 0) {
+ int i = 0;
+ Gee.List<Geary.RFC822.MailboxAddress> list = addresses.get_all();
+ foreach (Geary.RFC822.MailboxAddress addr in list) {
+ string address = Geary.HTML.escape_markup(addr.address);
+ if (!Geary.String.is_empty(addr.name)) {
+ string name = Geary.HTML.escape_markup(addr.name);
+ value += "<span weight=\"bold\">%s</span> <span color=\"%s\">%s</span>".printf(
+ name, dim_color, address
+ );
+ } else {
+ value += "<span weight=\"bold\">%s</span>".printf(address);
+ }
+
+ if (++i < list.size)
+ value += ", ";
}
-
- if (++i < list.size)
- value += ", ";
+ } else {
+ value = "<span style=\"italic\">%s</span>".printf(
+ _("No sender")
+ );
}
return value;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]