mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge pull request #2095 from spiros132/main
feat(desktop-widgets): Better desktopWidgetSettings for plugins, and fixed a bug related to the desktopWidgetSettings
This commit is contained in:
@@ -302,7 +302,7 @@ Item {
|
||||
if (DesktopWidgetRegistry.isPluginWidget(widgetId)) {
|
||||
var pluginId = widgetId.replace("plugin:", "");
|
||||
var manifest = PluginRegistry.getPluginManifest(pluginId);
|
||||
hasSettings = manifest && manifest.entryPoints && manifest.entryPoints.settings;
|
||||
hasSettings = manifest && manifest.entryPoints && (manifest.entryPoints.settings || manifest.entryPoints.desktopWidgetSettings);
|
||||
} else {
|
||||
hasSettings = DesktopWidgetRegistry.widgetSettingsMap[widgetId] !== undefined;
|
||||
}
|
||||
|
||||
@@ -186,10 +186,18 @@ Popup {
|
||||
if (manifest && manifest.entryPoints && manifest.entryPoints.desktopWidgetSettings) {
|
||||
settingsPath = "file://" + pluginDir + "/" + manifest.entryPoints.desktopWidgetSettings;
|
||||
|
||||
var widgetSettings = {};
|
||||
widgetSettings.data = widgetData || {};
|
||||
widgetSettings.metadata = DesktopWidgetRegistry.widgetMetadata[widgetId] || {};
|
||||
widgetSettings.save = function () {
|
||||
var newSettings = Object.assign({}, widgetSettings.data);
|
||||
root.settingsCache = newSettings;
|
||||
saveTimer.start();
|
||||
};
|
||||
|
||||
settingsLoader.setSource(settingsPath + "?v=" + loadVersion, {
|
||||
"pluginApi": api,
|
||||
"widgetData": widgetData || {},
|
||||
"widgetMetadata": DesktopWidgetRegistry.widgetMetadata[widgetId]
|
||||
"widgetSettings": widgetSettings
|
||||
});
|
||||
} else {
|
||||
Logger.w("DesktopWidgetSettingsDialog", "Plugin does not have desktop widget settings:", pluginId);
|
||||
|
||||
Reference in New Issue
Block a user