[polari] chatroomManager: Remove rooms whose account has been disabled
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] chatroomManager: Remove rooms whose account has been disabled
- Date: Fri, 21 Feb 2014 18:25:55 +0000 (UTC)
commit 0827a395dc24d22e3f6f536a16e9ff8ff049e6d7
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Feb 21 19:09:59 2014 +0100
chatroomManager: Remove rooms whose account has been disabled
Since rooms are no longer tied to their connection/channel, they are
only removed when the user explicitly requests it. This is clearly
the right behavior for "random" connection losses, but feels odd when
the room is disconnected because its account has been disabled - not
least as it is very much expected to be the result of user interaction.
Rooms with inactive accounts will also not be restored on startup,
so removing them when their account is disabled should also restore
consistency of the room list over restarts.
src/chatroomManager.js | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/chatroomManager.js b/src/chatroomManager.js
index 9239338..40ec4ea 100644
--- a/src/chatroomManager.js
+++ b/src/chatroomManager.js
@@ -79,6 +79,8 @@ const _ChatroomManager = new Lang.Class({
am.connect('account-enabled',
Lang.bind(this, this._restoreSavedChannels));
+ am.connect('account-disabled',
+ Lang.bind(this, this._onAccountDisabled));
this._restoreSavedChannels();
this._networkMonitor.connect('notify::network-available', Lang.bind(this,
@@ -88,6 +90,14 @@ const _ChatroomManager = new Lang.Class({
}));
},
+ _onAccountDisabled: function(am, account) {
+ for (let id in this._rooms) {
+ let room = this._rooms[id];
+ if (!room.account.enabled)
+ this._removeRoom(room);
+ }
+ },
+
_restoreSavedChannels: function() {
let settings = new Gio.Settings({ schema: 'org.gnome.polari' });
let savedChannels = settings.get_value('saved-channel-list').deep_unpack();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]