[polari/wip/fmuellner/nickserv: 10/29] mainWindow: Focus the first added room
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/nickserv: 10/29] mainWindow: Focus the first added room
- Date: Thu, 11 Aug 2016 08:43:09 +0000 (UTC)
commit d9483b18b92da64978211f33d239e93ef4dc4431
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Aug 2 01:18:03 2016 +0200
mainWindow: Focus the first added room
Now that the active room is a property of the window, it makes sense
to move initialization there as well rather than leaving it in the
chatroom manager.
https://bugzilla.gnome.org/show_bug.cgi?id=769655
src/chatroomManager.js | 12 +++---------
src/mainWindow.js | 11 +++++++++++
2 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/chatroomManager.js b/src/chatroomManager.js
index c59c0cb..c0151a5 100644
--- a/src/chatroomManager.js
+++ b/src/chatroomManager.js
@@ -413,8 +413,6 @@ const _ChatroomManager = new Lang.Class({
}
let room = this._ensureRoomForChannel(channel);
- if (this.roomCount == 1)
- this._setActiveRoom(room);
}));
},
@@ -434,11 +432,10 @@ const _ChatroomManager = new Lang.Class({
let room = this._ensureRoomForChannel(channel);
//channel.join_async('', null);
- if (present || this.roomCount == 1)
- this._setActiveRoom(room);
-
- if (present)
+ if (present) {
this._app.activate();
+ this._setActiveRoom(room);
+ }
}));
},
@@ -448,9 +445,6 @@ const _ChatroomManager = new Lang.Class({
this._rooms[room.id] = room;
this.emit('room-added', room);
-
- if (this.roomCount == 1)
- this._setActiveRoom(room);
},
_removeRoom: function(room) {
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 1bbf78c..d396cb0 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -8,6 +8,7 @@ const Tp = imports.gi.TelepathyGLib;
const AccountsMonitor = imports.accountsMonitor;
const AppNotifications = imports.appNotifications;
+const ChatroomManager = imports.chatroomManager;
const JoinDialog = imports.joinDialog;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
@@ -165,6 +166,10 @@ const MainWindow = new Lang.Class({
Lang.bind(this, this._onAccountsChanged));
this._onAccountsChanged(this._accountsMonitor);
+ this._roomManager = ChatroomManager.getDefault();
+ this._roomManager.connect('room-added',
+ Lang.bind(this, this._onRoomAdded));
+
this._updateUserListLabel();
this._userListAction = app.lookup_action('user-list');
@@ -306,6 +311,12 @@ const MainWindow = new Lang.Class({
);
},
+ _onRoomAdded: function(mgr, room) {
+ if (this.active_room)
+ return;
+ this.active_room = room;
+ },
+
showJoinRoomDialog: function() {
let dialog = new JoinDialog.JoinDialog({ transient_for: this });
dialog.show();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]