🔧 Allow effects with no settings

This commit is contained in:
Simon Schneegans
2023-03-29 20:24:28 +02:00
parent 23a85798ca
commit b7429bada3
+13 -3
View File
@@ -227,8 +227,16 @@ var PreferencesDialog = class PreferencesDialog {
const [minMajor, minMinor] = effect.getMinShellVersion();
if (utils.shellVersionIsAtLeast(minMajor, minMinor)) {
const uiFile = `/ui/${utils.getUIDir()}/${effect.getNick()}.ui`;
const [hasPrefs] = Gio.resources_get_info(uiFile, 0);
const uiFile = `/ui/${utils.getUIDir()}/${effect.getNick()}.ui`;
// Is there a better way to test for the existence of a resource file?
let hasPrefs = false;
try {
Gio.resources_get_info(uiFile, 0);
hasPrefs = true;
} catch (e) {
// Nothing todo, there
}
// Add the settings page to the builder.
if (hasPrefs) {
@@ -288,9 +296,11 @@ var PreferencesDialog = class PreferencesDialog {
}
});
this._effectRows.push(row);
row.add_action(previewButton);
} else {
row.add_suffix(previewButton);
}
row.add_action(previewButton);
row.add_prefix(button);
group.add(row);