[polari/wip/fmuellner/room-list: 2/2] serverRoomManager: Handle already joined rooms



commit 69d60a92ffc3ed6708a7e3515568fa8a9a77abdc
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Nov 11 12:09:35 2016 +0100

    serverRoomManager: Handle already joined rooms

 src/serverRoomManager.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index 3ed8380..236b94c 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;
 
 let _singleton = null;
@@ -128,7 +129,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() {
@@ -216,6 +217,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);
@@ -223,7 +227,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]