[polari/wip/fmuellner/misc-cleanups: 3/12] accountsMonitor: Change dupAccounts() to a getter
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/misc-cleanups: 3/12] accountsMonitor: Change dupAccounts() to a getter
- Date: Sun, 7 Aug 2016 01:50:58 +0000 (UTC)
commit 1078b7a37c761325c6752a25fef96d8b59706c51
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Aug 5 22:23:51 2016 +0200
accountsMonitor: Change dupAccounts() to a getter
Other modules have no business in modifying the monitor's internal
account map, which is why we expose a method to get a copied list
of accounts rather than the raw property. A getter function works
just the same way, but reads just a tad bit nicer ...
https://bugzilla.gnome.org/show_bug.cgi?id=769582
src/accountsMonitor.js | 2 +-
src/application.js | 2 +-
src/connections.js | 2 +-
src/joinDialog.js | 2 +-
src/mainWindow.js | 2 +-
src/roomList.js | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index 0194be5..71ecb9c 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -33,7 +33,7 @@ const AccountsMonitor = new Lang.Class({
Lang.bind(this, this._onPrepared));
},
- dupAccounts: function() {
+ get accounts() {
return [...this._accounts.values()];
},
diff --git a/src/application.js b/src/application.js
index a99ee2f..6254fbc 100644
--- a/src/application.js
+++ b/src/application.js
@@ -177,7 +177,7 @@ const Application = new Lang.Class({
_openURIs: function(uris, time) {
let map = {};
- this._accountsMonitor.dupAccounts().forEach(function(a) {
+ this._accountsMonitor.accounts.forEach(function(a) {
if (!a.enabled)
return;
diff --git a/src/connections.js b/src/connections.js
index 577f54a..478ed2c 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -123,7 +123,7 @@ const ConnectionsList = new Lang.Class({
_networksChanged: function() {
this._list.foreach(function(w) { w.destroy(); });
- let accounts = this._accountsMonitor.dupAccounts();
+ let accounts = this._accountsMonitor.accounts;
let usedNetworks = accounts.filter(Lang.bind(this, function(a) {
return this._networksManager.getAccountIsPredefined(a);
})).map(function(a) {
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 9194786..6e23c2a 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -61,7 +61,7 @@ const JoinDialog = new Lang.Class({
this._roomManager = ChatroomManager.getDefault();
this._accounts = {};
- this._accountsMonitor.dupAccounts().forEach(Lang.bind(this,
+ this._accountsMonitor.accounts.forEach(Lang.bind(this,
function(a) {
if (!a.enabled)
return;
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 789e99c..bd9a664 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -156,7 +156,7 @@ const MainWindow = new Lang.Class({
this._accountsMonitor = AccountsMonitor.getDefault();
this._accountsMonitor.connect('accounts-changed', Lang.bind(this,
function(am) {
- let accounts = am.dupAccounts();
+ let accounts = am.accounts;
this._roomListRevealer.reveal_child = accounts.some(function(a) {
return a.enabled;
});
diff --git a/src/roomList.js b/src/roomList.js
index c8aec85..5fdcf1e 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -356,7 +356,7 @@ const RoomList = new Lang.Class({
this._accountsMonitor = AccountsMonitor.getDefault();
this._accountsMonitor.connect('account-manager-prepared', Lang.bind(this,
function(mon, am) {
- let accounts = this._accountsMonitor.dupAccounts();
+ let accounts = this._accountsMonitor.accounts;
for (let i = 0; i < accounts.length; i++)
this._accountAdded(mon, accounts[i]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]