[geary] Update conversation address labels to indicate interactivity. Bug 765516.



commit 65e0df7aca9b0fa1fc880e7b95f304e43277525f
Author: Michael James Gratton <mike vee net>
Date:   Sat Oct 8 17:32:40 2016 +1100

    Update conversation address labels to indicate interactivity. Bug 765516.
    
    * src/client/conversation-viewer/conversation-message.vala
      (AddressFlowBoxChild::AddressFlowBoxChild): Check for enter and leave
      events, update the prelight state of the flowbox child accordingly.
      (ConversationMessage::on_address_box_child_activated): Update the
      active state of the flowbox child appropriately when the popover
      active.
    
    * ui/geary.css: Style the active and hover states of the flowboxes.

 .../conversation-viewer/conversation-message.vala  |   28 +++++++++++++++++++-
 ui/geary.css                                       |   12 ++++++++
 2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 66df50b..d15a33b 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -80,7 +80,18 @@ public class ConversationMessage : Gtk.Grid {
                 primary.set_text(address.address);
             }
 
-            add(address_parts);
+            // Update prelight state when mouse-overed.
+            Gtk.EventBox events = new Gtk.EventBox();
+            events.add_events(
+                Gdk.EventMask.ENTER_NOTIFY_MASK |
+                Gdk.EventMask.LEAVE_NOTIFY_MASK
+            );
+            events.set_visible_window(false);
+            events.enter_notify_event.connect(on_prelight_in_event);
+            events.leave_notify_event.connect(on_prelight_out_event);
+            events.add(address_parts);
+
+            add(events);
             set_halign(Gtk.Align.START);
             show_all();
         }
@@ -99,6 +110,16 @@ public class ConversationMessage : Gtk.Grid {
             get_style_context().remove_class(MATCH_CLASS);
         }
 
+        private bool on_prelight_in_event(Gdk.Event event) {
+            set_state_flags(Gtk.StateFlags.PRELIGHT, false);
+            return Gdk.EVENT_STOP;
+        }
+
+        private bool on_prelight_out_event(Gdk.Event event) {
+            unset_state_flags(Gtk.StateFlags.PRELIGHT);
+            return Gdk.EVENT_STOP;
+        }
+
     }
 
     // Internal class to associate inline image buffers (replaced by
@@ -1253,6 +1274,8 @@ public class ConversationMessage : Gtk.Grid {
                                                 Gtk.FlowBoxChild child) {
         AddressFlowBoxChild address_child = child as AddressFlowBoxChild;
         if (address_child != null) {
+            address_child.set_state_flags(Gtk.StateFlags.ACTIVE, false);
+
             string address = address_child.address.address;
             Menu model = new Menu();
             model.append_section(
@@ -1266,6 +1289,9 @@ public class ConversationMessage : Gtk.Grid {
             Gtk.Popover popover =
             new Gtk.Popover.from_model(child, model);
             popover.set_position(Gtk.PositionType.BOTTOM);
+            popover.closed.connect(() => {
+                    address_child.unset_state_flags(Gtk.StateFlags.ACTIVE);
+                });
             popover.show();
         }
     }
diff --git a/ui/geary.css b/ui/geary.css
index 748ccd7..b6ae1c4 100644
--- a/ui/geary.css
+++ b/ui/geary.css
@@ -122,6 +122,18 @@ row.geary-folder-popover-list-row > label {
   font-weight: bold;
 }
 
+.geary-header-value flowboxchild:active {
+  background: mix(@theme_base_color, @theme_bg_color, 0.5);
+}
+
+.geary-header-value flowboxchild:hover {
+  background: @theme_base_color;
+}
+
+.geary-header-value flowboxchild label:not(.geary-primary) {
+  margin-left: 6px;
+}
+
 .geary-submessages .geary-message {
   background-image: linear-gradient(rgba(0,0,0,0.2), @bg_color 6px);
 }


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