Allow ConversationEmail to manage its infobars indep. of ConversationMessage.

* src/client/conversation-viewer/conversation-email.vala: Move the
  draft_infobar wdiget from ConversationMessage, when the message is a
  draft add it to ConversationMessage's infobar box and show it.

* ui/conversation-email.ui: Move the draft_infobar definition from
  conversation-message.ui here.

* ui/conversation-message.ui: Wrap the remote messages infobar in an box
  so that ConversationEmail can easily append its own in the same location.
This commit is contained in:
Michael James Gratton 2016-04-21 16:07:08 +10:00
parent cfe68ef8c1
commit ad035f799c
4 changed files with 176 additions and 164 deletions

View file

@ -56,6 +56,9 @@ public class ConversationEmail : Gtk.Box {
[GtkChild]
private Gtk.MenuButton email_menubutton;
[GtkChild]
private Gtk.InfoBar draft_infobar;
[GtkChild]
private Gtk.Box sub_messages_box;
@ -102,17 +105,19 @@ public class ConversationEmail : Gtk.Box {
primary_message.web_view.link_selected.connect((link) => {
link_activated(link);
});
primary_message.draft_infobar.response.connect((infobar, response_id) => {
if (response_id == 1) { edit_draft(email); }
});
primary_message.summary_box.pack_start(action_box, false, false, 0);
if (is_draft) {
primary_message.draft_infobar.show();
}
email_menubutton.set_menu_model(build_message_menu(email));
email_menubutton.set_sensitive(false);
primary_message.infobar_box.pack_start(draft_infobar, false, false, 0);
if (is_draft) {
draft_infobar.show();
draft_infobar.response.connect((infobar, response_id) => {
if (response_id == 1) { edit_draft(email); }
});
}
// if (email.from != null && email.from.contains_normalized(current_account_information.email)) {
// // XXX set a RO property?
// get_style_context().add_class("sent");

View file

@ -64,7 +64,7 @@ public class ConversationMessage : Gtk.Box {
public Gtk.Box summary_box; // not yet supported: { get; private set; }
[GtkChild]
public Gtk.InfoBar draft_infobar; // not yet supported: { get; private set; }
public Gtk.Box infobar_box; // not yet supported: { get; private set; }
[GtkChild]
private Gtk.Image avatar_image;

View file

@ -163,6 +163,80 @@
</packing>
</child>
</object>
<object class="GtkInfoBar" id="draft_infobar">
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<property name="message_type">warning</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button3">
<property name="label" translatable="yes">Edit Draft</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Draft message</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">This message has not yet been sent.</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<action-widgets>
<action-widget response="1">button3</action-widget>
</action-widgets>
</object>
<object class="GtkBox" id="sub_messages_box">
<property name="visible">True</property>
<property name="can_focus">False</property>

View file

@ -412,66 +412,91 @@
</packing>
</child>
<child>
<object class="GtkInfoBar" id="remote_images_infobar">
<property name="app_paintable">True</property>
<object class="GtkBox" id="infobar_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="message_type">warning</property>
<property name="show_close_button">True</property>
<signal name="response" handler="on_remote_images_response" swapped="no"/>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkInfoBar" id="remote_images_infobar">
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Show Images</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label" translatable="yes">Always Show From Sender</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="non_homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="no_show_all">True</property>
<property name="message_type">warning</property>
<property name="show_close_button">True</property>
<signal name="response" handler="on_remote_images_response" swapped="no"/>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="label" translatable="yes">Remote images not shown</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Show Images</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label" translatable="yes">Always Show From Sender</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="non_homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Remote images not shown</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Only show remote images from senders you trust.</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
@ -479,118 +504,26 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Only show remote images from senders you trust.</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<action-widgets>
<action-widget response="1">button1</action-widget>
<action-widget response="2">button2</action-widget>
</action-widgets>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<action-widgets>
<action-widget response="1">button1</action-widget>
<action-widget response="2">button2</action-widget>
</action-widgets>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkInfoBar" id="draft_infobar">
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="message_type">warning</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button3">
<property name="label" translatable="yes">Edit Draft</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Draft message</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">This message has not yet been sent.</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<action-widgets>
<action-widget response="1">button3</action-widget>
</action-widgets>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
<placeholder/>
</child>
</object>
</child>