[polari] cleanup: Simplify signal disconnections
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] cleanup: Simplify signal disconnections
- Date: Thu, 4 Apr 2019 18:35:57 +0000 (UTC)
commit 2c4d6647b911625f26f5094e160fb2b581f07e28
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Apr 4 02:26:03 2019 +0200
cleanup: Simplify signal disconnections
Use forEach instead of explicit loops for a more concise and
idiomatic style.
https://gitlab.gnome.org/GNOME/polari/merge_requests/109
src/chatView.js | 9 +++------
src/userList.js | 3 +--
2 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 36855b3..e2d661d 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -530,12 +530,10 @@ var ChatView = GObject.registerClass({
}
_onDestroy() {
- for (let i = 0; i < this._channelSignals.length; i++)
- this._channel.disconnect(this._channelSignals[i]);
+ this._channelSignals.forEach(id => this._channel.disconnect(id));
this._channelSignals = [];
- for (let i = 0; i < this._roomSignals.length; i++)
- this._room.disconnect(this._roomSignals[i]);
+ this._roomSignals.forEach(id => this._room.disconnect(id));
this._roomSignals = [];
if (this._roomFocusChangedId)
@@ -935,8 +933,7 @@ var ChatView = GObject.registerClass({
this._removePendingMark(id);
if (this._channel) {
- for (let i = 0; i < this._channelSignals.length; i++)
- this._channel.disconnect(this._channelSignals[i]);
+ this._channelSignals.forEach(id => this._channel.disconnect(id));
this._channelSignals = [];
}
diff --git a/src/userList.js b/src/userList.js
index 55908b5..bcb0e47 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -646,8 +646,7 @@ class UserList extends Gtk.ScrolledWindow {
}
_onDestroy() {
- for (let i = 0; i < this._roomSignals.length; i++)
- this._room.disconnect(this._roomSignals[i]);
+ this._roomSignals.forEach(id => this._room.disconnect(id));
this._roomSignals = [];
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]