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: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/338>
This commit is contained in:
committed by
Marge Bot
parent
f1671bc206
commit
dba3de2a8e
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user