gplugin/gplugin

Split plugin details into a separate page

20 months ago, Elliott Sales de Andrade
fcd52dc4273e
Split plugin details into a separate page

This modifies the `GPluginGtkView` into a stack, showing the list of plugins by default (called the 'overview'), or a page for a specific plugin. Going back and forth is automated, but an application can request the page for a plugin directly if needed.

The plugin row no longer expands to show details or shows a config button, but its activation goes to its own page now. This also makes each row a bit more balanced vertically, since there's no `GtkRevealer` taking up invisible space underneath.

The new plugin page is _mostly_ a copy of the previous plugin row, except:

* It's always expanded (or rather, it cannot be collapsed.)
* The main details are re-arranged a bit to fit nicely on a page.
* All information is found via `GtkExpression`s.
* Instead of separate labels for each author/dependency, these are now a single newline-separated label, which is easier to generate.
* Booleans display a check mark instead of text, like in the inspector.
* Information labels are selectable and have a `labelled-by` relation.
* The error message is allowed to wrap.

Settings, once implemented, can go at the end of this page.

I debated splitting the plugin info into a stack with 'important' vs 'developer-oriented' entries (somewhat how `GtkAboutDialog` splits its information), but that can go in a separate review if it's done.

NOTE: This deletes the `expanded` property from `GPluginGtkPluginRow`; that's probably an ABI break, though /r/1834 means it was never registered in a released version.

Testing Done:
Opened the separate page of a few plugins, and saw that details were available. Also, the switch was in sync with the switch in the overview.

Reviewed at https://reviews.imfreedom.org/r/1840/
Title: Vala Plugin Example
Slug: vala
## Vala Plugins
> You **MUST** have the Vala bindings installed on your system for this to
> work. They are built by the default GPlugin build.
### Example Vala Plugin
Due to the way `GPlugin.PluginInfo` info works, you must subclass it and set
your values in the new constructor. It is recommended that you define this
class in a namespace to avoid collisions with other plugins.
Like all plugins in GPlugin, Vala plugins must also implement the
`gplugin_query`, `gplugin_load`, and `gplugin_unload` functions. These
functions must be in the global namespace.
The following is a basic Vala plugin.
```vala
using GPlugin;
namespace BasicPlugin {
/* 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 {
public Info() {
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"
);
}
}
}
/* 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) {
error = null;
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) {
error = null;
return true;
}
/* 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
* true.
*
* 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
* honored.
*/
public bool gplugin_unload(GPlugin.Plugin plugin, bool shutdown, out Error error) {
error = null;
return true;
}
```