gplugin/gplugin

Finish converting the wiki to gtk-doc
bugfix/docs-cleanup
2019-08-15, Gary Kramlich
7bf98249aa24
Parents 40c577e88f51
Children 936498b316f1
Finish converting the wiki to gtk-doc
--- a/gplugin/reference/gplugin-docs.xml Thu Aug 15 20:49:42 2019 -0500
+++ b/gplugin/reference/gplugin-docs.xml Thu Aug 15 21:56:36 2019 -0500
@@ -23,7 +23,9 @@
<title>Tutorials</title>
<xi:include href="embedding.xml"/>
+ <xi:include href="lua.xml"/>
<xi:include href="native-plugins.xml"/>
+ <xi:include href="python.xml"/>
</part>
<part id="object-hierarchy">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/reference/lua.xml Thu Aug 15 21:56:36 2019 -0500
@@ -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>
+
+ <warning>
+ <para>
+ 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.
+ </para>
+ </warning>
+
+ <simplesect>
+ <title>Example Lua Plugin</title>
+
+ <para>
+ 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.
+ </para>
+
+ <para>
+ 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,
+ name = "basic plugin",
+ category = "test",
+ version = "0.0.10",
+ license_id = "license-id",
+ summary = "basic lua plugin",
+ description = "description of the basic lua plugin",
+ authors = { "Gary Kramlich &lt;grim@reaperworld.com&gt;" },
+ website = "http://bitbucket.org/gplugin/main/"
+ }
+ end
+
+ function gplugin_load(plugin)
+ return true
+ end
+
+ function gplugin_unload(plugin)
+ return true
+ end
+ </programlisting></informalexample>
+ </para>
+ </simplesect>
+</chapter>
--- a/gplugin/reference/meson.build Thu Aug 15 20:49:42 2019 -0500
+++ b/gplugin/reference/meson.build Thu Aug 15 21:56:36 2019 -0500
@@ -17,12 +17,6 @@
'--deprecated-guards=GPLUGIN_DISABLE_DEPRECATED',
'--rebuild-types',
'--rebuild-sections',
- '--ignore-headers=' + ' '.join(ignore_hfiles),
-]
-
-# Extra options to supply to gtkdoc-mkdb.
-mkdb_args = [
- '--ignore-files=' + ' '.join(ignore_hfiles),
]
gplugin_version_xml = configure_file(
@@ -31,15 +25,19 @@
configuration : version_conf)
content_files = [
+ 'embedding.xml',
+ 'lua.xml',
+ 'native-plugins.xml',
+ 'python.xml',
]
gnome.gtkdoc(DOC_MODULE,
main_xml : DOC_MODULE + '-docs.xml',
src_dir : gplugin_inc,
dependencies : gplugin_dep,
+ ignore_headers : ignore_hfiles,
install : true,
scan_args : scan_args,
- mkdb_args : mkdb_args,
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 Thu Aug 15 21:56:36 2019 -0500
@@ -0,0 +1,79 @@
+<?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">
+ <para>
+ Writing Native plugins is like most other GPlugin Plugins very simple,
+ but since it's C/C++ it's a bit more complicated.
+ </para>
+
+ <para>
+ There are currently no C++ bindings and no intention to write them.
+ </para>
+ </simplesect>
+
+ <simplesect id="example">
+ <para>
+ <informalexample><programlisting>
+ #include &lt;gplugin.h&gt;
+ #include &lt;gplugin-native.h&gt;
+
+ /* 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
+ * returned.
+ */
+ 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 &lt;user@domain.com&gt;" format.
+ */
+ const gchar * const authors[] = {
+ "author",
+ NULL
+ };
+
+ /* 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,
+ "name", "name",
+ "version", "version",
+ "summary", "summary",
+ "description", "description",
+ "authors", authors,
+ "website", "website",
+ NULL
+ );
+ }
+
+ /* 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) {
+ return TRUE;
+ }
+
+ /* 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) {
+ return TRUE;
+ }
+ </programlisting></informalexample>
+ </para>
+ </simplesect>
+</chapter>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/reference/python.xml Thu Aug 15 21:56:36 2019 -0500
@@ -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>
+
+ <warning>
+ <para>
+ 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.
+ </para>
+ </warning>
+
+ <simplesect>
+ <title>Example Python Plugin</title>
+
+ <para>
+ 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.
+ </para>
+
+ <para>
+ The following is a basic Python plugin.
+ <informalexample><programlisting>
+ import gi
+
+ 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,
+ name='basic plugin',
+ authors=['author1'],
+ category='test',
+ version='version',
+ license_id='license',
+ summary='summary',
+ website='website',
+ description='description',
+ )
+
+ def gplugin_plugin_load(plugin):
+ return True
+
+
+ def gplugin_plugin_unload(plugin):
+ return True
+ </programlisting></informalexample>
+ </para>
+ </simplesect>
+</chapter>