[polari/wip/fmuellner/window-experiments: 22/24] roomStack: Pick up list of existing rooms



commit 2ca06b369b52546747facea7f161ecb3aef3c6e7
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 15 00:12:18 2016 +0200

    roomStack: Pick up list of existing rooms
    
    We currently only monitor rooms neing added or removed, but don't
    pick up rooms that already existed when the room stack is constructed.

 src/roomStack.js |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/roomStack.js b/src/roomStack.js
index 6ede912..2321d82 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -26,13 +26,6 @@ const RoomStack = new Lang.Class({
         this._sizeGroup = new Gtk.SizeGroup({ mode: Gtk.SizeGroupMode.VERTICAL });
         this._rooms = new Map();
 
-        this._roomManager = ChatroomManager.getDefault();
-
-        this._roomManager.connect('room-added',
-                                  Lang.bind(this, this._roomAdded));
-        this._roomManager.connect('room-removed',
-                                  Lang.bind(this, this._roomRemoved));
-
         this.add_named(new ChatPlaceholder(this._sizeGroup), 'placeholder');
 
         this._entryAreaHeight = 0;
@@ -41,6 +34,17 @@ const RoomStack = new Lang.Class({
                 this._entryAreaHeight = rect.height - 1;
                 this.notify('entry-area-height');
             }));
+
+        this._roomManager = ChatroomManager.getDefault();
+
+        this._roomManager.connect('room-added',
+                                  Lang.bind(this, this._roomAdded));
+        this._roomManager.connect('room-removed',
+                                  Lang.bind(this, this._roomRemoved));
+
+        this._roomManager.forEachRoom(room => {
+            this._roomAdded(this._roomManager, room);
+        });
     },
 
     vfunc_realize: function() {


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