mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
PluginSystem: relying on entryPoints, removing "provides" to keep things simple
This commit is contained in:
@@ -88,7 +88,7 @@ SmartPanel {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!plugin.manifest.provides.panel) {
|
||||
if (!plugin.manifest.entryPoints || !plugin.manifest.entryPoints.panel) {
|
||||
Logger.w("PluginPanelSlot", "Plugin does not provide a panel:", pluginId);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,18 +58,6 @@ ColumnLayout {
|
||||
description: modelData.description
|
||||
}
|
||||
|
||||
NToggle {
|
||||
checked: PluginRegistry.isPluginEnabled(modelData.id)
|
||||
baseSize: Style.baseWidgetSize * 0.7
|
||||
onToggled: function (checked) {
|
||||
if (checked) {
|
||||
PluginService.enablePlugin(modelData.id);
|
||||
} else {
|
||||
PluginService.disablePlugin(modelData.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
icon: "settings"
|
||||
tooltipText: I18n.tr("settings.plugins.settings.tooltip")
|
||||
@@ -89,6 +77,18 @@ ColumnLayout {
|
||||
uninstallDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
checked: PluginRegistry.isPluginEnabled(modelData.id)
|
||||
baseSize: Style.baseWidgetSize * 0.7
|
||||
onToggled: function (checked) {
|
||||
if (checked) {
|
||||
PluginService.enablePlugin(modelData.id);
|
||||
} else {
|
||||
PluginService.disablePlugin(modelData.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,13 +340,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
if (!manifest.provides) {
|
||||
return {
|
||||
valid: false,
|
||||
error: "Missing 'provides' field"
|
||||
};
|
||||
}
|
||||
|
||||
if (!manifest.entryPoints) {
|
||||
return {
|
||||
valid: false,
|
||||
|
||||
@@ -360,7 +360,7 @@ Singleton {
|
||||
}
|
||||
|
||||
// Load bar widget component if provided (don't instantiate - BarWidgetRegistry will do that)
|
||||
if (manifest.provides.barWidget && manifest.entryPoints.barWidget) {
|
||||
if (manifest.entryPoints && manifest.entryPoints.barWidget) {
|
||||
var widgetPath = pluginDir + "/" + manifest.entryPoints.barWidget;
|
||||
var widgetComponent = Qt.createComponent("file://" + widgetPath);
|
||||
|
||||
@@ -390,7 +390,7 @@ Singleton {
|
||||
Logger.i("PluginService", "Unloading plugin:", pluginId);
|
||||
|
||||
// Unregister from BarWidgetRegistry
|
||||
if (plugin.manifest.provides.barWidget) {
|
||||
if (plugin.manifest.entryPoints && plugin.manifest.entryPoints.barWidget) {
|
||||
BarWidgetRegistry.unregisterPluginWidget(pluginId);
|
||||
}
|
||||
|
||||
@@ -417,6 +417,7 @@ Singleton {
|
||||
readonly property string pluginId: "${pluginId}"
|
||||
readonly property string pluginDir: "${pluginDir}"
|
||||
property var pluginSettings: ({})
|
||||
property var manifest: ({})
|
||||
|
||||
// IPC handlers storage
|
||||
property var ipcHandlers: ({})
|
||||
@@ -428,6 +429,9 @@ Singleton {
|
||||
}
|
||||
`, root, "PluginAPI_" + pluginId);
|
||||
|
||||
// Set manifest
|
||||
api.manifest = manifest;
|
||||
|
||||
// Load plugin settings
|
||||
loadPluginSettings(pluginId, function (settings) {
|
||||
api.pluginSettings = settings;
|
||||
@@ -586,7 +590,7 @@ Singleton {
|
||||
}
|
||||
|
||||
var plugin = root.loadedPlugins[pluginId];
|
||||
if (!plugin || !plugin.manifest || !plugin.manifest.provides.panel) {
|
||||
if (!plugin || !plugin.manifest || !plugin.manifest.entryPoints || !plugin.manifest.entryPoints.panel) {
|
||||
Logger.w("PluginService", "Plugin does not provide a panel:", pluginId);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user