[polari/wip/raresv/userTracker] userTracker part 5



commit 2c6b2f02ccc799b085c89c1dc00295c07a257055
Author: raresv <rares visalom gmail com>
Date:   Tue Jun 28 23:51:39 2016 +0300

    userTracker part 5

 src/chatView.js |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 1fbbcd7..ef42d00 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -380,14 +380,6 @@ const ChatView = new Lang.Class({
         });
     },
 
-    _foreachNickTag: function(func) {
-        let tagTable = this._view.get_buffer().get_tag_table();
-        tagTable.foreach(function(tag) {
-            if (tag._contacts)
-                func(tag);
-        });
-    },
-
     _onStyleUpdated: function() {
         let context = this.get_style_context();
         context.save();
@@ -771,10 +763,7 @@ const ChatView = new Lang.Class({
         if (!nickTag)
             return;
 
-        if (status == Tp.ConnectionPresenceType.AVAILABLE)
-            nickTag.foreground_rgba = this._activeNickColor;
-        else
-            nickTag.foreground_rgba = this._inactiveNickColor;
+        this._updateNickTag(nickTag, status);
     },
 
     _onChannelChanged: function() {
@@ -1215,11 +1204,18 @@ const ChatView = new Lang.Class({
         let nickTagName = this._getNickTagName(nickName);
 
         let tag = new Gtk.TextTag({ name: nickTagName });
-        tag.foreground_rgba = this._inactiveNickColor
+        this._updateNickTag(tag, this._userTracker.getNickStatus(nickName));
 
         return tag;
     },
 
+    _updateNickTag: function(tag, status) {
+        if (status == Tp.ConnectionPresenceType.AVAILABLE)
+            tag.foreground_rgba = this._activeNickColor;
+        else
+            tag.foreground_rgba = this._inactiveNickColor;
+    },
+
     _createUrlTag: function(url) {
         if (url.indexOf(':') == -1)
             url = 'http://' + url;


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