<?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-genie">
	<title>Genie Plugins</title>

	<warning>
		<para>
			You <emphasis role="strong">MUST</emphasis> have the Vala bindings
			installed on your system for this to work.  They are built by the
			default GPlugin build.
		</para>
	</warning>

	<simplesect>
		<title>Example Genie Plugin</title>

		<para>
			Like all plugins in GPlugin, Genie plugins must also implement
			the <code>gplugin_query</code>, <code>gplugin_load</code>, and
			<code>gplugin_unload</code> functions.
		</para>

		<para>
			Due to the way <code>GPlugin.PluginInfo</code> info works, you must
			subclass it and set your values in the new constructor.
		</para>

		<para>
			The following is a basic Genie plugin.
		</para>

		<informalexample><programlisting>
		uses GPlugin

		class BasicPluginInfo : GPlugin.PluginInfo
			construct()
				authors : array of string = {"author1"}

				Object(
					id: "gplugin/genie-basic-plugin",
					abi_version: 0x01020304,
					name: "basic plugin",
					authors: authors,
					category: "test",
					version: "version",
					license_id: "license",
					summary: "summary",
					website: "website",
					description: "description"
				)

		def gplugin_query(out error : Error) : GPlugin.PluginInfo
			error = null

			return new BasicPluginInfo()

		def gplugin_load(plugin : GPlugin.Plugin, out error : Error) : bool
			error = null

			return true

		def gplugin_unload(plugin : GPlugin.Plugin, out error : Error) : bool
			error = null

			return true
		</programlisting></informalexample>
	</simplesect>
</chapter>
