## gs-plugin-loader gs-plugin-loader |

## Functions

GsPluginLoader * | gs_plugin_loader_new ()
GDBusConnection * | gs_plugin_loader_get_session_bus_connection ()
GDBusConnection * | gs_plugin_loader_get_system_bus_connection ()
void | gs_plugin_loader_job_process_async ()
gboolean | gs_plugin_loader_job_process_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_power_saver ()
gboolean | gs_plugin_loader_get_game_mode ()
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 ()
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 ()
int | gs_plugin_loader_get_cpu_priority ()
void | gs_plugin_loader_set_cpu_priority ()

## Types and Values

#define | GS_TYPE_PLUGIN_LOADER
| GsPluginLoader

## 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]

#### Returns

a new GsPluginLoader.

[transfer full][not nullable]

Since: 43

### gs_plugin_loader_get_session_bus_connection ()

    GDBusConnection *
    gs_plugin_loader_get_session_bus_connection
                                   (GsPluginLoader *plugin_loader);

Gets the session D-Bus connection used by the plugin loader.

This is guaranteed to return a non-`NULL` D-Bus connection after the plugin loader has been successfully set up (and before it’s shut down). Otherwise, it will return `NULL`.

#### Parameters

plugin_loader | a plugin loader |

#### Returns

session D-Bus connection, or `NULL` if the plugin loader is not set up.

[nullable][transfer none]

Since: 50

### gs_plugin_loader_get_system_bus_connection ()

    GDBusConnection *
    gs_plugin_loader_get_system_bus_connection
                                   (GsPluginLoader *plugin_loader);

Gets the system D-Bus connection used by the plugin loader.

This is guaranteed to return a non-`NULL` D-Bus connection after the plugin loader has been successfully set up (and before it’s shut down). Otherwise, it will return `NULL`.

#### Parameters

plugin_loader | a plugin loader |

#### Returns

system D-Bus connection, or `NULL` if the plugin loader is not set up.

[nullable][transfer none]

Since: 50

### 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 ()

    gboolean
    gs_plugin_loader_job_process_finish (GsPluginLoader *plugin_loader,
                                         GAsyncResult *res,
                                         GsPluginJob **out_job,
                                         GError **error);

Finish an asynchronous job started with `gs_plugin_loader_job_process_async()`.

The original job can be returned, for convenience, using `out_job` . This happens regardless of whether an error is returned.

The results from the original job must be queried from the GsPluginJob object using methods specific to the job subclass.

#### Parameters

plugin_loader | A GsPluginLoader |
res | a GAsyncResult |
out_job | return location for a pointer to the original GsPluginJob, or `NULL` to ignore. | [out][optional][not nullable][transfer full]
error | A GError, or `NULL` |

#### Returns

`TRUE` on success, `FALSE` otherwise

Since: 49

### 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_power_saver ()

    gboolean
    gs_plugin_loader_get_power_saver (GsPluginLoader *plugin_loader);

### gs_plugin_loader_get_game_mode ()

    gboolean
    gs_plugin_loader_get_game_mode (GsPluginLoader *plugin_loader);

### 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_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,
                                  GsApp *app,
                                  gboolean interactive,
                                  const GError *error);

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

The `GS_PLUGIN_ERROR_CANCELLED` and `G_IO_ERROR_CANCELLED` errors are automatically ignored.

#### Parameters

plugin_loader | a GsPluginLoader |
app | a GsApp for the event, or `NULL`. | [nullable]
interactive | whether to set interactive flag |
error | a GError to claim |

Since: 49

### gs_plugin_loader_claim_job_error ()

    void
    gs_plugin_loader_claim_job_error (GsPluginLoader *plugin_loader,
                                      GsPluginJob *job,
                                      GsApp *app,
                                      const GError *error);

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

#### Parameters

plugin_loader | a GsPluginLoader |
job | a GsPluginJob for the `error` |
app | a GsApp for the event, or `NULL`. | [nullable]
error | a GError to claim |

Since: 49

### gs_plugin_loader_app_is_valid ()

    gboolean
    gs_plugin_loader_app_is_valid (GsApp *app,
                                   GsPluginRefineFlags refine_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

### gs_plugin_loader_get_cpu_priority ()

    int
    gs_plugin_loader_get_cpu_priority (GsPluginLoader *self);

Gets the CPU priority of the plugins.

#### Parameters

self | a plugin loader |

#### Returns

a CPU priority, as a `G_PRIORITY_*` value

Since: 50

### gs_plugin_loader_set_cpu_priority ()

    void
    gs_plugin_loader_set_cpu_priority (GsPluginLoader *self,
                                       int cpu_priority);

Sets the CPU priority of the plugins, for example for their worker threads.

This is intended to be used for long-term priority changes (for example, if the main gnome-software window is closed or opened) rather than changing the priority of individual jobs.

#### Parameters

self | a plugin loader |
cpu_priority | new priority for the plugins to use, using the `G_PRIORITY_*` constants; default to `G_PRIORITY_DEFAULT` |

Since: 50

## Types and Values

### GS_TYPE_PLUGIN_LOADER

    #define GS_TYPE_PLUGIN_LOADER		(gs_plugin_loader_get_type ())

### GsPluginLoader

    typedef struct _GsPluginLoader GsPluginLoader;