mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
settings: clean the deprecated "allowUserSettings" + fix gear icon showing when plugin has no settings
This commit is contained in:
@@ -1111,7 +1111,7 @@ Singleton {
|
||||
|
||||
// Delete deprecated user settings from the wiget
|
||||
for (const k of Object.keys(widget)) {
|
||||
if (k === "id" || k === "allowUserSettings") {
|
||||
if (k === "id") {
|
||||
continue;
|
||||
}
|
||||
if (!keys.includes(k)) {
|
||||
@@ -1122,7 +1122,7 @@ Singleton {
|
||||
// Inject missing default setting (metaData) from BarWidgetRegistry
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
const k = keys[i];
|
||||
if (k === "id" || k === "allowUserSettings") {
|
||||
if (k === "id") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,9 +83,7 @@ Variants {
|
||||
var metadata = DesktopWidgetRegistry.widgetMetadata[widgetId];
|
||||
if (metadata) {
|
||||
Object.keys(metadata).forEach(function (key) {
|
||||
if (key !== "allowUserSettings") {
|
||||
newWidget[key] = metadata[key];
|
||||
}
|
||||
newWidget[key] = metadata[key];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,7 @@ NBox {
|
||||
var metadata = BarWidgetRegistry.widgetMetadata[widgetId];
|
||||
if (metadata) {
|
||||
Object.keys(metadata).forEach(function (key) {
|
||||
if (key !== "allowUserSettings") {
|
||||
newWidget[key] = metadata[key];
|
||||
}
|
||||
newWidget[key] = metadata[key];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,7 @@ ColumnLayout {
|
||||
var metadata = BarWidgetRegistry.widgetMetadata[widgetId];
|
||||
if (metadata) {
|
||||
Object.keys(metadata).forEach(function (key) {
|
||||
if (key !== "allowUserSettings") {
|
||||
newWidget[key] = metadata[key];
|
||||
}
|
||||
newWidget[key] = metadata[key];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,9 +184,7 @@ ColumnLayout {
|
||||
var metadata = ControlCenterWidgetRegistry.widgetMetadata[widgetId];
|
||||
if (metadata) {
|
||||
Object.keys(metadata).forEach(function (key) {
|
||||
if (key !== "allowUserSettings") {
|
||||
newWidget[key] = metadata[key];
|
||||
}
|
||||
newWidget[key] = metadata[key];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,9 +234,7 @@ ColumnLayout {
|
||||
var metadata = DesktopWidgetRegistry.widgetMetadata[widgetId];
|
||||
if (metadata) {
|
||||
Object.keys(metadata).forEach(function (key) {
|
||||
if (key !== "allowUserSettings") {
|
||||
newWidget[key] = metadata[key];
|
||||
}
|
||||
newWidget[key] = metadata[key];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,12 +372,7 @@ Singleton {
|
||||
// Helper function to check if widget has user settings
|
||||
function widgetHasUserSettings(id) {
|
||||
var meta = widgetMetadata[id];
|
||||
if (meta === undefined)
|
||||
return false;
|
||||
// allowUserSettings=false lets a widget opt out of the settings dialog
|
||||
if (meta.allowUserSettings === false)
|
||||
return false;
|
||||
return true;
|
||||
return (meta !== undefined);
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
|
||||
@@ -111,7 +111,7 @@ NBox {
|
||||
return [Color.mPrimary, Color.mOnPrimary];
|
||||
}
|
||||
|
||||
// Check if widget has settings (either core widget with allowUserSettings or plugin with settings entry point)
|
||||
// Check if widget has settings (either core widget with metadata or plugin with settings entry point)
|
||||
function widgetHasSettings(widgetId) {
|
||||
// Check if it's a core widget with user settings
|
||||
if (root.widgetRegistry && root.widgetRegistry.widgetHasUserSettings(widgetId)) {
|
||||
|
||||
Reference in New Issue
Block a user