[polari/wip/fmuellner/window-experiments: 17/30] mainWindow: Initialize sidebar visibility



commit 2d4b3a0595ba102100defa813358d2b933bfce65
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 14 17:54:51 2016 +0200

    mainWindow: Initialize sidebar visibility
    
    The code currently assumes that the window is created before accounts
    are initialized.

 src/mainWindow.js |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 295051b..530214f 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -159,13 +159,9 @@ const MainWindow = new Lang.Class({
             }));
 
         this._accountsMonitor = AccountsMonitor.getDefault();
-        this._accountsMonitor.connect('accounts-changed', Lang.bind(this,
-            function(am) {
-                let accounts = am.dupAccounts();
-                this._roomListRevealer.reveal_child = accounts.some(function(a) {
-                    return a.enabled;
-                });
-            }));
+        this._accountsMonitor.connect('accounts-changed',
+                                      Lang.bind(this, this._onAccountsChanged));
+        this._onAccountsChanged(this._accountsMonitor);
 
         this._roomManager = ChatroomManager.getDefault();
         this._roomManager.connect('active-changed',
@@ -233,6 +229,11 @@ const MainWindow = new Lang.Class({
                                  GLib.Variant.new('ai', this._currentSize));
     },
 
+    _onAccountsChanged: function(am) {
+        let accounts = am.dupAccounts();
+        this._roomListRevealer.reveal_child = accounts.some(a => a.enabled);
+    },
+
     _updateDecorations: function() {
         let layoutLeft = null;
         let layoutRight = null;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]