Better document the example plugins and cover the shutdown parameter to unload
Testing Done:
Ran `codespell`
Reviewed at https://reviews.imfreedom.org/r/1694/
--- a/gplugin/reference/genie.md Mon Aug 29 22:00:31 2022 -0500
+++ b/gplugin/reference/genie.md Tue Aug 30 02:13:47 2022 -0500
@@ -21,6 +21,9 @@
+/* You need to create a class for your plugin info. This is pretty simple as you + * can see in the example below. class Info : GPlugin.PluginInfo
@@ -39,17 +42,36 @@
description: "description"
+/* gplugin_query is called when searching for plugins. The function should + * return an instance of the PluginInfo class you created above. If something + * went wrong, you can set error with an error message. def gplugin_query(out error : Error) : GPlugin.PluginInfo
return new BasicPlugin.Info()
+/* gplugin_load is called when your plugin is loaded in the application. If + * something isn't quite right, you can return false and optionally set error, + * to signify that something went wrong and stop your plugin from being loaded. def gplugin_load(plugin : GPlugin.Plugin, out error : Error) : bool
-def gplugin_unload(plugin : GPlugin.Plugin, out error : Error) : bool
+/* gplugin_plugin_unload is called when your plugin is unloaded in the + * application. The shutdown parameter tells your plugin whether or not the + * application is shutting down. For example, if a user unloads your plugin, + * shutdown will be false, but if the program is shutting down, shutdown will be + * If something went wrong with the unload or the plugin isn't ready to be + * unloaded, you can return false, and optionally set error, here to stop it + * from being unloaded. Note if shutdown is true, the return value is not +def gplugin_unload(plugin : GPlugin.Plugin, shutdown: bool, out error : Error) : bool --- a/gplugin/reference/lua.md Mon Aug 29 22:00:31 2022 -0500
+++ b/gplugin/reference/lua.md Tue Aug 30 02:13:47 2022 -0500
@@ -17,6 +17,8 @@
local lgi = require "lgi"
local GPlugin = lgi.GPlugin
+-- gplugin_plugin_query is called when searching for plugins. The only thing +-- this function should do, is return a GPlugin.PluginInfo instance. return GPlugin.PluginInfo {
id = "gplugin-lua/basic-plugin",
@@ -32,11 +34,23 @@
+-- gplugin_load is called when your plugin is loaded in the application. If +-- something isn't quite right, you can return false or call error() to signify +-- that something went wrong and stop your plugin from being loaded. function gplugin_load(plugin)
-function gplugin_unload(plugin)
+-- gplugin_plugin_unload is called when your plugin is unloaded in the +-- application. The shutdown parameter tells your plugin whether or not the +-- application is shutting down. For example, if a user unloads your plugin, +-- shutdown will be false, but if the program is shutting down, shutdown will be +-- If something went wrong with the unload or the plugin isn't ready to be +-- unloaded, you can return false here to stop it from being unloaded. Note if +-- shutdown is true, the return value is not honored. +function gplugin_unload(plugin, shutdown) --- a/gplugin/reference/native-plugins.md Mon Aug 29 22:00:31 2022 -0500
+++ b/gplugin/reference/native-plugins.md Tue Aug 30 02:13:47 2022 -0500
@@ -63,9 +63,15 @@
* g_set_error() and return %FALSE. This function needs to match the signature
* of GPluginNativePluginUnloadFunc, and it will be passed to
* GPLUGIN_NATIVE_PLUGIN_DECLARE which will export it properly.
+ * The shutdown parameter is set to TRUE when the application is shutting down. + * This is useful if you're using a library where you can only initialize it + * once. In this case, you'd typically always return FALSE here, but with the + * shutdown parameter, you can return FALSE when shutdown is FALSE, but then + * properly uninitialize the library when shutdown is TRUE. -gplugin_native_basic_plugin_unload(GPluginPlugin *plugin, GError *error) {
+gplugin_native_basic_plugin_unload(GPluginPlugin *plugin, gboolean shutdown, GError *error) { --- a/gplugin/reference/perl5.md Mon Aug 29 22:00:31 2022 -0500
+++ b/gplugin/reference/perl5.md Tue Aug 30 02:13:47 2022 -0500
@@ -20,6 +20,8 @@
Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin");
+# gplugin_plugin_query is called when searching for plugins. The only thing this +# function should do, is return a GPlugin.PluginInfo instance. return GPlugin::PluginInfo->new(
id => "gplugin/perl5-basic-plugin",
@@ -35,11 +37,27 @@
+# gplugin_plugin_load is called when your plugin is loaded in the application. +# If something isn't quite right, you can return non zero or call die() to +# signify that something went wrong and stop your plugin from being loaded. +# gplugin_plugin_unload is called when your plugin is unloaded in the +# application. The shutdown parameter tells your plugin whether or not the +# application is shutting down. For example, if a user unloads your plugin, +# shutdown will be 1, but if the program is shutting down, shutdown will be 0. +# If something went wrong with the unload or the plugin isn't ready to be +# unloaded you can return 1 here to stop it from being unloaded. Note if +# shutdown is 0, the return value is not honored. --- a/gplugin/reference/python3.md Mon Aug 29 22:00:31 2022 -0500
+++ b/gplugin/reference/python3.md Tue Aug 30 02:13:47 2022 -0500
@@ -20,6 +20,8 @@
gi.require_version("GPlugin", "0.0")
from gi.repository import GPlugin
+# gplugin_plugin_query is called when searching for plugins. The only thing this +# function should do, is return a GPlugin.PluginInfo instance. def gplugin_plugin_query():
return GPlugin.PluginInfo(
id="gplugin-python/basic-plugin",
@@ -34,10 +36,22 @@
description="description",
+# gplugin_plugin_load is called when your plugin is loaded in the application. +# If something isn't quite right, you can return False or throw an exception to +# signify that something went wrong and stop your plugin from being loaded. def gplugin_plugin_load(plugin):
-def gplugin_plugin_unload(plugin):
+# gplugin_plugin_unload is called when your plugin is unloaded in the +# application. The shutdown parameter tells your plugin whether or not the +# application is shutting down. For example, if a user unloads your plugin, +# shutdown will be False, but if the program is shutting down, shutdown will be +# If something went wrong with the unload or the plugin isn't ready to be +# unloaded, you can return False here to stop it from being unloaded. Note if +# shutdown is True, the return value is not honored. +def gplugin_plugin_unload(plugin, shutdown): --- a/gplugin/reference/vala.md Mon Aug 29 22:00:31 2022 -0500
+++ b/gplugin/reference/vala.md Tue Aug 30 02:13:47 2022 -0500
@@ -23,6 +23,9 @@
+/* You need to create a class for your plugin info. This is pretty simple as you + * can see in the example below. public class Info : GPlugin.PluginInfo {
string[] authors = {"author1"};
@@ -44,18 +47,37 @@
+/* gplugin_query is called when searching for plugins. The function should + * return an instance of the PluginInfo class you created above. If something + * went wrong, you can set error with an error message. public GPlugin.PluginInfo gplugin_query(out Error error) {
return new BasicPlugin.Info();
+/* gplugin_load is called when your plugin is loaded in the application. If + * something isn't quite right, you can return false and optionally set error, + * to signify that something went wrong and stop your plugin from being loaded. public bool gplugin_load(GPlugin.Plugin plugin, out Error error) {
+/* gplugin_plugin_unload is called when your plugin is unloaded in the + * application. The shutdown parameter tells your plugin whether or not the + * application is shutting down. For example, if a user unloads your plugin, + * shutdown will be false, but if the program is shutting down, shutdown will be + * If something went wrong with the unload or the plugin isn't ready to be + * unloaded, you can return false, and optionally set error, here to stop it + * from being unloaded. Note if shutdown is true, the return value is not public bool gplugin_unload(GPlugin.Plugin plugin, out Error error) {