diff --git a/src/client/conversation-viewer/conversation-message.vala b/src/client/conversation-viewer/conversation-message.vala index 3da90eb4..2876c347 100644 --- a/src/client/conversation-viewer/conversation-message.vala +++ b/src/client/conversation-viewer/conversation-message.vala @@ -79,6 +79,8 @@ public class ConversationMessage : Gtk.Box { [GtkChild] private Gtk.Box date_header; + [GtkChild] + private Gtk.Image attachment_icon; [GtkChild] private Gtk.Button flag_button; [GtkChild] @@ -193,9 +195,9 @@ public class ConversationMessage : Gtk.Box { // get_style_context().add_class("sent"); // } - // // Set attachment icon and add the attachments container if there are displayed attachments. - // int displayed = displayed_attachments(email); - // set_attachment_icon(div_message, displayed > 0); + // Set attachment icon and add the attachments container if there are displayed attachments. + int displayed = displayed_attachments(email); + attachment_icon.set_visible(displayed > 0); // if (displayed > 0) { // insert_attachments(div_message, email.attachments); // } @@ -987,32 +989,32 @@ public class ConversationMessage : Gtk.Box { // messages in he current convo for this sender } - // private bool should_show_attachment(Geary.Attachment attachment) { - // // if displayed inline, don't include in attachment list - // if (attachment.content_id in inlined_content_ids) - // return false; - - // switch (attachment.content_disposition.disposition_type) { - // case Geary.Mime.DispositionType.ATTACHMENT: - // return true; - - // case Geary.Mime.DispositionType.INLINE: - // return !is_content_type_supported_inline(attachment.content_type); - - // default: - // assert_not_reached(); - // } - // } + private int displayed_attachments(Geary.Email email) { + int ret = 0; + foreach (Geary.Attachment attachment in email.attachments) { + if (should_show_attachment(attachment)) { + ret++; + } + } + return ret; + } - // private int displayed_attachments(Geary.Email email) { - // int ret = 0; - // foreach (Geary.Attachment attachment in email.attachments) { - // if (should_show_attachment(attachment)) { - // ret++; - // } - // } - // return ret; - // } + private bool should_show_attachment(Geary.Attachment attachment) { + // if displayed inline, don't include in attachment list + if (attachment.content_id in inlined_content_ids) + return false; + + switch (attachment.content_disposition.disposition_type) { + case Geary.Mime.DispositionType.ATTACHMENT: + return true; + + case Geary.Mime.DispositionType.INLINE: + return !is_content_type_supported_inline(attachment.content_type); + + default: + assert_not_reached(); + } + } // private void insert_attachments(WebKit.DOM.HTMLElement email_container, // Gee.List attachments) { diff --git a/ui/conversation-message.ui b/ui/conversation-message.ui index cbfb0d0a..3dcf1696 100644 --- a/ui/conversation-message.ui +++ b/ui/conversation-message.ui @@ -397,6 +397,19 @@ False 1 True + + + True + False + This message has attachments + mail-attachment-symbolic + + + False + True + 0 + + True