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: Native Plugins
Slug: native
## Native Plugins
Writing Native plugins is pretty simple, but since it's C/C++ it's a bit more
complicated.
There are currently no C++ bindings and no intention to write them, but the C
API is still usable from C++.
```c
#include <gplugin.h>
#include <gplugin-native.h>
/* This function is called by the native plugin loader to get information about
* the plugin. It returns a #GPluginPluginInfo instance that describes the
* plugin. If anything goes wrong during this function, @error should be set
* via g_set_error() and %NULL should be returned. It must match the
* signature of GPluginNativePluginQueryFunc, and it will be passed to
* GPLUGIN_NATIVE_PLUGIN_DECLARE which will export it properly.
*/
static GPluginPluginInfo *
gplugin_native_basic_plugin_query(GError **error) {
/* Authors is a list of authors who worked on the plugin. Generally
* these are in the "Name Surname <user@domain.com>" format.
*/
const gchar * const authors[] = {
"Author O <author@example.com>",
NULL
};
/* gplugin_plugin_info_new only requires that the id be set, and the
* rest are here for demonstration purposes.
*/
return gplugin_plugin_info_new(
"gplugin/native-basic-plugin",
GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
"name", "name",
"version", "version",
"summary", "summary",
"description", "description",
"authors", authors,
"website", "website",
NULL);
}
/* This function is called by the native plugin loader when the plugin should
* be loaded. It should do any setup that the plugin requires and return %TRUE
* if everything was successful. If not, it should set @error with
* g_set_error() and return %FALSE. This function needs to match the
* signature of GPluginNativePluginLoadFunc, and it will be passed to
* GPLUGIN_NATIVE_PLUGIN_DECLARE which will export it properly.
*/
static gboolean
gplugin_native_basic_plugin_load(GPluginPlugin *plugin, GError **error) {
return TRUE;
}
/* This function is called by the native plugin loader when the plugin should
* be unloaded. It should do any clean up that the plugin requires and return
* %TRUE if everything was successful. If not, it should set @error with
* 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.
*/
static gboolean
gplugin_native_basic_plugin_unload(GPluginPlugin *plugin, gboolean shutdown, GError *error) {
return TRUE;
}
/* This macro does the heavy lifting of making sure to export all of the
* symbols correctly as well as add some future proofing for features like
* statically linking plugins. It is highly recommended to use this macro
* instead of manually exporting the symbols yourself.
*/
GPLUGIN_NATIVE_PLUGIN_DECLARE(gplugin_native_basic_plugin)
```