[polari] chatroomManager: Change the active room from the handler, not the observer



commit 8d704d6a6d858af4efd81a85a88d09f89c149ba3
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 26 16:49:05 2013 +0200

    chatroomManager: Change the active room from the handler, not the observer
    
    A channel might just appear out of nowhere, so taking focus away from the
    user is rude. The change will also make us handle re-activating an existing
    channel correctly.

 src/chatroomManager.js |    9 +++------
 src/roomList.js        |    2 --
 2 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/src/chatroomManager.js b/src/chatroomManager.js
index 50fcf56..25f6321 100644
--- a/src/chatroomManager.js
+++ b/src/chatroomManager.js
@@ -118,12 +118,9 @@ const _ChatroomManager = new Lang.Class({
 
         this._processRequest(context, connection, channels, Lang.bind(this,
             function(channel) {
-                let room = this._rooms[channel.get_object_path()];
-                if (room)
-                    return; // already added from observer
-
-                this._ensureRoomForChannel(channel);
-                channel.join_async('', null);
+                let room = this._ensureRoomForChannel(channel);
+                //channel.join_async('', null);
+                this.setActiveRoom(room);
             }));
     },
 
diff --git a/src/roomList.js b/src/roomList.js
index 93ff0f0..645745b 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -150,8 +150,6 @@ const RoomList = new Lang.Class({
     _roomAdded: function(roomManager, room) {
         let row = new RoomRow(room);
         this.widget.add(row.widget);
-
-        this._roomManager.setActiveRoom(room);
     },
 
     _roomRemoved: function(roomManager, room) {


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