Define message address popover activation handlers via the UI file.

This commit is contained in:
Michael James Gratton 2016-09-13 15:32:45 +10:00
parent d217cb868f
commit e044b27471
2 changed files with 26 additions and 18 deletions

View file

@ -650,25 +650,7 @@ public class ConversationMessage : Gtk.Grid {
address_box.add(child);
}
address_box.child_activated.connect((box, child) => {
AddressFlowBoxChild address_child = child as AddressFlowBoxChild;
if (address_child != null) {
string address = address_child.address.address;
Menu model = new Menu();
model.append_section(
null, set_action_param_string(
this.context_menu_email, "mailto:" + address
));
model.append_section(
null, set_action_param_string(
this.context_menu_contact, address
));
Gtk.Popover popover =
new Gtk.Popover.from_model(child, model);
popover.set_position(Gtk.PositionType.BOTTOM);
popover.show();
}
});
}
private string format_sender_preview(Geary.RFC822.MailboxAddresses? addresses) {
@ -1206,6 +1188,28 @@ public class ConversationMessage : Gtk.Grid {
revealer.set_transition_type(transition);
}
[GtkCallback]
private void on_address_box_child_activated(Gtk.FlowBox box,
Gtk.FlowBoxChild child) {
AddressFlowBoxChild address_child = child as AddressFlowBoxChild;
if (address_child != null) {
string address = address_child.address.address;
Menu model = new Menu();
model.append_section(
null, set_action_param_string(
this.context_menu_email, "mailto:" + address
));
model.append_section(
null, set_action_param_string(
this.context_menu_contact, address
));
Gtk.Popover popover =
new Gtk.Popover.from_model(child, model);
popover.set_position(Gtk.PositionType.BOTTOM);
popover.show();
}
}
private static void on_show_quote_clicked(WebKit.DOM.Element element,
WebKit.DOM.Event event) {
try {

View file

@ -162,6 +162,7 @@
<property name="min_children_per_line">1</property>
<property name="max_children_per_line">4</property>
<property name="selection_mode">none</property>
<signal name="child-activated" handler="on_address_box_child_activated" swapped="no"/>
<style>
<class name="geary-header-value"/>
</style>
@ -242,6 +243,7 @@
<property name="min_children_per_line">2</property>
<property name="max_children_per_line">4</property>
<property name="selection_mode">none</property>
<signal name="child-activated" handler="on_address_box_child_activated" swapped="no"/>
<style>
<class name="geary-header-value"/>
</style>
@ -286,6 +288,7 @@
<property name="min_children_per_line">2</property>
<property name="max_children_per_line">4</property>
<property name="selection_mode">none</property>
<signal name="child-activated" handler="on_address_box_child_activated" swapped="no"/>
<style>
<class name="geary-header-value"/>
</style>
@ -330,6 +333,7 @@
<property name="min_children_per_line">2</property>
<property name="max_children_per_line">4</property>
<property name="selection_mode">none</property>
<signal name="child-activated" handler="on_address_box_child_activated" swapped="no"/>
<style>
<class name="geary-header-value"/>
</style>