Debian Codegraph @

README

raw
1 Introducing libpeas
2 ===================
3
4 libpeas is a gobject-based plugins engine, and is targetted at giving every
5 application the chance to assume its own extensibility. It is currently used by
6 several Gnome applications like gedit and Totem.
7
8 It takes its roots in the old gedit plugins engine, and provides an extensive set
9 of features mirroring the desiderata of most of the applications providing an
10 extension framework.
11
12 Documentation
13 -------------------------
14
15 Documentation can be found at:
16
17 - Peas-1.0: https://gnome.pages.gitlab.gnome.org/libpeas/libpeas-1.0/.
18 - GtkPeas-1.0: https://gnome.pages.gitlab.gnome.org/libpeas/libpeas-gtk-1.0/.
19
20 Multiple extension points
21 -------------------------
22
23 One of the most frustrating limitations of the Gedit plugins engine was that it
24 only allows extending a single class, called GeditPlugin. With libpeas, this
25 limitation vanishes, and the application writer is now able to provide a set of
26 GInterfaces the plugin writer will be able to implement as his plugin requires.
27
28 On-demand programming language support
29 --------------------------------------
30
31 libpeas comes with a set of supported languages (currently, C, Lua 5.1,
32 Python 2 and Python 3). Those languages are supported through “loaders” which
33 are loaded on demand. What it means is that you only pay for what you use: if
34 you have no Python plugin, the Python interpreter won't be loaded in memory.
35 Of course, the same goes for the C loader.
36
37 Damn simple to use (or at least we try hard)
38 --------------------------------------------
39
40 Adding support for libpeas-enabled plugins in your own application is a matter
41 of minutes. You only have to create an instance of the plugins engine, and
42 call methods on the implementations of the various extension points. That's it,
43 no clock harmed.
44
45 A shared library for everyone
46 -----------------------------
47
48 As I noted earlier, the latest improvements of our beloved development platform
49 made it possible to create bindings for apps very quickly. And with the Gnome 3
50 announcement, this looked like the perfect timing to make the plugins engine
51 and its latest improvements available to everyone, with a library. Also,
52 hopefully it will reduce code duplication and allow bugs to be fixed at the
53 right place, once and for all, improving the quality of our applications.
54
55 As a member of the Gnome community and as an offspring of gedit, libpeas already
56 shares most of the Gnome infrastructure and philosophy:
57
58 * You can download the first release tarball on the Gnome FTP server.
59 * You can browse the source and contribute using our git repository.
60 * You can come and discuss with me and others on #libpeas (GimpNet)
61 * And you can report bug or propose new features through the good old Gnome
62 Bugzilla, against the libpeas module.
63
64 A few hints on using libpeas
65 ============================
66
67 As always for the new projects, it can take some time to grasp all the
68 subtleties at first.
69
70 Plugins versus Extensions
71 -------------------------
72
73 Something that is going to puzzle most of the newcomers is the fact that the
74 libpeas API talks about both plugins and extensions, two terms that are usually
75 used interchangeably, but who have very different meanings in libpeas.
76
77 Let's try and give a definition of both of these words in this context:
78
79 - Plugin: In the context of libpeas, a plugin is a logical package. It's what
80 you will enable or disable from the UI, and at the end it is what the user
81 will see. An example of plugin for gedit would be the file browser plugin.
82
83 - Extension. An extension is an object which implements an interface
84 associated to an extension point. There can be several extensions in a single
85 plugin. Examples of extensions provided by the file browser plugin would be
86 the configuration dialog, the left panel pane and a completion provider for
87 file names.
88
89 Sample code
90 -----------
91
92 The libpeas package contains a sample application called peas-demo, and sample
93 plugins written in C, Lua and Python.
94
95 The global idea is this one: you create a new PeasEngine instance and give it
96 the information needed for it to find your plugins. Then you load some plugins
97 (you can use the PeasGtkPluginManager for that purpose) and perform actions
98 through some PeasExtensions objects you can get from the engine.
99
100
101 Copied from http://log.istique.net/2010/announcing-libpeas