gobject-based plugins engine
License
cafe-desktop/libbean
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Introducing libbean =================== libbean is a gobject-based plugins engine, and is targetted at giving every application the chance to assume its own extensibility. It is currently used by the CAFE application lapiz. It takes its roots in the old lapiz plugins engine, and provides an extensive set of features mirroring the desiderata of most of the applications providing an extension framework. Multiple extension points ------------------------- One of the most frustrating limitations of the Lapiz plugins engine was that it only allows extending a single class, called LapizPlugin. With libbean, this limitation vanishes, and the application writer is now able to provide a set of GInterfaces the plugin writer will be able to implement as his plugin requires. On-demand programming language support -------------------------------------- libbean comes with a set of supported languages (currently, C, Lua 5.1, Python 2 and Python 3). Those languages are supported through “loaders” which are loaded on demand. What it means is that you only pay for what you use: if you have no Python plugin, the Python interpreter won't be loaded in memory. Of course, the same goes for the C loader. Damn simple to use (or at least we try hard) -------------------------------------------- Adding support for libbean-enabled plugins in your own application is a matter of minutes. You only have to create an instance of the plugins engine, and call methods on the implementations of the various extension points. That's it, no clock harmed. A few hints on using libbean ============================ As always for the new projects, it can take some time to grasp all the subtleties at first. Plugins versus Extensions ------------------------- Something that is going to puzzle most of the newcomers is the fact that the libbean API talks about both plugins and extensions, two terms that are usually used interchangeably, but who have very different meanings in libbean. Let's try and give a definition of both of these words in this context: - Plugin: In the context of libbean, a plugin is a logical package. It's what you will enable or disable from the UI, and at the end it is what the user will see. An example of plugin for lapiz would be the file browser plugin. - Extension. An extension is an object which implements an interface associated to an extension point. There can be several extensions in a single plugin. Examples of extensions provided by the file browser plugin would be the configuration dialog, the left panel pane and a completion provider for file names. Sample code ----------- The libbean package contains a sample application called bean-demo, and sample plugins written in C, Lua and Python. The global idea is this one: you create a new BeanEngine instance and give it the information needed for it to find your plugins. Then you load some plugins (you can use the BeanCtkPluginManager for that purpose) and perform actions through some BeanExtensions objects you can get from the engine.
About
gobject-based plugins engine