[polari/wip/fmuellner/3-24-1-candidates: 10/10] entryArea: Consider nickname changes when disconnected



commit 65415300923f10de976dacc535c86c7c3642777e
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Mar 23 23:12:06 2017 +0100

    entryArea: Consider nickname changes when disconnected
    
    Depending on whether the room is currently connected, we either use
    the self-contact's :alias property or the account's :nickname one
    for the nick button text. Either of those properties can change, but
    we currently only update the text in the former case. Start tracking
    changes to the :nickname property is well to make sure we properly
    update the button while disconnected.

 src/entryArea.js |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index 2ea8ccb..8c55bf3 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -228,6 +228,9 @@ const EntryArea = new Lang.Class({
         this._membersChangedId =
             this._room.connect('members-changed',
                                Lang.bind(this, this._updateCompletions));
+        this._nicknameChangedId =
+            this._room.account.connect('notify::nickname',
+                                       Lang.bind(this, this._updateNick));
         this._channelChangedId =
             this._room.connect('notify::channel',
                                Lang.bind(this, this._onChannelChanged));
@@ -446,6 +449,9 @@ const EntryArea = new Lang.Class({
         if (this._selfAliasChangedId)
             this._room.channel.connection.disconnect(this._selfAliasChangedId);
         this._selfAliasChangedId = 0;
+        if (this._nicknameChangedId)
+            this._room.account.disconnect(this._nicknameChangedId);
+        this._nicknameChangedId = 0;
         if (this._channelChangedId)
             this._room.disconnect(this._channelChangedId);
         this._channelChangedId = 0;


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