refactor(tree): split the plugin host from the providers it loads
plugins/ held two unrelated things: the host that discovers and installs plugins, and the plugins themselves. The host moves to plugins/ with the built-in pacman provider beside it in providers/, where the external providers already live — so plugins/ is now one thing, and the name says which. The external plugin projects only change folder, not layout: providers/ holds aur-provider, flatpak-provider, example-provider and example-addon.
This commit is contained in:
15 files changed
+39
-39
No files matched your search
@@ -0,0 +1,49 @@
|
||||
// Example external provider plugin — a template for adding new package
|
||||
// providers without touching the application code.
|
||||
//
|
||||
// Build it as a shared library and drop it in a plugin directory
|
||||
// (next to the PacManager binary in ./plugins/ or in
|
||||
// ~/.local/share/PacManager/plugins/); the app discovers it at launch and on
|
||||
// the Plugins page via "Recharger".
|
||||
//
|
||||
// This is a *provider* plugin: it adds a package manager. For non-provider
|
||||
// extensions (UI tweaks, helpers, ...), see plugins/example-addon instead.
|
||||
//
|
||||
// A plugin only needs to:
|
||||
// 1. implement IPackageManager (see include/package-manager.h)
|
||||
// 2. export the C ABI symbols via the FWS_PROVIDER_PLUGIN macro
|
||||
//
|
||||
// To build with CMake from the project root:
|
||||
// cmake -B build -DFWS_BUILD_EXAMPLE_PLUGIN=ON && cmake --build build
|
||||
|
||||
#include "provider-plugin.h"
|
||||
|
||||
// A trivial provider that reports itself as always available but manages
|
||||
// nothing — replace the stubs with real commands (apt, dnf, zypper, ...).
|
||||
class SampleProvider : public IPackageManager {
|
||||
public:
|
||||
std::string getName() const override { return "sample"; }
|
||||
std::string getVersion() const override { return "0.1.0"; }
|
||||
std::string getDescription() const override {
|
||||
return "Exemple de plugin fournisseur (modèle à copier)";
|
||||
}
|
||||
|
||||
bool canSearch() const override { return false; }
|
||||
bool canInstall() const override { return false; }
|
||||
bool canRemove() const override { return false; }
|
||||
bool canUpdate() const override { return false; }
|
||||
bool canListInstalled() const override { return false; }
|
||||
|
||||
bool isAvailable() const override { return true; }
|
||||
|
||||
std::vector<PackageInfo> search(const std::string&) override { return {}; }
|
||||
bool install(const std::string&, ProgressCallback) override { return false; }
|
||||
bool remove(const std::string&, ProgressCallback) override { return false; }
|
||||
bool update(const std::string&, ProgressCallback) override { return false; }
|
||||
std::vector<PackageInfo> listInstalled() override { return {}; }
|
||||
std::vector<PackageInfo> listUpdates() override { return {}; }
|
||||
bool refresh(ProgressCallback) override { return false; }
|
||||
};
|
||||
|
||||
FWS_PROVIDER_PLUGIN(SampleProvider, "sample", "Sample Provider", "0.1.0",
|
||||
"Exemple de plugin fournisseur (modèle à copier)", "FWS");
|
||||
Reference in new issue
Block a user