[polari/wip/fmuellner/misc-cleanups: 3/8] accountsMonitor: Minor cleanup
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/misc-cleanups: 3/8] accountsMonitor: Minor cleanup
- Date: Mon, 8 Aug 2016 09:48:57 +0000 (UTC)
commit 57650db2f41ac1495455e4a79cb07b37605e537e
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Aug 6 03:20:06 2016 +0200
accountsMonitor: Minor cleanup
Use arrow notation to make the shutdown handling code more concise.
https://bugzilla.gnome.org/show_bug.cgi?id=769582
src/accountsMonitor.js | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index 247250a..b290b0c 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -79,20 +79,16 @@ const AccountsMonitor = new Lang.Class({
},
_onPrepareShutdown: function() {
- for (let account of this._accounts.values()) {
- let presence = Tp.ConnectionPresenceType.OFFLINE;
- if (account.requested_presence_type == presence)
- continue;
-
+ let presence = Tp.ConnectionPresenceType.OFFLINE;
+ this.accounts.filter(a => a.requested_presence != presence).forEach(a => {
this._app.hold();
- account.request_presence_async(presence, 'offline', '',
- Lang.bind(this, function(account, result) {
- try {
- account.request_presence_finish(result);
- } catch(e) { }
- this._app.release();
- }));
- }
+ a.request_presence_async(presence, 'offline', '', (a, res) => {
+ try {
+ a.request_presence_finish(result);
+ } catch(e) { }
+ this._app.release();
+ });
+ });
},
_shouldMonitorAccount: function(account) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]