gs-plugin-loader

gs-plugin-loader

Functions

GsPluginLoader * gs_plugin_loader_new ()
void gs_plugin_loader_job_process_async ()
GsAppList * gs_plugin_loader_job_process_finish ()
gboolean gs_plugin_loader_job_action_finish ()
void gs_plugin_loader_setup_async ()
gboolean gs_plugin_loader_setup_finish ()
void gs_plugin_loader_shutdown ()
void gs_plugin_loader_dump_state ()
gboolean gs_plugin_loader_get_enabled ()
void gs_plugin_loader_add_location ()
guint gs_plugin_loader_get_scale ()
void gs_plugin_loader_set_scale ()
GsAppList * gs_plugin_loader_get_pending ()
gboolean gs_plugin_loader_get_allow_updates ()
gboolean gs_plugin_loader_get_network_available ()
gboolean gs_plugin_loader_get_network_metered ()
gboolean gs_plugin_loader_get_plugin_supported ()
GPtrArray * gs_plugin_loader_get_plugins ()
void gs_plugin_loader_add_event ()
GPtrArray * gs_plugin_loader_get_events ()
GsPluginEvent * gs_plugin_loader_get_event_default ()
void gs_plugin_loader_remove_events ()
void gs_plugin_loader_app_create_async ()
GsApp * gs_plugin_loader_app_create_finish ()
void gs_plugin_loader_get_system_app_async ()
GsApp * gs_plugin_loader_get_system_app_finish ()
GsOdrsProvider * gs_plugin_loader_get_odrs_provider ()
void gs_plugin_loader_clear_caches ()
GsPlugin * gs_plugin_loader_find_plugin ()
void gs_plugin_loader_set_max_parallel_ops ()
GsJobManager * gs_plugin_loader_get_job_manager ()
GsCategoryManager * gs_plugin_loader_get_category_manager ()
void gs_plugin_loader_claim_error ()
void gs_plugin_loader_claim_job_error ()
gboolean gs_plugin_loader_app_is_valid ()
gboolean gs_plugin_loader_app_is_compatible ()
void gs_plugin_loader_run_adopt ()
void gs_plugin_loader_emit_updates_changed ()

Types and Values

Description

Functions

gs_plugin_loader_new ()

GsPluginLoader *
gs_plugin_loader_new (GDBusConnection *session_bus_connection,
                      GDBusConnection *system_bus_connection);

Create a new GsPluginLoader.

The D-Bus connection arguments should typically be NULL, and only be non-NULL when doing unit tests.

Parameters

session_bus_connection

a D-Bus session bus connection to use, or NULL to use the default.

[nullable][transfer none]

system_bus_connection

a D-Bus system bus connection to use, or NULL to use the default.

[nullable][transfer none]

Since: 43


gs_plugin_loader_job_process_async ()

