Reenable and update code for displayed attachments.

* src/client/conversation-viewer/conversation-message.vala: Add template
  child widgets for displayed attachment UI, add signal for when user
  activates an attachment.
  (ConversationMessage::ConversationMessage): Ensure the attachment UI
  is visible when there are displayed attachments.
  (ConversationMessage::start_loading): New method for async loading of
  message content, use just for attachments for now.
  (ConversationMessage::on_attachments_view_activated): Handle activation
  signal for specific attachments.
  (ConversationMessage::load_attachments): Load attachments from the
  message into the new UI.
  (ConversationMessage::load_attachment_icon): Load icons for the
  attachments UI from the attachment itself if an image, else from the
  icon theme.

* src/client/application/geary-controller.vala: Hook up
  attachment_activated signal to conversation messages.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer::add_message): Ensure message loading starts after
  new conversation messages are added to the window hierarchy.

* ui/conversation-message.ui: Add an attachments box, with an icon view
  for displayed attachments.
This commit is contained in:
Michael James Gratton 2016-04-18 11:01:46 +10:00
parent 6f54c477dd
commit b5270e3740
4 changed files with 223 additions and 81 deletions

View file

@ -700,4 +700,61 @@
<class name="tooltip"/>
</style>
</object>
<object class="GtkListStore" id="attachments_model">
<columns>
<!-- column-name icon -->
<column type="GdkPixbuf"/>
<!-- column-name label -->
<column type="gchararray"/>
<!-- column-name attachment_id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkBox" id="attachments_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkIconView" id="attachments_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin">0</property>
<property name="selection_mode">multiple</property>
<property name="item_orientation">horizontal</property>
<property name="model">attachments_model</property>
<property name="spacing">6</property>
<signal name="item-activated" handler="on_attachments_view_activated" swapped="no"/>
<child>
<object class="GtkCellRendererPixbuf" id="icon"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="file_name">
<property name="xpad">6</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</interface>