[polari] userList: Only create user list widget when necessary



commit 5d79defc4f9d0f8639bbb2f3bf7d363346085a96
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Sep 21 00:01:20 2014 +0200

    userList: Only create user list widget when necessary
    
    We currently update the user list every time the active room changes.
    However the user may never actually pop up the list, in which case we
    are keeping a bunch of widgets around that are not shown at all - avoid
    unnecessary work by only creating the list when we are about to show it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732290

 src/userList.js |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/userList.js b/src/userList.js
index 27603b8..1860f33 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -19,6 +19,7 @@ const UserListPopover = new Lang.Class({
         }));
         this.widget.connect('map', Lang.bind(this, function() {
             this._revealer.transition_duration = 0;
+            this._ensureUserList();
         }));
         this._revealer.connect('notify::child-revealed', Lang.bind(this, function() {
             this._revealer.transition_duration = 250;
@@ -71,7 +72,13 @@ const UserListPopover = new Lang.Class({
         if (this._userList)
             this._userList.widget.destroy();
         this._userList = null;
+    },
+
+    _ensureUserList: function() {
+        if (this._userList)
+            return;
 
+        let room = this._roomManager.getActiveRoom();
         if (!room || room.type != Tp.HandleType.ROOM)
             return;
 


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