void
gs_plugin_loader_job_process_async (GsPluginLoader *plugin_loader,
                                    GsPluginJob *plugin_job,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

This method calls all plugins.

If the GsPluginLoader is still being set up, this function will wait until setup is complete before running.

Parameters

plugin_loader

A GsPluginLoader

 

plugin_job

job to process

 

cancellable

a GCancellable, or NULL

 

callback

function to call when complete

 

user_data

user data to pass to callback

 

gs_plugin_loader_job_process_finish ()

GsAppList *
gs_plugin_loader_job_process_finish (GsPluginLoader *plugin_loader,
                                     GAsyncResult *res,
                                     GError **error);

Parameters

plugin_loader

A GsPluginLoader

 

res

a GAsyncResult

 

error

A GError, or NULL

 

Returns

A list of applications.

[element-type GsApp][transfer full]


gs_plugin_loader_job_action_finish ()

gboolean
gs_plugin_loader_job_action_finish (GsPluginLoader *plugin_loader,
                                    GAsyncResult *res,
                                    GError **error);

Parameters

plugin_loader

A GsPluginLoader

 

res

a GAsyncResult

 

error

A GError, or NULL

 

Returns

success


gs_plugin_loader_setup_async ()

void
gs_plugin_loader_setup_async (GsPluginLoader *plugin_loader,
                              const gchar * const *allowlist,
                              const gchar * const *blocklist,
                              GCancellable *cancellable,
                              GAsyncReadyCallback callback,
                              gpointer user_data);

Sets up the plugin loader ready for use.

Parameters

plugin_loader

a GsPluginLoader

 

allowlist

list of plugin names, or NULL

 

blocklist

list of plugin names, or NULL

 

cancellable

A GCancellable, or NULL

 

callback

callback to indicate completion of the asynchronous operation

 

user_data

data to pass to callback

 

Since: 42


gs_plugin_loader_setup_finish ()

gboolean
gs_plugin_loader_setup_finish (GsPluginLoader *plugin_loader,
                               GAsyncResult *result,
                               GError **error);

Finish an asynchronous setup operation started with gs_plugin_loader_setup_async().

Parameters

plugin_loader

a GsPluginLoader

 

result

result of the asynchronous operation

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE otherwise

Since: 42


gs_plugin_loader_shutdown ()

void
gs_plugin_loader_shutdown (GsPluginLoader *plugin_loader,
                           GCancellable *cancellable);

Shut down the plugins.

This blocks until the operation is complete. It may be refactored in future to be asynchronous.

Parameters

plugin_loader

a GsPluginLoader

 

cancellable

a GCancellable, or NULL

 

Since: 42


gs_plugin_loader_dump_state ()

void
gs_plugin_loader_dump_state (GsPluginLoader *plugin_loader);

gs_plugin_loader_get_enabled ()

gboolean
gs_plugin_loader_get_enabled (GsPluginLoader *plugin_loader,
                              const gchar *plugin_name);

gs_plugin_loader_add_location ()

void
gs_plugin_loader_add_location (GsPluginLoader *plugin_loader,
                               const gchar *location);

gs_plugin_loader_get_scale ()

guint
gs_plugin_loader_get_scale (GsPluginLoader *plugin_loader);

gs_plugin_loader_set_scale ()

void
gs_plugin_loader_set_scale (GsPluginLoader *plugin_loader,
                            guint scale);

gs_plugin_loader_get_pending ()

GsAppList *
gs_plugin_loader_get_pending (GsPluginLoader *plugin_loader);

gs_plugin_loader_get_allow_updates ()

gboolean
gs_plugin_loader_get_allow_updates (GsPluginLoader *plugin_loader);

gs_plugin_loader_get_network_available ()

gboolean
gs_plugin_loader_get_network_available
                               (GsPluginLoader *plugin_loader);

gs_plugin_loader_get_network_metered ()

gboolean
gs_plugin_loader_get_network_metered (GsPluginLoader *plugin_loader);

gs_plugin_loader_get_plugin_supported ()

gboolean
gs_plugin_loader_get_plugin_supported (GsPluginLoader *plugin_loader,
                                       const gchar *function_name);

This function returns TRUE if the symbol is found in any enabled plugin.

Parameters

plugin_loader

A GsPluginLoader

 

function_name

a function name

 

gs_plugin_loader_get_plugins ()

GPtrArray *
gs_plugin_loader_get_plugins (GsPluginLoader *plugin_loader);

Get the set of currently loaded plugins.

This includes disabled plugins, which should be checked for using gs_plugin_get_enabled().

This is intended to be used by internal gnome-software code. Plugin and UI code should typically use GsPluginJob to run operations.

Parameters

plugin_loader

a GsPluginLoader

 

Returns

list of GsPlugins.

[transfer none][element-type GsPlugin]

Since: 42


gs_plugin_loader_add_event ()

void
gs_plugin_loader_add_event (GsPluginLoader *plugin_loader,
                            GsPluginEvent *event);

gs_plugin_loader_get_events ()

GPtrArray *
gs_plugin_loader_get_events (GsPluginLoader *plugin_loader);

Gets all plugin events, even ones that are not active or visible anymore.

Parameters

plugin_loader

A GsPluginLoader

 

Returns

events.

[transfer container][element-type GsPluginEvent]


gs_plugin_loader_get_event_default ()

GsPluginEvent *
gs_plugin_loader_get_event_default (GsPluginLoader *plugin_loader);

Gets an active plugin event where active means that it was not been already dismissed by the user.

Parameters

plugin_loader

A GsPluginLoader

 

Returns

a GsPluginEvent, or NULL for none.

[transfer full]


gs_plugin_loader_remove_events ()

void
gs_plugin_loader_remove_events (GsPluginLoader *plugin_loader);

Removes all plugin events from the loader. This function should only be called from the self tests.

Parameters

plugin_loader

A GsPluginLoader

 

gs_plugin_loader_app_create_async ()

void
gs_plugin_loader_app_create_async (GsPluginLoader *plugin_loader,
                                   const gchar *unique_id,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Create a GsApp identified by unique_id asynchronously. Finish the call with gs_plugin_loader_app_create_finish().

If the GsPluginLoader is still being set up, this function will wait until setup is complete before running.

Parameters

plugin_loader

a GsPluginLoader

 

unique_id

a unique_id

 

cancellable

a GCancellable, or NULL

 

callback

function to call when complete

 

user_data

user data to pass to callback

 

Since: 41


gs_plugin_loader_app_create_finish ()

GsApp *
gs_plugin_loader_app_create_finish (GsPluginLoader *plugin_loader,
                                    GAsyncResult *res,
                                    GError **error);

Finishes call to gs_plugin_loader_app_create_async().

Parameters

plugin_loader

a GsPluginLoader

 

res

a GAsyncResult

 

error

A GError, or NULL

 

Returns

a GsApp, or NULL on error.

[transfer full]

Since: 41


gs_plugin_loader_get_system_app_async ()

void
gs_plugin_loader_get_system_app_async (GsPluginLoader *plugin_loader,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

Get the application that represents the currently installed OS asynchronously. Finish the call with gs_plugin_loader_get_system_app_finish().

Parameters

plugin_loader

a GsPluginLoader

 

cancellable

a GCancellable, or NULL

 

callback

function to call when complete

 

user_data

user data to pass to callback

 

Since: 41


gs_plugin_loader_get_system_app_finish ()

GsApp *
gs_plugin_loader_get_system_app_finish
                               (GsPluginLoader *plugin_loader,
                                GAsyncResult *res,
                                GError **error);

Finishes call to gs_plugin_loader_get_system_app_async().

Parameters

plugin_loader

a GsPluginLoader

 

res

a GAsyncResult

 

error

A GError, or NULL

 

Returns

a GsApp, which represents the currently installed OS, or NULL on error.

[transfer full]

Since: 41


gs_plugin_loader_get_odrs_provider ()

GsOdrsProvider *
gs_plugin_loader_get_odrs_provider (GsPluginLoader *plugin_loader);

Get the singleton GsOdrsProvider which provides access to ratings and reviews data from ODRS.

Parameters

plugin_loader

a GsPluginLoader

 

Returns

a GsOdrsProvider, or NULL if disabled.

[transfer none][nullable]

Since: 41


gs_plugin_loader_clear_caches ()

void
gs_plugin_loader_clear_caches (GsPluginLoader *plugin_loader);

gs_plugin_loader_find_plugin ()

GsPlugin *
gs_plugin_loader_find_plugin (GsPluginLoader *plugin_loader,
                              const gchar *plugin_name);

gs_plugin_loader_set_max_parallel_ops ()

void
gs_plugin_loader_set_max_parallel_ops (GsPluginLoader *plugin_loader,
                                       guint max_ops);

Sets the number of maximum number of queued operations (install/update/upgrade-download) to be processed at a time. If max_ops is 0, then it will set the default maximum number.

Parameters

plugin_loader

a GsPluginLoader

 

max_ops

the maximum number of parallel operations

 

gs_plugin_loader_get_job_manager ()

GsJobManager *
gs_plugin_loader_get_job_manager (GsPluginLoader *plugin_loader);

Get the job manager singleton.

Parameters

plugin_loader

a GsPluginLoader

 

Returns

a job manager.

[transfer none]

Since: 44


gs_plugin_loader_get_category_manager ()

GsCategoryManager *
gs_plugin_loader_get_category_manager (GsPluginLoader *plugin_loader);

Get the category manager singleton.

Parameters

plugin_loader

a GsPluginLoader

 

Returns

a category manager.

[transfer none]

Since: 40


gs_plugin_loader_claim_error ()

void
gs_plugin_loader_claim_error (GsPluginLoader *plugin_loader,
                              GsPlugin *plugin,
                              GsPluginAction action,
                              GsApp *app,
                              gboolean interactive,
                              const GError *error);

Convert the error into a plugin event and add it to the queue.

The plugin is used only if the error contains a reference to a concrete application, in which case any cached application overrides the passed in app .

The GS_PLUGIN_ERROR_CANCELLED and G_IO_ERROR_CANCELLED errors are automatically ignored.

Parameters

plugin_loader

a GsPluginLoader

 

plugin

a GsPlugin to get an application from, or NULL.

[nullable]

action

a GsPluginAction associated with the error

 

app

a GsApp for the event, or NULL.

[nullable]

interactive

whether to set interactive flag

 

error

a GError to claim

 

Since: 41


gs_plugin_loader_claim_job_error ()

void
gs_plugin_loader_claim_job_error (GsPluginLoader *plugin_loader,
                                  GsPlugin *plugin,
                                  GsPluginJob *job,
                                  const GError *error);

The same as gs_plugin_loader_claim_error(), only reads the information from the job .

Parameters

plugin_loader

a GsPluginLoader

 

plugin

a GsPlugin to get an application from, or NULL.

[nullable]

job

a GsPluginJob for the error

 

error

a GError to claim

 

Since: 41


gs_plugin_loader_app_is_valid ()

gboolean
gs_plugin_loader_app_is_valid (GsApp *app,
                               GsPluginRefineFlags flags);

gs_plugin_loader_app_is_compatible ()

gboolean
gs_plugin_loader_app_is_compatible (GsPluginLoader *plugin_loader,
                                    GsApp *app);

gs_plugin_loader_run_adopt ()

void
gs_plugin_loader_run_adopt (GsPluginLoader *plugin_loader,
                            GsAppList *list);

Call the gs_plugin_adopt_app() function on each plugin on each app in list to try and find the plugin which should manage each app.

This function is intended to be used by internal gnome-software code.

Parameters

plugin_loader

a GsPluginLoader

 

list

list of apps to try and adopt

 

Since: 42


gs_plugin_loader_emit_updates_changed ()

void
gs_plugin_loader_emit_updates_changed (GsPluginLoader *self);

Emits the “updates-changed” signal in the nearest idle in the main thread.

Parameters

self

a GsPluginLoader

 

Since: 43

Types and Values

GS_TYPE_PLUGIN_LOADER

#define GS_TYPE_PLUGIN_LOADER		(gs_plugin_loader_get_type ())

GsPluginLoader

typedef struct _GsPluginLoader GsPluginLoader;