[polari/wip/fmuellner/window-experiments: 4/15] chatroomManager: Add forEachRoom()



commit 5ebed7c9acfa7e857e3b8e0bbe13bb1ece89e970
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 14 16:44:41 2016 +0200

    chatroomManager: Add forEachRoom()
    
    Both the room list in the sidebar and the stack in the main content
    area rely on the manager's ::room-added and ::room-removed signals
    to keep track of rooms. This relies on no room having been added
    before the signals were connected though, which won't be the case
    for windows opened later. So add a small forEachRoom() method that
    allows components to iterate over the list of added rooms so they
    can pick them up.

 src/chatroomManager.js |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/chatroomManager.js b/src/chatroomManager.js
index 62cabc1..dbc6109 100644
--- a/src/chatroomManager.js
+++ b/src/chatroomManager.js
@@ -486,6 +486,11 @@ const _ChatroomManager = new Lang.Class({
         this._app.active_window.active_room = room;
     },
 
+    forEachRoom: function(func) {
+        for (let room of this._rooms.values())
+            func(room);
+    },
+
     getRoomByName: function(name) {
         for (let room of this._rooms.values())
             if (rooms.channel_name == name)


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