Clean up attachment save code

Create new Application.AttachmentManager class and move code for saving
attachments there from both Application.Controller and MainWindow since
aside from needing the latter for dialogs it is independent of both.

Create new Components.AttachmentPane widget for diplaying attachents
for an email in the ConversationViewer.

Update ConversationEmail and ConversationMessage to use these two new
classes directly, rather than implementing save management itself or
requiring the MainWindow to wire up signals on these classes.
This commit is contained in:
Michael Gratton 2019-10-29 12:15:47 +11:00 committed by Michael James Gratton
parent bcce3a3a83
commit de6ef699de
16 changed files with 1137 additions and 636 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.14"/>
<template class="ConversationEmail" parent="GtkBox">
@ -109,122 +109,6 @@
</packing>
</child>
</object>
<object class="GtkGrid" id="attachments">
<property name="name">box</property>
<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="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkFlowBox" id="attachments_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
<property name="homogeneous">True</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<property name="max_children_per_line">4</property>
<property name="selection_mode">multiple</property>
<property name="activate_on_single_click">False</property>
<signal name="child-activated" handler="on_attachments_child_activated" swapped="no"/>
<signal name="selected-children-changed" handler="on_attachments_selected_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkActionBar" id="attachments_actions">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="background"/>
</style>
<child>
<object class="GtkButton" id="open_attachments">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Open selected attachments</property>
<property name="action_name">eml.open_attachments</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">document-open-symbolic</property>
</object>
</child>
</object>
<packing>
</packing>
</child>
<child>
<object class="GtkButton" id="save_attachments">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Save selected attachments</property>
<property name="action_name">eml.save_attachments</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">document-save-symbolic</property>
</object>
</child>
</object>
<packing>
</packing>
</child>
<child>
<object class="GtkButton" id="select_all_attachments">
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Select all attachments</property>
<property name="action_name">eml.select_all_attachments</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">edit-select-all-symbolic</property>
</object>
</child>
</object>
<packing>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<style>
<class name="view"/>
</style>
</object>
<object class="GtkListStore" id="attachments_model">
<columns>
<!-- column-name icon -->
<column type="GdkPixbuf"/>
<!-- column-name label -->
<column type="gchararray"/>
<!-- column-name attachment_info -->
<column type="GObject"/>
</columns>
</object>
<object class="GtkInfoBar" id="draft_infobar">
<property name="app_paintable">True</property>
<property name="can_focus">False</property>