Top | ![]() |
![]() |
![]() |
![]() |
GQuark | gs_plugin_error_quark () |
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 () |
void | gs_plugin_add_flags () |
void | gs_plugin_remove_flags () |
guint | gs_plugin_get_scale () |
const gchar * | gs_plugin_get_locale () |
const gchar * | gs_plugin_get_language () |
AsProfile * | gs_plugin_get_profile () |
SoupSession * | gs_plugin_get_soup_session () |
void | gs_plugin_add_auth () |
GsAuth * | gs_plugin_get_auth_by_id () |
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_remove () |
void | gs_plugin_cache_invalidate () |
void | gs_plugin_status_update () |
gboolean | gs_plugin_app_launch () |
void | gs_plugin_updates_changed () |
void | gs_plugin_reload () |
const gchar * | gs_plugin_status_to_string () |
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.
Since: 3.22
GsPluginData *
gs_plugin_get_data (GsPlugin *plugin
);
Gets the private data for the plugin if gs_plugin_alloc_data()
has
been called.
Since: 3.22
const gchar *
gs_plugin_get_name (GsPlugin *plugin
);
Gets the plugin name.
Since: 3.22
gboolean
gs_plugin_get_enabled (GsPlugin *plugin
);
Gets if the plugin is enabled.
Since: 3.22
void gs_plugin_set_enabled (GsPlugin *plugin
,gboolean enabled
);
Enables or disables a plugin.
This is normally only called from gs_plugin_initialize()
.
Since: 3.22
gboolean gs_plugin_has_flags (GsPlugin *plugin
,GsPluginFlags flags
);
Finds out if a plugin has a specific flag set.
Since: 3.22
void gs_plugin_add_flags (GsPlugin *plugin
,GsPluginFlags flags
);
Adds specific flags to the plugin.
Since: 3.22
void gs_plugin_remove_flags (GsPlugin *plugin
,GsPluginFlags flags
);
Removes specific flags from the plugin.
Since: 3.22
guint
gs_plugin_get_scale (GsPlugin *plugin
);
Gets the window scale factor.
Since: 3.22
const gchar *
gs_plugin_get_locale (GsPlugin *plugin
);
Gets the user locale.
Since: 3.22
const gchar *
gs_plugin_get_language (GsPlugin *plugin
);
Gets the user language from the locale.
Since: 3.22
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.
Since: 3.22
SoupSession *
gs_plugin_get_soup_session (GsPlugin *plugin
);
Gets the soup session that plugins can use when downloading.
Since: 3.22
void gs_plugin_add_auth (GsPlugin *plugin
,GsAuth *auth
);
Adds an authentication object that can be used for all the plugins.
Since: 3.22
GsAuth * gs_plugin_get_auth_by_id (GsPlugin *plugin
,const gchar *provider_id
);
Gets a specific authentication object.
Since: 3.22
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" |
Since: 3.22
GBytes * gs_plugin_download_data (GsPlugin *plugin
,GsApp *app
,const gchar *uri
,GCancellable *cancellable
,GError **error
);
Downloads data.
Since: 3.22
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.
Since: 3.22
gboolean gs_plugin_check_distro_id (GsPlugin *plugin
,const gchar *distro_id
);
Checks if the distro is compatible.
Since: 3.22
GsApp * gs_plugin_cache_lookup (GsPlugin *plugin
,const gchar *key
);
Looks up an application object from the per-plugin cache
Since: 3.22
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.
Since: 3.22
void gs_plugin_cache_remove (GsPlugin *plugin
,const gchar *key
);
Removes an application from the per-plugin cache.
Since: 3.22
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. Using this function may mean the front-end and the plugin may be operating on a different GsApp with the same cache ID.
Most plugins do not need to call this funtion; if a suitable cache key is being used the old cache item can remain.
Since: 3.22
void gs_plugin_status_update (GsPlugin *plugin
,GsApp *app
,GsPluginStatus status
);
Update the state of the plugin so any UI can be updated.
Since: 3.22
gboolean gs_plugin_app_launch (GsPlugin *plugin
,GsApp *app
,GError **error
);
Launches the application using GAppInfo.
Since: 3.22
void
gs_plugin_updates_changed (GsPlugin *plugin
);
Emit a signal that tells the plugin loader that the list of updates may have changed.
Since: 3.22
void
gs_plugin_reload (GsPlugin *plugin
);
Plugins that call this function should expect that all panels will reload after a small delay, causing mush flashing, wailing and gnashing of teeth.
Plugins should not call this unless absolutely required.
Since: 3.22
const gchar *
gs_plugin_status_to_string (GsPluginStatus status
);
Converts the GsPluginStatus enum to a string.
Since: 3.22
struct GsPluginClass { GObjectClass parent_class; void (*updates_changed) (GsPlugin *plugin); void (*status_changed) (GsPlugin *plugin, GsApp *app, guint status); void (*reload) (GsPlugin *plugin); gpointer padding[28]; };
The ststus of the plugin.
The failure error types.
Generic failure |
||
Action not supported |
||
Action was cancelled |
||
No network connection available |
||
Security policy forbid action |
||
No disk space to allow action |
||
Authentication was required |
||
Provided authentication was invalid |
||
PIN required for authentication |
||
User account has been suspended |
||
User account has been deactivated |
||
The plugins installed are incompatible |
||
The download action failed |
||
The save-to-disk failed |
||
The data format is invalid |
||
The delete action failed |
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION (1u << 3)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION (1u << 8)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS (1u << 9)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH (1u << 12)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_SEVERITY (1u << 15)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPGRADE_REMOVED (1u << 16)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE (1u << 17)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS (1u << 19)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_KEY_COLORS (1u << 20)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS (1u << 22)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME (1u << 23)
#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI (1u << 24)
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()
.