Commit 9c1d4c3f authored by Florian Müllner's avatar Florian Müllner
Browse files

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
parent 70f6be46
......@@ -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');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment