After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766775 - Use libpeas for the plugin system
Use libpeas for the plugin system
Status: RESOLVED WONTFIX
Product: gnome-software
Classification: Applications
Component: General
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Software maintainer(s)
GNOME Software maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-05-22 15:40 UTC by Sébastien Wilmet
Modified: 2016-08-15 08:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sébastien Wilmet 2016-05-22 15:40:47 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.
Comment 1 Richard Hughes 2016-05-22 17:57:28 UTC
I'm not against this -- is there a porting guide somewhere?
Comment 2 Sébastien Wilmet 2016-05-22 18:06:45 UTC
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).
Comment 3 Sébastien Wilmet 2016-05-23 05:17:15 UTC
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.
Comment 4 Richard Hughes 2016-08-15 08:15:05 UTC
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.
Comment 5 Sébastien Wilmet 2016-08-15 08:43:03 UTC
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.