mirror of
https://gitlab.gnome.org/june/top-bar-organizer.git
synced 2026-01-11 16:53:51 +01:00
Feature: Handle changes of configured box orders
Handle changes of configured box orders, by ordering the relevant top bar items according to the configured box order, which changed.
This commit is contained in:
parent
fd21ecb189
commit
a73ed96bda
1 changed files with 19 additions and 0 deletions
|
|
@ -14,11 +14,30 @@ class Extension {
|
||||||
this._addNewItemsToBoxOrders();
|
this._addNewItemsToBoxOrders();
|
||||||
this._orderTopBarItemsOfAllBoxes();
|
this._orderTopBarItemsOfAllBoxes();
|
||||||
this._overwritePanelAddToPanelBox();
|
this._overwritePanelAddToPanelBox();
|
||||||
|
|
||||||
|
// Handle changes of configured box orders.
|
||||||
|
this._settingsHandlerIds = [ ];
|
||||||
|
|
||||||
|
const addConfiguredBoxOrderChangeHandler = (box) => {
|
||||||
|
let handlerId = this.settings.connect(`changed::${box}-box-order`, () => {
|
||||||
|
this._orderTopBarItems(box);
|
||||||
|
});
|
||||||
|
this._settingsHandlerIds.push(handlerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
addConfiguredBoxOrderChangeHandler("left");
|
||||||
|
addConfiguredBoxOrderChangeHandler("center");
|
||||||
|
addConfiguredBoxOrderChangeHandler("right");
|
||||||
}
|
}
|
||||||
|
|
||||||
disable() {
|
disable() {
|
||||||
// Revert the overwrite of `Panel._addToPanelBox`.
|
// Revert the overwrite of `Panel._addToPanelBox`.
|
||||||
Panel.Panel.prototype._addToPanelBox = Panel.Panel.prototype._originalAddToPanelBox;
|
Panel.Panel.prototype._addToPanelBox = Panel.Panel.prototype._originalAddToPanelBox;
|
||||||
|
|
||||||
|
// Disconnect signals.
|
||||||
|
for (const handlerId of this._settingsHandlerIds) {
|
||||||
|
this.settings.disconnect(handlerId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue