From dba3de2a8e3bb764412c503604c2966de675e973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 26 Sep 2024 19:07:11 +0200 Subject: [PATCH] window-list: Split out some common code Adding an app button and adding a window button involves some shared steps, move those to a shared `_addButton()` method. Part-of: --- extensions/window-list/extension.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index e7a1c777..6eb08da0 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -964,14 +964,18 @@ class WindowList extends St.Widget { this._removeApp(app); } - _addApp(app, animate) { - let button = new AppButton(app, this._perMonitor, this._monitor.index); + _addButton(button, animate) { this._settings.bind('display-all-workspaces', button, 'ignore-workspace', Gio.SettingsBindFlags.GET); this._windowList.add_child(button); button.show(animate); } + _addApp(app, animate) { + const button = new AppButton(app, this._perMonitor, this._monitor.index); + this._addButton(button, animate); + } + _removeApp(app) { let children = this._windowList.get_children(); let child = children.find(c => c.app === app); @@ -992,11 +996,8 @@ class WindowList extends St.Widget { this._windowSignals.set( win, win.connect('unmanaged', () => this._removeWindow(win))); - let button = new WindowButton(win, this._perMonitor, this._monitor.index); - this._settings.bind('display-all-workspaces', - button, 'ignore-workspace', Gio.SettingsBindFlags.GET); - this._windowList.add_child(button); - button.show(animate); + const button = new WindowButton(win, this._perMonitor, this._monitor.index); + this._addButton(button, animate); } _removeWindow(win) {