mirror of
https://gitlab.gnome.org/julianschacher/top-bar-organizer.git
synced 2025-10-27 15:19:09 +00:00
Refactor: Reorder enable code and comment it, to make it more clear
This commit is contained in:
parent
d01fb434ee
commit
8586f095fc
@ -18,29 +18,28 @@ class Extension {
|
|||||||
|
|
||||||
this._boxOrderManager = new BoxOrderManager.BoxOrderManager();
|
this._boxOrderManager = new BoxOrderManager.BoxOrderManager();
|
||||||
|
|
||||||
// Stuff to do on startup(extension enable).
|
/// Stuff to do on startup(extension enable).
|
||||||
|
// Initially handle new top bar items and order top bar boxes.
|
||||||
this.#handleNewItemsAndOrderTopBar();
|
this.#handleNewItemsAndOrderTopBar();
|
||||||
|
|
||||||
|
// Overwrite `Panel._addToPanelBox` method with one handling new items
|
||||||
|
// and also handle AppIndicators getting ready, to handle new items.
|
||||||
this.#overwritePanelAddToPanelBox();
|
this.#overwritePanelAddToPanelBox();
|
||||||
|
this._boxOrderManager.connect("appIndicatorReady", () => {
|
||||||
|
this.#handleNewItemsAndOrderTopBar();
|
||||||
|
});
|
||||||
|
|
||||||
// Handle changes of configured box orders.
|
// Handle changes of configured box orders.
|
||||||
this._settingsHandlerIds = [];
|
this._settingsHandlerIds = [];
|
||||||
|
|
||||||
const addConfiguredBoxOrderChangeHandler = (box) => {
|
const addConfiguredBoxOrderChangeHandler = (box) => {
|
||||||
let handlerId = this.settings.connect(`changed::${box}-box-order`, () => {
|
let handlerId = this.settings.connect(`changed::${box}-box-order`, () => {
|
||||||
this.#handleNewItemsAndOrderTopBar();
|
this.#handleNewItemsAndOrderTopBar();
|
||||||
});
|
});
|
||||||
this._settingsHandlerIds.push(handlerId);
|
this._settingsHandlerIds.push(handlerId);
|
||||||
};
|
};
|
||||||
|
|
||||||
addConfiguredBoxOrderChangeHandler("left");
|
addConfiguredBoxOrderChangeHandler("left");
|
||||||
addConfiguredBoxOrderChangeHandler("center");
|
addConfiguredBoxOrderChangeHandler("center");
|
||||||
addConfiguredBoxOrderChangeHandler("right");
|
addConfiguredBoxOrderChangeHandler("right");
|
||||||
|
|
||||||
// Handle AppIndicators getting ready.
|
|
||||||
this._boxOrderManager.connect("appIndicatorReady", () => {
|
|
||||||
this.#handleNewItemsAndOrderTopBar();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disable() {
|
disable() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user