[polari/wip/fmuellner/window-experiments: 25/30] roomList: Add accounts immediately if accountsManager has been prepared
- From: Florian MĂźllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/window-experiments: 25/30] roomList: Add accounts immediately if accountsManager has been prepared
- Date: Mon, 18 Jul 2016 12:46:56 +0000 (UTC)
commit ef547b79987925cd5874ae35878d34007c85ed0c
Author: Florian MĂźllner <fmuellner gnome org>
Date: Thu Jul 14 16:44:41 2016 +0200
roomList: Add accounts immediately if accountsManager has been prepared
src/roomList.js | 37 ++++++++++++++++++++++---------------
1 files changed, 22 insertions(+), 15 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index d621904..51172d5 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -339,21 +339,15 @@ const RoomList = new Lang.Class({
this._roomRows = {};
this._accountsMonitor = AccountsMonitor.getDefault();
- this._accountsMonitor.connect('account-manager-prepared', Lang.bind(this,
- function(mon, am) {
- let accounts = this._accountsMonitor.dupAccounts();
- for (let i = 0; i < accounts.length; i++)
- this._accountAdded(mon, accounts[i]);
-
- am.connect('account-enabled', Lang.bind(this,
- function(am, account) {
- this._updatePlaceholderVisibility(account);
- }));
- am.connect('account-disabled', Lang.bind(this,
- function(am, account) {
- this._updatePlaceholderVisibility(account);
- }));
- }));
+ let feature = Tp.AccountManager.get_feature_quark_core();
+ let mon = this._accountsMonitor;
+
+ if (mon.accountManager.is_prepared(feature))
+ this._onAccountManagerPrepared(mon, mon.accountManager);
+ else
+ mon.connect('account-manager-prepared',
+ Lang.bind(this, this._onAccountManagerPrepared));
+
this._accountsMonitor.connect('account-added',
Lang.bind(this, this._accountAdded));
this._accountsMonitor.connect('account-removed',
@@ -369,6 +363,19 @@ const RoomList = new Lang.Class({
action.connect('activate', Lang.bind(this, this._onLeaveActivated));
},
+ _onAccountManagerPrepared: function(mon, am) {
+ let accounts = this._accountsMonitor.dupAccounts();
+ for (let i = 0; i < accounts.length; i++)
+ this._accountAdded(mon, accounts[i]);
+
+ am.connect('account-enabled', (am, account) => {
+ this._updatePlaceholderVisibility(account);
+ });
+ am.connect('account-disabled', (am, account) => {
+ this._updatePlaceholderVisibility(account);
+ });
+ },
+
vfunc_realize: function() {
this.parent();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]