Make plugin activation and deactivation async and throw errors

This makes plugin implementation substatially less verbose.
This commit is contained in:
Michael Gratton 2020-03-11 12:09:43 +11:00 committed by Michael James Gratton
parent 154bb2d2c5
commit df7889d732
5 changed files with 166 additions and 123 deletions

View file

@ -27,10 +27,21 @@ public abstract class Plugin.PluginBase : Geary.BaseObject {
get; construct;
}
/** Invoked to activate the plugin, after loading. */
public abstract void activate();
/**
* Invoked to activate the plugin, after loading.
*
* If this method raises an error, it will be unloaded without
* deactivating.
*/
public abstract async void activate() throws GLib.Error;
/** Invoked to deactivate the plugin, prior to unloading */
public abstract void deactivate(bool is_shutdown);
/**
* Invoked to deactivate the plugin, prior to unloading.
*
* If `is_shutdown` is true, the plugin is being unloaded because
* the client application is quitting. Otherwise, the plugin is
* being unloaded at end-user request.
*/
public abstract async void deactivate(bool is_shutdown) throws GLib.Error;
}