[polari/wip/fmuellner/window-experiments: 2/6] roomList: Pick up list of existing rooms



commit f1c49e60ec5d089c61c4e48c9925f3c8bb4d1e01
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Jul 16 01:33:42 2016 +0200

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

 src/roomList.js |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index 9cf3b6f..24cf111 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -338,6 +338,12 @@ const RoomList = new Lang.Class({
         this._placeholders = new Map();
         this._roomRows = 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._accountsMonitor = AccountsMonitor.getDefault();
         let feature = Tp.AccountManager.get_feature_quark_core();
         let mon = this._accountsMonitor;
@@ -353,12 +359,6 @@ const RoomList = new Lang.Class({
         this._accountsMonitor.connect('account-removed',
                                       Lang.bind(this, this._accountRemoved));
 
-        this._roomManager = ChatroomManager.getDefault();
-        this._roomManager.connect('room-added',
-                                  Lang.bind(this, this._roomAdded));
-        this._roomManager.connect('room-removed',
-                                  Lang.bind(this, this._roomRemoved));
-
         let action = Gio.Application.get_default().lookup_action('leave-room');
         action.connect('activate', Lang.bind(this, this._onLeaveActivated));
     },
@@ -374,6 +374,10 @@ const RoomList = new Lang.Class({
         am.connect('account-disabled', (am, account) => {
                 this._updatePlaceholderVisibility(account);
             });
+
+       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]