Skip to content

Commit b2a7d65

Browse files
committed
cleanup: Connect to signals with non-array arguments when possible
1 parent 6bfd7e4 commit b2a7d65

File tree

6 files changed

+23
-34
lines changed

6 files changed

+23
-34
lines changed

appIconIndicators.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,11 @@ var RunningIndicatorDots = class DashToDock_RunningIndicatorDots extends Running
317317
'running-indicator-dominant-color'];
318318

319319
keys.forEach(function(key) {
320-
this._signalsHandler.add([
320+
this._signalsHandler.add(
321321
Docking.DockManager.settings,
322322
'changed::' + key,
323323
this.update.bind(this)
324-
]);
324+
);
325325
}, this);
326326

327327
// Apply glossy background

appIcons.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,10 @@ class MyAppIcon extends Dash.DashIcon {
111111
if (Docking.DockManager.settings.get_boolean('isolate-monitors') &&
112112
Main.layoutManager.monitors.length > 1) {
113113
this._signalsHandler.removeWithLabel('isolate-monitors');
114-
this._signalsHandler.addWithLabel('isolate-monitors', [
114+
this._signalsHandler.addWithLabel('isolate-monitors',
115115
global.display,
116116
'window-entered-monitor',
117-
this._onWindowEntered.bind(this)
118-
]);
117+
this._onWindowEntered.bind(this));
119118
}
120119

121120
this._progressOverlayArea = null;
@@ -126,19 +125,19 @@ class MyAppIcon extends Dash.DashIcon {
126125
];
127126

128127
keys.forEach(function(key) {
129-
this._signalsHandler.add([
128+
this._signalsHandler.add(
130129
Docking.DockManager.settings,
131130
'changed::' + key,
132131
this._updateIndicatorStyle.bind(this)
133-
]);
132+
);
134133
}, this);
135134

136135
if (this._location) {
137-
this._signalsHandler.add([
136+
this._signalsHandler.add(
138137
Docking.DockManager.getDefault().fm1Client,
139138
'windows-changed',
140139
this.onWindowsChanged.bind(this)
141-
]);
140+
);
142141
}
143142

144143
this._numberOverlay();

dash.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,7 @@ var MyDash = GObject.registerClass({
742742
if (!this._removables) {
743743
this._removables = new Locations.Removables();
744744
this._signalsHandler.addWithLabel('show-mounts',
745-
[ this._removables,
746-
'changed',
747-
this._queueRedisplay.bind(this) ]);
745+
this._removables, 'changed', this._queueRedisplay.bind(this));
748746
}
749747
Array.prototype.push.apply(newApps, this._removables.getApps());
750748
} else if (this._removables) {
@@ -756,10 +754,8 @@ var MyDash = GObject.registerClass({
756754
if (settings.get_boolean('show-trash')) {
757755
if (!this._trash) {
758756
this._trash = new Locations.Trash();
759-
this._signalsHandler.addWithLabel('show-trash',
760-
[ this._trash,
761-
'changed',
762-
this._queueRedisplay.bind(this) ]);
757+
this._signalsHandler.addWithLabel('show-trash', this._trash,
758+
'changed', this._queueRedisplay.bind(this));
763759
}
764760
newApps.push(this._trash.getApp());
765761
} else if (this._trash) {

dbusmenuUtils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ function makePopupMenuItem(dbusmenuItem, deep) {
261261
item.icon.icon_size = 16;
262262
}
263263

264-
signalsHandler.add([dbusmenuItem, Dbusmenu.MENUITEM_SIGNAL_PROPERTY_CHANGED, onPropertyChanged]);
264+
signalsHandler.add(dbusmenuItem, Dbusmenu.MENUITEM_SIGNAL_PROPERTY_CHANGED, onPropertyChanged);
265265

266266
// Connections on item will be lost when item is disposed; there's no need
267267
// to add them to signalsHandler.

docking.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -1134,11 +1134,10 @@ var DockedDash = GObject.registerClass({
11341134
function enable() {
11351135
this._signalsHandler.removeWithLabel(label);
11361136

1137-
this._signalsHandler.addWithLabel(label, [
1137+
this._signalsHandler.addWithLabel(label,
11381138
this._box,
11391139
'scroll-event',
1140-
onScrollEvent.bind(this)
1141-
]);
1140+
onScrollEvent.bind(this));
11421141
}
11431142

11441143
function disable() {
@@ -1470,12 +1469,10 @@ var WorkspaceIsolation = class DashToDock_WorkspaceIsolation {
14701469
// This last signal is only needed for monitor isolation, as windows
14711470
// might migrate from one monitor to another without triggering 'restacked'
14721471
if (DockManager.settings.get_boolean('isolate-monitors'))
1473-
this._signalsHandler.addWithLabel('isolation', [
1472+
this._signalsHandler.addWithLabel('isolation',
14741473
global.display,
14751474
'window-entered-monitor',
1476-
dock.dash._queueRedisplay.bind(dock.dash)
1477-
]);
1478-
1475+
dock.dash._queueRedisplay.bind(dock.dash));
14791476
}, this);
14801477

14811478
// here this is the Shell.App
@@ -1493,11 +1490,10 @@ var WorkspaceIsolation = class DashToDock_WorkspaceIsolation {
14931490
return this.open_new_window(-1);
14941491
}
14951492

1496-
this._injectionsHandler.addWithLabel('isolation', [
1493+
this._injectionsHandler.addWithLabel('isolation',
14971494
Shell.App.prototype,
14981495
'activate',
1499-
IsolatedOverview
1500-
]);
1496+
IsolatedOverview);
15011497
}
15021498

15031499
_disable () {

theming.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,11 @@ var ThemeManager = class DashToDock_ThemeManager {
291291
'extend-height',
292292
'force-straight-corner'];
293293

294-
keys.forEach(function(key) {
295-
this._signalsHandler.add([
296-
Docking.DockManager.settings,
297-
'changed::' + key,
298-
this.updateCustomTheme.bind(this)
299-
]);
300-
}, this);
294+
this._signalsHandler.add(...keys.map(key => [
295+
Docking.DockManager.settings,
296+
`changed::${key}`,
297+
() => this.updateCustomTheme(),
298+
]));
301299
}
302300
};
303301

0 commit comments

Comments
 (0)