GNOME Bugzilla – Bug 766775
Use libpeas for the plugin system
Last modified: 2016-08-15 08:43:03 UTC
libpeas is a nice library providing a plugin system: https://wiki.gnome.org/Projects/Libpeas It is used by gedit, totem, rhythmbox, gnome-builder, eog and others. libpeas was written to avoid code duplication, instead of having a slightly different copy of a plugin system in various applications.
I'm not against this -- is there a porting guide somewhere?
I don't think there is a porting guide. Porting from what? To best is to first read the README and then the API reference, and maybe look at how gedit uses libpeas. Since libpeas has been created from the gedit source code (which contained a plugin system copied from elsewhere, but I don't know more details, I'm not a libpeas developer).
Maybe worth considering is to have a different namespace for the API that plugins can use. So the API would just be a set of interfaces, implemented by concrete classes in the gnome-software core. I think that having that decoupling is beneficial in the long term. The core can be refactored more freely, as long as the interfaces are implemented correctly. And a different core/UI could be implemented (e.g. for a smartphone) without touching the plugins. But if the API is anyway not considered stable and you adapt the plugins code at the same time as you adapt the core, the extra boilerplate layer is maybe not worthwhile.
So I looked at this; libpeas isn't really suitable for the way gnome-software uses plugins -- plugins in gnome-software are not really "optional components" but make up a the core of how gnome-software works by defining blobs of functionality that ISVs can choose at build-time and runtime. Using libpeas wouldn't actually give us anything new in gnome-software it doesn't have already. At the moment there is basically no boilerplate in plugins (we just call into a small set of optional vfuncs) and with libpeas every plugin grows by a large amount and needs splitting out. There also doesn't seem to be a way to achieve the dependencies or conflicts depsolving that gnome-software currently does, without over-engineering things considerably. I don't think this is useful to port gnome-software at this stage, however if someone wants to do the work converting everything I'm certainly not going to stand in their way.
Ok, thanks for looking at it. It's a pity that libpeas is not suitable for gnome-software. I thought that libpeas was a good library for any glib-based software that wants a plugin system.