<?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-vala">
	<title>Vala 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
			default.
		</para>
	</warning>

	<simplesect>
		<title>Example Vala Plugin</title>

		<para>
			Like all plugins in GPlugin, Vala 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 Vala plugin.
		</para>

		<informalexample><programlisting>
		using GPlugin;

		public class BasicPluginInfo : GPlugin.PluginInfo {
			public BasicPluginInfo() {
				string[] authors = {"author1"};

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

		public GPlugin.PluginInfo gplugin_query(out Error error) {
			error = null;

			return new BasicPluginInfo();
		}

		public bool gplugin_load(GPlugin.Plugin plugin, out Error error) {
			error = null;

			return true;
		}

		public bool gplugin_unload(GPlugin.Plugin plugin, out Error error) {
			error = null;

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