Merged in bugfix/docs-cleanup (pull request #30)
Bugfix/docs cleanup
Approved-by: Elliott Sales de Andrade
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HISTORY.md Fri Aug 16 04:23:26 2019 +0000
@@ -0,0 +1,41 @@
+GPlugin is a GObject based library that implements a reusable plugin system +that supports loading plugins in other languages via loaders. GPlugin also +implements dependencies among the plugins. +It was started due to the infamous "Plugin Problem" for Guifications 3, which +was that I needed plugins that could depend on each other, be able to be +written in other languages, have plugins that are loaded before the main load +phase, and allow plugins to register types into the GObject type system. +After trying to fix this numerous times in the Guifications 3 tree, I decided +I should really do this the UNIX way and write it as a stand alone library. +During this time, I also got the idea that there was a good chance that someone +probably beat me to this... So I started searching and came across libpeas. +Libpeas looked promising, but there was a few things about it that I really +didn't care for. First of all, the plugin information (id, name, author, etc) +are in a separate data file that gets stored in a separate location on disk. +Getting people to write good plugins is difficult enough as it is, why bother +throwing more obstacles in their way? This data file is a essentially a +GKeyFile, which means you can store the translations of all the fields right in +it. Now this is great if your plugin doesn't have any strings to display at +runtime, but if it does, you still need to install the translation file itself. +So as long as your plugin has to display strings at runtime, all that data file +gave you was more work. So there was STRIKE ONE! +So I continued to look at libpeas and noticed something odd in the earlier +mentioned data file. One of the fields you have to set is the Loader!? Yes, +the libpeas authors explicitly expect you to call out which loader you need. I +personally find this to be very lazy. I realize it makes it easier to code, +but come on, that should be a one time cost to the library author, instead of +an additional startup cost to the plugin author. STRIKE TWO! +So with two strikes down, I continued researching libpeas, by now working on a +plugin for rhythmbox, and just found the API to be clunky and poorly +documented. Now maybe I just wasn't finding the write documentation, but this +Libpeas had struck out for me, and as such I started GPlugin the very next day! --- a/README Wed Aug 14 05:55:03 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-GPlugin is a GObject based library that implements a reusable plugin system
-that supports loading plugins in other languages via loaders. GPlugin also
-implements dependencies among the plugins.
-It was started due to the infamous "Plugin Problem" for Guifications 3, which
-was that I needed plugins that could depend on each other, be able to be
-written in other languages, have plugins that are loaded before the main load
-phase, and allow plugins to register types into the GObject type system.
-After trying to fix this numerous times in the Guifications 3 tree, I decided
-I should really do this the UNIX way and write it as a stand alone library.
-During this time, I also got the idea that there was a good chance that someone
-probably beat me to this... So I started searching and came across libpeas.
-Libpeas looked promising, but there was a few things about it that I really
-didn't care for. First of all, the plugin information (id, name, author, etc)
-are in a separate data file that gets stored in a separate location on disk.
-Getting people to write good plugins is difficult enough as it is, why bother
-throwing more obstacles in their way? This data file is a essentially a
-GKeyFile, which means you can store the translations of all the fields right in
-it. Now this is great if your plugin doesn't have any strings to display at
-runtime, but if it does, you still need to install the translation file itself.
-So as long as your plugin has to display strings at runtime, all that data file
-gave you was more work. So there was STRIKE ONE!
-So I continued to look at libpeas and noticed something odd in the earlier
-mentioned data file. One of the fields you have to set is the Loader!? Yes,
-the libpeas authors explicitly expect you to call out which loader you need. I
-personally find this to be very lazy. I realize it makes it easier to code,
-but come on, that should be a one time cost to the library author, instead of
-an additional startup cost to the plugin author. STRIKE TWO!
-So with two strikes down, I continued researching libpeas, by now working on a
-plugin for rhythmbox, and just found the API to be clunky and poorly
-documented. Now maybe I just wasn't finding the write documentation, but this
-Libpeas had struck out for me, and as such I started GPlugin the very next day!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md Fri Aug 16 04:23:26 2019 +0000
@@ -0,0 +1,32 @@
+GPlugin is a GObject based library that implements a reusable plugin system. +It supports loading plugins in multiple other languages via loaders. It relies +heavily on [GObjectIntrospection](https://gi.readthedocs.io/) to expose its API +It has a simple API which makes it very easy to use in your application. +For more information on using GPlugin in your application, please see the +[embedding](Embedding) page. +Default: [![Default Build Status](https://bamboo.pidgin.im/plugins/servlet/wittified/build-status/GPLUG-GPLUGIN)](https://bamboo.pidgin.im/browse/GPLUG-GPLUGIN) +Develop: [![Develop Build Status](https://bamboo.pidgin.im/plugins/servlet/wittified/build-status/GPLUG-GPLUGIN0)](https://bamboo.pidgin.im/browse/GPLUG-GPLUGIN0/) +GPlugin has a bit of history, you can read more about it in [HISTORY.md](HISTORY.md) +GPlugin currently supports plugins written in C/C++, Lua, Python, and Vala. +The API reference for the `default` branch can be found at +[docs.pidgin.im/gplugin/default](https://docs.pidgin.im/gplugin/default). +The in-development API reference for the `develop` branch can be found at +[docs.pidgin.im/gplugin/develop](https://docs.pidgin.im/gplugin/develop). --- a/gplugin-gtk/gplugin-gtk-plugin-info.c Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin-gtk/gplugin-gtk-plugin-info.c Fri Aug 16 04:23:26 2019 +0000
@@ -27,6 +27,18 @@
* #GPluginGtkPluginInfo is a Gtk+ widget that shows information about plugins.
+ * GPLUGIN_GTK_TYPE_PLUGIN_INFO: + * The standard _get_type macro for #GPluginGtkPluginInfo. + * GPluginGtkPluginInfo: + * A widget that displays a #GPluginPluginInfo in a user friendly way. /******************************************************************************
*****************************************************************************/
--- a/gplugin-gtk/gplugin-gtk-store.c Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin-gtk/gplugin-gtk-store.c Fri Aug 16 04:23:26 2019 +0000
@@ -27,6 +27,27 @@
* #GPluginGtkStore is a GtkTreeModel populated with gplugins.
+ * GPLUGIN_GTK_TYPE_STORE: + * The standard _get_type macro for #GPluginGtkStore. + * GPluginGtkStoreColumns: + * @GPLUGIN_GTK_STORE_LOADED_COLUMN: The loaded column. + * @GPLUGIN_GTK_STORE_PLUGIN_COLUMN: The plugin column. + * @GPLUGIN_GTK_STORE_MARKUP_COLUMN: The markup column. + * An enum declaring the columns in a #GPluginGtkStore. + * A #GtkListStore that contains all of the known plugins in GPlugin. struct _GPluginGtkStore {
--- a/gplugin-gtk/gplugin-gtk-store.h Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin-gtk/gplugin-gtk-store.h Fri Aug 16 04:23:26 2019 +0000
@@ -36,6 +36,8 @@
GPLUGIN_GTK_STORE_LOADED_COLUMN,
GPLUGIN_GTK_STORE_PLUGIN_COLUMN,
GPLUGIN_GTK_STORE_MARKUP_COLUMN,
GPLUGIN_GTK_STORE_N_COLUMNS,
} GPluginGtkStoreColumns;
--- a/gplugin-gtk/gplugin-gtk-view.c Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin-gtk/gplugin-gtk-view.c Fri Aug 16 04:23:26 2019 +0000
@@ -26,6 +26,19 @@
* #GPluginGtkView is a display widget for a list of GPlugins.
+ * GPLUGIN_GTK_TYPE_VIEW: + * The standard _get_type macro for #GPluginGtkView. + * A #GtkTreeView widget that displays all the plugins and some basic + * information about them. /******************************************************************************
*****************************************************************************/
--- a/gplugin-gtk/reference/meson.build Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin-gtk/reference/meson.build Fri Aug 16 04:23:26 2019 +0000
@@ -3,6 +3,7 @@
# Header files or dirs to ignore when scanning. Use base file/dir names
+ 'gplugin-gtk-resources.h', ignore_hfiles += GPLUGIN_GTK_PRIVATE_HEADERS
@@ -11,12 +12,10 @@
'--deprecated-guards=GPLUGIN_GTK_DISABLE_DEPRECATED',
- '--ignore-headers=' + ' '.join(ignore_hfiles),
-# Extra options to supply to gtkdoc-mkdb.
- '--ignore-files=' + ' '.join(ignore_hfiles),
+ '--extra-dir', join_paths(meson.current_build_dir(), '../../gplugin/reference') gplugin_gtk_version_xml = configure_file(
@@ -31,9 +30,10 @@
main_xml : DOC_MODULE + '-docs.xml',
src_dir : gplugin_gtk_inc,
dependencies : gplugin_gtk_dep,
+ ignore_headers : ignore_hfiles,
gobject_typesfile : DOC_MODULE + '.types',
content_files : content_files,
+ fixxref_args : fixxref_args, --- a/gplugin/gplugin-loader.c Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/gplugin-loader.c Fri Aug 16 04:23:26 2019 +0000
@@ -20,6 +20,12 @@
#include <gplugin/gplugin-core.h>
+ * The standard _get_type macro for #GPluginLoader. * @Title: Plugin Loader Interface
* @Short_description: interface for loading plugins
@@ -28,6 +34,27 @@
* be able to use it to load plugins.
+ * An abstract data type that should not be accessed directly. + * @supported_extensions: The supported_extensions vfunc returns a #GList of + * file extensions that this loader supports without the + * leading dot. For example: 'so', 'dll', 'py', etc. + * @query: The query vfunc is called when the plugin manager needs to query a + * plugin that has a file extension from @supported_extensions. + * @load: The load vfunc is called when the plugin manager wants to load a + * plugin that was previously queried by this loader. + * @unload: The unload vfunc is called when the plugin manager wants to unload + * a previously loaded plugin from this loader. + * #GPluginLoader class defines the behavior for loading plugins. /******************************************************************************
*****************************************************************************/
--- a/gplugin/gplugin-loader.h Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/gplugin-loader.h Fri Aug 16 04:23:26 2019 +0000
@@ -34,15 +34,18 @@
#include <gplugin/gplugin-plugin.h>
struct _GPluginLoaderClass {
- GSList *(*supported_extensions)(const GPluginLoaderClass *klass);
+ GSList *(*supported_extensions)(GPluginLoaderClass *klass); GPluginPlugin *(*query)(GPluginLoader *loader, const gchar *filename, GError **error);
gboolean (*load)(GPluginLoader *loader, GPluginPlugin *plugin, GError **error);
gboolean (*unload)(GPluginLoader *loader, GPluginPlugin *plugin, GError **error);
--- a/gplugin/gplugin-native-loader.c Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/gplugin-native-loader.c Fri Aug 16 04:23:26 2019 +0000
@@ -39,6 +39,18 @@
+ * GPLUGIN_TYPE_NATIVE_LOADER: + * The standard _get_type macro for #GPluginNativeLoader. + * A #GPluginLoader subclass that is able to load native plugins. * GPLUGIN_NATIVE_PLUGIN_ABI_VERSION:
* The ABI version of the #GPluginNativeLoader. Your plugin should use this
--- a/gplugin/gplugin-native-plugin.c Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/gplugin-native-plugin.c Fri Aug 16 04:23:26 2019 +0000
@@ -35,6 +35,19 @@
+ * GPLUGIN_TYPE_NATIVE_PLUGIN: + * The standard _get_type macro for #GPluginNativePlugin. + * An instance of a loaded native plugin. A native plugin is a plugin that was + * compiled to machine native code, typically these are written in C/C++. /******************************************************************************
*****************************************************************************/
--- a/gplugin/gplugin-plugin-info.c Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/gplugin-plugin-info.c Fri Aug 16 04:23:26 2019 +0000
@@ -29,6 +29,25 @@
* #GPluginPluginInfo holds metadata for plugins.
+ * GPLUGIN_TYPE_PLUGIN_INFO: + * The standard _get_type macro for #GPluginPluginInfo. + * #GPluginPluginInfo holds all of the data about a plugin. It is created when + * GPluginPluginInfoClass: + * The class structure for #GPluginPluginInfo. /******************************************************************************
*****************************************************************************/
--- a/gplugin/gplugin-plugin-info.h Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/gplugin-plugin-info.h Fri Aug 16 04:23:26 2019 +0000
@@ -34,6 +34,7 @@
#include <gplugin/gplugin-version.h>
struct _GPluginPluginInfoClass {
GInitiallyUnownedClass gparent;
--- a/gplugin/gplugin-plugin.c Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/gplugin-plugin.c Fri Aug 16 04:23:26 2019 +0000
@@ -43,6 +43,26 @@
* The expected states of a plugin.
+ * The standard _get_type macro for #GPluginPlugin. + * #GPluginPlugin is an opaque data structure and should not be used directly. + * GPluginPluginInterface: + * @state_changed: The class closure for the #GPluginPlugin::state-changed signal. + * The interface that defines the behavior of plugins, including properties and /******************************************************************************
*****************************************************************************/
--- a/gplugin/gplugin-plugin.h Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/gplugin-plugin.h Fri Aug 16 04:23:26 2019 +0000
@@ -50,6 +50,7 @@
void (*state_changed)(GPluginPlugin *plugin, GPluginPluginState oldstate, GPluginPluginState newstate);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/reference/embedding.xml Fri Aug 16 04:23:26 2019 +0000
@@ -0,0 +1,54 @@
+<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ +<chapter id="chapter-embedding"> + <title>Embedding GPlugin</title> + <simplesect id="intro"> + You can embed GPlugin into any language that has GObject-Introspection + support, but in this example we're going to look at embedding GPlugin + into a C based project. + Using GPlugin is pretty simple and I'd like to think straight forward + since that's the way I designed it. + <simplesect id="initialization"> + During the start up of your application you need to add the following + <informalexample><programlisting> + /* Initialize the GPlugin library */ + /* Tell GPlugin to look for plugins in its default paths */ + gplugin_manager_add_default_paths(); + /* Optionally tell GPlugin to look for plugins in application specific + gplugin_manager_add_app_paths(PREFIX, "application"); + /* Once you're ready to find/load plugins call g_plugin_manager_refresh. + gplugin_manager_refresh(); + </programlisting></informalexample> + <simplesect id="shutdown"> + When your application is shutting down you need to uninitialize GPlugin + <informalexample><programlisting> + </programlisting></informalexample> \ No newline at end of file
--- a/gplugin/reference/gplugin-docs.xml Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/reference/gplugin-docs.xml Fri Aug 16 04:23:26 2019 +0000
@@ -19,6 +19,15 @@
+ <title>Tutorials</title> + <xi:include href="embedding.xml"/> + <xi:include href="native-plugins.xml"/> + <xi:include href="lua.xml"/> + <xi:include href="python.xml"/> <part id="object-hierarchy">
<title>Object Hierarchy</title>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/reference/lua.xml Fri Aug 16 04:23:26 2019 +0000
@@ -0,0 +1,56 @@
+<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ +<chapter id="chapter-lua"> + <title>Lua Plugins</title> + You <emphasis role="strong">MUST</emphasis> have the Lua loader + plugin installed and working as well as the gobject-introspection + package for GPlugin installed to use Lua plugins. + <title>Example Lua Plugin</title> + Like all plugins in GPlugin, Lua plugins must also implement + the <code>gplugin_query</code>, <code>gplugin_load</code>, and + <code>gplugin_unload</code> functions. + The following is a basic Lua plugin. + <informalexample><programlisting> + local lgi = require 'lgi' + local GPlugin = lgi.GPlugin + function gplugin_query() + return GPlugin.PluginInfo { + id = "gplugin-lua/basic-plugin", + abi_version = 0x01020304, + license_id = "license-id", + summary = "basic lua plugin", + description = "description of the basic lua plugin", + authors = { "Gary Kramlich <grim@reaperworld.com>" }, + website = "https://bitbucket.org/gplugin/gplugin/" + function gplugin_load(plugin) + function gplugin_unload(plugin) + </programlisting></informalexample> --- a/gplugin/reference/meson.build Wed Aug 14 05:55:03 2019 +0000
+++ b/gplugin/reference/meson.build Fri Aug 16 04:23:26 2019 +0000
@@ -2,13 +2,13 @@
# Header files or dirs to ignore when scanning. Use base file/dir names
'gplugin-loader-tests.h',
- 'gplugin-marshallers.h',
+ 'gplugin-native-private.h', - 'gplugin-native-private.h',
ignore_hfiles += GPLUGIN_PRIVATE_HEADERS
@@ -17,12 +17,6 @@
'--deprecated-guards=GPLUGIN_DISABLE_DEPRECATED',
- '--ignore-headers=' + ' '.join(ignore_hfiles),
-# Extra options to supply to gtkdoc-mkdb.
- '--ignore-files=' + ' '.join(ignore_hfiles),
gplugin_version_xml = configure_file(
@@ -31,15 +25,19 @@
configuration : version_conf)
main_xml : DOC_MODULE + '-docs.xml',
dependencies : gplugin_dep,
+ ignore_headers : ignore_hfiles,
gobject_typesfile : DOC_MODULE + '.types',
content_files : content_files,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/reference/native-plugins.xml Fri Aug 16 04:23:26 2019 +0000
@@ -0,0 +1,80 @@
+<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ +<chapter id="chapter-native-plugins"> + <title>Writing Native Plugins</title> + <simplesect id="intro"> + Writing Native plugins is very simple, but since it's C/C++ it's a bit + There are currently no C++ bindings and no intention to write them, but + the C API is still usable from C++. + <simplesect id="example"> + <informalexample><programlisting> + #include <gplugin.h> + #include <gplugin-native.h> + /* gplugin_plugin_query is called by the native loader to determine if + * the plugin is loadable. It must have this signature and should + * return a valid GPluginPluginInfo if everything is fine. If something + * went wrong, error should be set to a valid GError and NULL should be + G_MODULE_EXPORT GPluginPluginInfo * + gplugin_plugin_query(GError **error) { + /* Authors is a list of authors of the plugin. Generally these are + * in the "Name Surname <user@domain.com>" format. + const gchar * const authors[] = { + /* gplugin_plugin_info_new only requires that the id be set, and the + * rest are here for demonstration purposes. + return gplugin_plugin_info_new( + "gplugin/basic-native-plugin", + GPLUGIN_NATIVE_PLUGIN_ABI_VERSION, + "description", "description", + /* gplugin_plugin_load is called by the loader when the plugin should + * be loaded. It must have this exact signature and return TRUE if + * loading was successful, otherwise it should return FALSE with error + * set to a valid GError. + G_MODULE_EXPORT gboolean + gplugin_plugin_load(GPluginNativePlugin *plugin, GError **error) { + /* gplugin_plugin_unload is called by the loader when the plugin should + * be unloaded. It must have this exact signature and should return TRUE + * if unloading was successful, otherwise it should return FALSE with + * error set to a valid GError. + G_MODULE_EXPORT gboolean + gplugin_plugin_unload(GPluginNativePlugin *plugin, GError **error) { + </programlisting></informalexample> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/reference/python.xml Fri Aug 16 04:23:26 2019 +0000
@@ -0,0 +1,56 @@
+<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ +<chapter id="chapter-python"> + <title>Python Plugins</title> + You <emphasis role="strong">MUST</emphasis> have the Python loader + plugin installed and working as well as the gobject-introspection + package for GPlugin installed to use Python plugins. + <title>Example Python Plugin</title> + Like all plugins in GPlugin, Python plugins must also implement + the <code>gplugin_query</code>, <code>gplugin_load</code>, and + <code>gplugin_unload</code> functions. + The following is a basic Python plugin. + <informalexample><programlisting> + gi.require_version('GPlugin', '0.0') + from gi.repository import GPlugin + def gplugin_plugin_query(): + return GPlugin.PluginInfo( + id='gplugin-python/basic-plugin', + abi_version=0x01020304, + description='description', + def gplugin_plugin_load(plugin): + def gplugin_plugin_unload(plugin): + </programlisting></informalexample> --- a/meson.build Wed Aug 14 05:55:03 2019 +0000
+++ b/meson.build Fri Aug 16 04:23:26 2019 +0000
@@ -110,6 +110,6 @@
###############################################################################
-install_data('ChangeLog', 'INSTALL', 'README', 'HACKING',
+install_data('ChangeLog', 'INSTALL.md', 'README.md', 'HACKING', install_dir : join_paths(get_option('datadir'), 'doc', 'gplugin'))
--- a/packaging/gplugin.spec.in Wed Aug 14 05:55:03 2019 +0000
+++ b/packaging/gplugin.spec.in Fri Aug 16 04:23:26 2019 +0000
@@ -195,7 +195,7 @@
+%doc README.md ChangeLog %{_mandir}/man1/gplugin-query.1*
@@ -206,7 +206,7 @@
%{_datadir}/gir-1.0/GPlugin-0.0.gir
%{_datadir}/gtk-doc/html/gplugin/
%{_includedir}/gplugin-1.0/
@@ -218,7 +218,7 @@
%{_bindir}/gplugin-gtk-viewer
%{_libdir}/libgplugin-gtk.so.0.1.0
%{_mandir}/man1/gplugin-gtk-viewer.1*
@@ -226,7 +226,7 @@
%dir %{_datadir}/glade/catalogs/
%{_datadir}/gir-1.0/GPluginGtk-0.0.gir
%{_datadir}/glade/catalogs/gplugin-gtk.xml
%{_datadir}/gtk-doc/html/gplugin-gtk/
@@ -236,25 +236,25 @@
%{_libdir}/gplugin/gplugin-lua.so
%{_libdir}/gplugin/gplugin-python.so
%{_datadir}/vala/vapi/gplugin.vapi
%{_datadir}/vala/vapi/gplugin.deps
%{_datadir}/vala/vapi/gplugin-gtk.vapi
%{_datadir}/vala/vapi/gplugin-gtk.deps