♻️ Refactor how preferences pages are set up

This commit is contained in:
Simon Schneegans
2022-01-22 20:24:38 +01:00
parent 55727f7c2b
commit a5f7769e58
10 changed files with 37 additions and 57 deletions
+3 -6
View File
@@ -57,7 +57,7 @@ var EnergizeA = class EnergizeA {
// This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the
// preferences dialog.
static initPreferences(dialog) {
static getPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/EnergizeA.ui`);
@@ -67,11 +67,8 @@ var EnergizeA = class EnergizeA {
dialog.bindAdjustment('energize-a-scale');
dialog.bindColorButton('energize-a-color');
// Finally, append the settings page to the main stack.
const stack = dialog.getBuilder().get_object('main-stack');
stack.add_titled(
dialog.getBuilder().get_object('energize-a-prefs'), EnergizeA.getNick(),
EnergizeA.getLabel());
// Finally, return the new settings page.
return dialog.getBuilder().get_object('energize-a-prefs');
}
// ---------------------------------------------------------------- API for extension.js