mirror of
https://gitlab.gnome.org/julianschacher/top-bar-organizer.git
synced 2025-10-27 15:19:09 +00: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
@ -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…
x
Reference in New Issue
Block a user