mirror of
https://gitlab.gnome.org/julianschacher/top-bar-organizer.git
synced 2025-10-27 15:19:09 +00:00
Refactor: Add settings to globalThis
Do this so that we don't have to get them in each class individually.
This commit is contained in:
parent
2f9f4d1a3f
commit
34ba8a58cd
@ -11,4 +11,6 @@ function buildPrefsWidget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
// Load the settings.
|
||||||
|
globalThis.settings = ExtensionUtils.getSettings();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,8 +19,6 @@ var PrefsBoxOrderListBox = GObject.registerClass({
|
|||||||
constructor(params = {}, boxOrder) {
|
constructor(params = {}, boxOrder) {
|
||||||
super(params);
|
super(params);
|
||||||
|
|
||||||
this._settings = ExtensionUtils.getSettings();
|
|
||||||
|
|
||||||
this.boxOrder = boxOrder;
|
this.boxOrder = boxOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +35,6 @@ var PrefsBoxOrderListBox = GObject.registerClass({
|
|||||||
const item = potentialPrefsBoxOrderItemRow.item;
|
const item = potentialPrefsBoxOrderItemRow.item;
|
||||||
currentBoxOrder.push(item);
|
currentBoxOrder.push(item);
|
||||||
}
|
}
|
||||||
this._settings.set_strv(this.boxOrder, currentBoxOrder);
|
settings.set_strv(this.boxOrder, currentBoxOrder);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -34,8 +34,6 @@ var PrefsBoxOrderListEmptyPlaceholder = GObject.registerClass({
|
|||||||
ownListBox.insert(value, 0);
|
ownListBox.insert(value, 0);
|
||||||
|
|
||||||
/// Finally save the box orders to settings.
|
/// Finally save the box orders to settings.
|
||||||
const settings = ExtensionUtils.getSettings();
|
|
||||||
|
|
||||||
settings.set_strv(ownListBox.boxOrder, [value.item]);
|
settings.set_strv(ownListBox.boxOrder, [value.item]);
|
||||||
|
|
||||||
let updatedBoxOrder = [ ];
|
let updatedBoxOrder = [ ];
|
||||||
|
|||||||
@ -25,8 +25,6 @@ var PrefsPage = GObject.registerClass({
|
|||||||
constructor(params = {}) {
|
constructor(params = {}) {
|
||||||
super(params);
|
super(params);
|
||||||
|
|
||||||
this._settings = ExtensionUtils.getSettings();
|
|
||||||
|
|
||||||
// Scroll up or down, when a Drag-and-Drop operation is in progress and
|
// Scroll up or down, when a Drag-and-Drop operation is in progress and
|
||||||
// the user has their cursor either in the upper or lower 10% of this
|
// the user has their cursor either in the upper or lower 10% of this
|
||||||
// widget respectively.
|
// widget respectively.
|
||||||
@ -73,8 +71,8 @@ var PrefsPage = GObject.registerClass({
|
|||||||
gtkListBox.set_placeholder(new PrefsBoxOrderListEmptyPlaceholder.PrefsBoxOrderListEmptyPlaceholder());
|
gtkListBox.set_placeholder(new PrefsBoxOrderListEmptyPlaceholder.PrefsBoxOrderListEmptyPlaceholder());
|
||||||
};
|
};
|
||||||
|
|
||||||
initializeGtkListBox(this._settings.get_strv("left-box-order"), this._left_box_order);
|
initializeGtkListBox(settings.get_strv("left-box-order"), this._left_box_order);
|
||||||
initializeGtkListBox(this._settings.get_strv("center-box-order"), this._center_box_order);
|
initializeGtkListBox(settings.get_strv("center-box-order"), this._center_box_order);
|
||||||
initializeGtkListBox(this._settings.get_strv("right-box-order"), this._right_box_order);
|
initializeGtkListBox(settings.get_strv("right-box-order"), this._right_box_order);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user