[polari/wip/kunaljain/bug-fixes: 55/55] chatView: change color of status header on hover



commit 48d3e385c06206fa0b4c2d93ee3d5d6904493623
Author: Kunaal Jain <kunaalus gmail com>
Date:   Wed Dec 23 01:20:39 2015 +0530

    chatView: change color of status header on hover
    
    Highlight the compressed status messages on hover
    by changing the color. The change helps indicating,
    that on hover the status message is clickable.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759032

 src/chatView.js |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index b4d3b14..bd27e32 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -320,7 +320,7 @@ const ChatView = new Lang.Class({
         context.save();
         context.add_class('dim-label');
         context.set_state(Gtk.StateFlags.NORMAL);
-        let dimColor = context.get_color(context.get_state());
+        this._dimColor = context.get_color(context.get_state());
         context.restore();
 
         context.save();
@@ -342,15 +342,21 @@ const ChatView = new Lang.Class({
         if (this._activeNickColor.equal(this._inactiveNickColor))
             this._inactiveNickColor.alpha = 0.5;
 
+        context.save();
+        context.add_class('view');
+        context.set_state(Gtk.StateFlags.NORMAL);
+        this._highlightColor = context.get_color(context.get_state());
+        context.restore();
+
         let buffer = this._view.get_buffer();
         let tagTable = buffer.get_tag_table();
         let tags = [
           { name: 'status',
-            foreground_rgba: dimColor },
+            foreground_rgba: this._dimColor },
           { name: 'timestamp',
-            foreground_rgba: dimColor },
+            foreground_rgba: this._dimColor },
           { name: 'action',
-            foreground_rgba: dimColor },
+            foreground_rgba: this._dimColor },
           { name: 'url',
             foreground_rgba: this._linkColor }
         ];
@@ -402,6 +408,10 @@ const ChatView = new Lang.Class({
         this._view.connect('key-press-event', Lang.bind(this, this._onKeyPress));
         this._view.connect('motion-notify-event',
                            Lang.bind(this, this._handleButtonTagsHover));
+        this._view.connect('leave-notify-event',
+                           Lang.bind(this, this._handleButtonTagsHover));
+        this._view.connect('enter-notify-event',
+                           Lang.bind(this, this._handleButtonTagsHover));
     },
 
     _onDestroy: function() {
@@ -864,6 +874,14 @@ const ChatView = new Lang.Class({
                     groupTag.invisible = !groupTag.invisible;
                 });
 
+            headerTag.connect('notify::hover', Lang.bind(this,
+            function() {
+                if (headerTag.hover)
+                    headerTag.foreground_rgba = this._highlightColor;
+                else
+                    headerTag.foreground_rgba = this._dimColor;
+            }));
+
             this._ensureNewLine();
             headerMark = buffer.create_mark('idle-status-start', buffer.get_end_iter(), true);
         } else {


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