[geary/wip/765516-gtk-widget-conversation-viewer: 175/187] Define message address popover activation handlers via the UI file.



commit 99baeba2a1c2859312d8ca424e6b2791c49d0f78
Author: Michael James Gratton <mike vee net>
Date:   Tue Sep 13 15:32:45 2016 +1000

    Define message address popover activation handlers via the UI file.

 .../conversation-viewer/conversation-message.vala  |   40 +++++++++++---------
 ui/conversation-message.ui                         |    4 ++
 2 files changed, 26 insertions(+), 18 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 66591e5..7e18396 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -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 {
diff --git a/ui/conversation-message.ui b/ui/conversation-message.ui
index 5a4de96..7f4f1f6 100644
--- a/ui/conversation-message.ui
+++ b/ui/conversation-message.ui
@@ -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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]