Top |
GsPluginData * | gs_plugin_alloc_data () |
GsPluginData * | gs_plugin_get_data () |
const gchar * | gs_plugin_get_name () |
gboolean | gs_plugin_get_enabled () |
void | gs_plugin_set_enabled () |
gboolean | gs_plugin_has_flags () |
guint | gs_plugin_get_scale () |
const gchar * | gs_plugin_get_locale () |
AsProfile * | gs_plugin_get_profile () |
SoupSession * | gs_plugin_get_soup_session () |
void | gs_plugin_add_rule () |
GBytes * | gs_plugin_download_data () |
gboolean | gs_plugin_download_file () |
gboolean | gs_plugin_check_distro_id () |
GsApp * | gs_plugin_cache_lookup () |
void | gs_plugin_cache_add () |
void | gs_plugin_cache_invalidate () |
void | gs_plugin_status_update () |
gboolean | gs_plugin_app_launch () |
void | gs_plugin_updates_changed () |
const gchar * | gs_plugin_status_to_string () |
#define | GS_TYPE_PLUGIN |
struct | GsPluginClass |
typedef | GsPluginData |
enum | GsPluginStatus |
enum | GsPluginFlags |
enum | GsPluginError |
enum | GsPluginRefineFlags |
enum | GsPluginRefreshFlags |
enum | GsPluginRule |
#define | GS_PLUGIN_ERROR |
GsPlugin |
Plugins are modules that are loaded at runtime to provide information about requests and to service user actions like installing, removing and updating. This allows different distributions to pick and choose how the application installer gathers data.
Plugins also have a priority system where the largest number gets run first. That means if one plugin requires some property or metadata set by another plugin then it **must** depend on the other plugin to be run in the correct order.
As a general rule, try to make plugins as small and self-contained as possible and remember to cache as much data as possible for speed. Memory is cheap, time less so.
GsPluginData * gs_plugin_alloc_data (GsPlugin *plugin
,gsize sz
);
Allocates a private data area for the plugin which can be retrieved
using gs_plugin_get_data()
.
This is normally called in gs_plugin_initialize()
and the data should
not be manually freed.
GsPluginData *
gs_plugin_get_data (GsPlugin *plugin
);
Gets the private data for the plugin if gs_plugin_alloc_data()
has
been called.
gboolean
gs_plugin_get_enabled (GsPlugin *plugin
);
Gets if the plugin is enabled.
void gs_plugin_set_enabled (GsPlugin *plugin
,gboolean enabled
);
Enables or disables a plugin.
This is normally only called from gs_plugin_initialize()
.
gboolean gs_plugin_has_flags (GsPlugin *plugin
,GsPluginFlags flags
);
Finds out if a plugin has a specific flag set.
const gchar *
gs_plugin_get_locale (GsPlugin *plugin
);
Gets the user locale.
AsProfile *
gs_plugin_get_profile (GsPlugin *plugin
);
Gets the profile object to be used for the plugin. This can be used to make plugin actions appear in the global profile output.
SoupSession *
gs_plugin_get_soup_session (GsPlugin *plugin
);
Gets the soup session that plugins can use when downloading.
void gs_plugin_add_rule (GsPlugin *plugin
,GsPluginRule rule
,const gchar *name
);
If the plugin name is found, the rule will be used to sort the plugin list,
for example the plugin specified by name
will be ordered after this plugin
when GS_PLUGIN_RULE_RUN_AFTER
is used.
NOTE: The depsolver is iterative and may not solve overly-complicated rules; If depsolving fails then gnome-software will not start.
plugin |
a GsPlugin |
|
rule |
a GsPluginRule, e.g. |
|
name |
a plugin name, e.g. "appstream" |
GBytes * gs_plugin_download_data (GsPlugin *plugin
,GsApp *app
,const gchar *uri
,GCancellable *cancellable
,GError **error
);
Downloads data.
gboolean gs_plugin_download_file (GsPlugin *plugin
,GsApp *app
,const gchar *uri
,const gchar *filename
,GCancellable *cancellable
,GError **error
);
Downloads data and saves it to a file.
gboolean gs_plugin_check_distro_id (GsPlugin *plugin
,const gchar *distro_id
);
Checks if the distro is compatible.
GsApp * gs_plugin_cache_lookup (GsPlugin *plugin
,const gchar *key
);
Looks up an application object from the per-plugin cache
void gs_plugin_cache_add (GsPlugin *plugin
,const gchar *key
,GsApp *app
);
Adds an application to the per-plugin cache. This is optional, and the plugin can use the cache however it likes.
void
gs_plugin_cache_invalidate (GsPlugin *plugin
);
Invalidate the per-plugin cache by marking all entries as invalid. This is optional, and the plugin can evict the cache whenever it likes.
void gs_plugin_status_update (GsPlugin *plugin
,GsApp *app
,GsPluginStatus status
);
Update the state of the plugin so any UI can be updated.
gboolean gs_plugin_app_launch (GsPlugin *plugin
,GsApp *app
,GError **error
);
Launches the application using GAppInfo.
void
gs_plugin_updates_changed (GsPlugin *plugin
);
Emit a signal that tells the plugin loader that the list of updates may have changed.
const gchar *
gs_plugin_status_to_string (GsPluginStatus status
);
Converts the GsPluginStatus enum to a string.
struct GsPluginClass { GObjectClass parent_class; void (*updates_changed) (GsPlugin *plugin); void (*status_changed) (GsPlugin *plugin, GsApp *app, guint status); gpointer padding[29]; };
The ststus of the plugin.
The failure error types.
The refine flags.
No explicit flags set |
||
Get the historical view |
||
Require the license |
||
Require the URL |
||
Require the long description |
||
Require the installed and download sizes |
||
Require the rating |
||
Require the version |
||
Require the history |
||
Require enough to install or remove the package |
||
Require update details |
||
Require the origin |
||
Require related packages |
||
Require the menu path |
||
Require available addons |
||
Allow packages to be returned |
||
Require update severity |
||
Require distro upgrades |
||
Require the provenance |
||
Require user-reviews |
||
Require user-ratings |
||
Require the key colors |
||
Require the icon to be loaded |
The flags used for refresh. Regeneration and downloading is only
done if the cache is older than the cache_age
.
The GS_PLUGIN_REFRESH_FLAGS_METADATA
can be used to make sure
there's enough metadata to start the application.
The GS_PLUGIN_REFRESH_FLAGS_PAYLOAD
flag should only be used when
the session is idle and bandwidth is unmetered as the amount of data
and IO may be large.
The rules used for ordering plugins.
Plugins are expected to add rules in gs_plugin_initialize()
.