[polari/wip/fmuellner/room-list: 20/23] serverRoomManager: Handle already joined rooms
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/room-list: 20/23] serverRoomManager: Handle already joined rooms
- Date: Wed, 15 Feb 2017 22:17:31 +0000 (UTC)
commit 9c1d4c3fe6a8e8ec93e71493d8990fdcdf2ebd53
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Nov 11 12:09:35 2016 +0100
serverRoomManager: Handle already joined rooms
It doesn't make sense to allow users to select already joined rooms,
or to leave rooms by unchecking them. On the other hand, hiding rooms
that clearly exist would be weird as well, so represent joined rooms
as checked but insensitive.
https://bugzilla.gnome.org/show_bug.cgi?id=763200
src/serverRoomManager.js | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index 1d0cfed..9420d8b 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -6,6 +6,7 @@ const Tp = imports.gi.TelepathyGLib;
const AccountsMonitor = imports.accountsMonitor;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
+const RoomManager = imports.roomManager;
const Signals = imports.signals;
const LIST_CHUNK_SIZE = 100;
@@ -133,7 +134,7 @@ const ServerRoomList = new Lang.Class({
},
get can_join() {
- return this._list.get_children().some(r => r.checked);
+ return this._list.get_children().some(r => r.sensitive && r.checked);
},
get loading() {
@@ -231,6 +232,9 @@ const ServerRoomRow = new Lang.Class({
this.parent(params);
+ let room = RoomManager.getDefault().lookupRoomByName(this._info.get_name());
+ this.sensitive = !room;
+
let name = this._info.get_name();
if (name[0] == '#')
name = name.substr(1, name.length);
@@ -238,7 +242,7 @@ const ServerRoomRow = new Lang.Class({
let box = new Gtk.Box({ spacing: 12, margin: 12 });
this.add(box);
- this._checkbox = new Gtk.CheckButton();
+ this._checkbox = new Gtk.CheckButton({ active: !this.sensitive });
this._checkbox.connect('toggled', Lang.bind(this,
function() {
this.notify('checked');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]