gs-plugin-helpers: GNOME Software Reference Manual

## gs-plugin-helpers gs-plugin-helpers — Helpers for storing call closures for GsPlugin vfuncs |

## Functions

GsPluginRefineData * | gs_plugin_refine_data_new ()
GTask * | gs_plugin_refine_data_new_task ()
void | gs_plugin_refine_data_free ()
GsPluginRefreshMetadataData * | gs_plugin_refresh_metadata_data_new ()
void | gs_plugin_refresh_metadata_data_free ()
GsPluginListAppsData * | gs_plugin_list_apps_data_new ()
GTask * | gs_plugin_list_apps_data_new_task ()
void | gs_plugin_list_apps_data_free ()
GsPluginManageRepositoryData * | gs_plugin_manage_repository_data_new ()
GTask * | gs_plugin_manage_repository_data_new_task ()
void | gs_plugin_manage_repository_data_free ()
GsPluginRefineCategoriesData * | gs_plugin_refine_categories_data_new ()
GTask * | gs_plugin_refine_categories_data_new_task ()
void | gs_plugin_refine_categories_data_free ()

## Types and Values

| GsPluginRefineData
| GsPluginRefreshMetadataData
| GsPluginListAppsData
| GsPluginManageRepositoryData
| GsPluginRefineCategoriesData

## Description

The helpers in this file each create a context structure to store the arguments passed to a standard GsPlugin vfunc.

These are intended to be used by plugin implementations to easily create GTasks for handling GsPlugin vfunc calls, without all having to write the same code to create a structure to wrap the vfunc arguments.

## Functions

### gs_plugin_refine_data_new ()

    GsPluginRefineData *
    gs_plugin_refine_data_new (GsAppList *list,
                               GsPluginRefineFlags flags);

Context data for a call to GsPluginClass.refine_async.

#### Parameters

list | list of GsApps to refine |
flags | refine flags |

#### Returns

context data structure.

[transfer full]

Since: 42

### gs_plugin_refine_data_new_task ()

    GTask *
    gs_plugin_refine_data_new_task (gpointer source_object,
                                    GsAppList *list,
                                    GsPluginRefineFlags flags,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Create a GTask for a refine operation with the given arguments. The task data will be set to a GsPluginRefineData containing the given context.

This is essentially a combination of `gs_plugin_refine_data_new()`, `g_task_new()` and `g_task_set_task_data()`.

#### Parameters

source_object | task source object |
list | list of GsApps to refine |
flags | refine flags |
cancellable | a GCancellable, or `NULL`. | [nullable]
callback | function to call once asynchronous operation is finished |
user_data | data to pass to `callback` |

#### Returns

new GTask with the given context data.

[transfer full]

Since: 42

### gs_plugin_refine_data_free ()

    void
    gs_plugin_refine_data_free (GsPluginRefineData *data);

Free the given `data` .

#### Parameters

data | a GsPluginRefineData. | [transfer full]

Since: 42

### gs_plugin_refresh_metadata_data_new ()

    GsPluginRefreshMetadataData *
    gs_plugin_refresh_metadata_data_new (guint64 cache_age_secs,
                                         GsPluginRefreshMetadataFlags flags);

Context data for a call to GsPluginClass.refresh_metadata_async.

#### Parameters

cache_age_secs | maximum allowed age of the cache in order for it to remain valid, in seconds |
flags | refresh metadata flags |

#### Returns

context data structure.

[transfer full]

Since: 42

### gs_plugin_refresh_metadata_data_free ()

    void
    gs_plugin_refresh_metadata_data_free (GsPluginRefreshMetadataData *data);

Free the given `data` .

#### Parameters

data | a GsPluginRefreshMetadataData. | [transfer full]

Since: 42

### gs_plugin_list_apps_data_new ()

    GsPluginListAppsData *
    gs_plugin_list_apps_data_new (GsAppQuery *query,
                                  GsPluginListAppsFlags flags);

Context data for a call to GsPluginClass.list_apps_async.

#### Parameters

query | a query to filter apps, or `NULL` for no filtering. | [nullable][transfer none]
flags | list apps flags |

#### Returns

context data structure.

[transfer full]

Since: 43

### gs_plugin_list_apps_data_new_task ()

    GTask *
    gs_plugin_list_apps_data_new_task (gpointer source_object,
                                       GsAppQuery *query,
                                       GsPluginListAppsFlags flags,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

Create a GTask for a list apps operation with the given arguments. The task data will be set to a GsPluginListAppsData containing the given context.

This is essentially a combination of `gs_plugin_list_apps_data_new()`, `g_task_new()` and `g_task_set_task_data()`.

#### Parameters

source_object | task source object |
query | a query to filter apps, or `NULL` for no filtering. | [nullable][transfer none]
flags | list apps flags |
cancellable | a GCancellable, or `NULL`. | [nullable]
callback | function to call once asynchronous operation is finished |
user_data | data to pass to `callback` |

#### Returns

new GTask with the given context data.

[transfer full]

Since: 43

### gs_plugin_list_apps_data_free ()

    void
    gs_plugin_list_apps_data_free (GsPluginListAppsData *data);

Free the given `data` .

#### Parameters

data | a GsPluginListAppsData. | [transfer full]

Since: 43

### gs_plugin_manage_repository_data_new ()

    GsPluginManageRepositoryData *
    gs_plugin_manage_repository_data_new (GsApp *repository,
                                          GsPluginManageRepositoryFlags flags);

Common context data for a call to GsPluginClass.install_repository_async, GsPluginClass.remove_repository_async, GsPluginClass.enable_repository_async and GsPluginClass.disable_repository_async.

#### Parameters

repository | a repository to manage. | [not-nullable][transfer none]
flags | manage repository flags |

#### Returns

context data structure.

[transfer full]

Since: 43

### gs_plugin_manage_repository_data_new_task ()

    GTask *
    gs_plugin_manage_repository_data_new_task
                                   (gpointer source_object,
                                    GsApp *repository,
                                    GsPluginManageRepositoryFlags flags,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Create a GTask for a manage repository operation with the given arguments. The task data will be set to a GsPluginManageRepositoryData containing the given context.

This is essentially a combination of `gs_plugin_manage_repository_data_new()`, `g_task_new()` and `g_task_set_task_data()`.

#### Parameters

source_object | task source object |
repository | a repository to manage. | [not-nullable][transfer none]
flags | manage repository flags |
cancellable | a GCancellable, or `NULL`. | [nullable]
callback | function to call once asynchronous operation is finished |
user_data | data to pass to `callback` |

#### Returns

new GTask with the given context data.

[transfer full]

Since: 43

### gs_plugin_manage_repository_data_free ()

    void
    gs_plugin_manage_repository_data_free (GsPluginManageRepositoryData *data);

Free the given `data` .

#### Parameters

data | a GsPluginManageRepositoryData. | [transfer full]

Since: 43

### gs_plugin_refine_categories_data_new ()

    GsPluginRefineCategoriesData *
    gs_plugin_refine_categories_data_new (GPtrArray *list,
                                          GsPluginRefineCategoriesFlags flags);

Context data for a call to GsPluginClass.refine_categories_async.

#### Parameters

list | list of GsCategory objects to refine. | [element-type GsCategory]
flags | refine flags |

#### Returns

context data structure.

[transfer full]

Since: 43

### gs_plugin_refine_categories_data_new_task ()

    GTask *
    gs_plugin_refine_categories_data_new_task
                                   (gpointer source_object,
                                    GPtrArray *list,
                                    GsPluginRefineCategoriesFlags flags,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Create a GTask for a refine categories operation with the given arguments. The task data will be set to a GsPluginRefineCategoriesData containing the given context.

This is essentially a combination of `gs_plugin_refine_categories_data_new()`, `g_task_new()` and `g_task_set_task_data()`.

#### Parameters

source_object | task source object |
list | list of GsCategory objects to refine. | [element-type GsCategory]
flags | refine flags |
cancellable | a GCancellable, or `NULL`. | [nullable]
callback | function to call once asynchronous operation is finished |
user_data | data to pass to `callback` |

#### Returns

new GTask with the given context data.

[transfer full]

Since: 43

### gs_plugin_refine_categories_data_free ()

    void
    gs_plugin_refine_categories_data_free (GsPluginRefineCategoriesData *data);

Free the given `data` .

#### Parameters

data | a GsPluginRefineCategoriesData. | [transfer full]

Since: 43

## Types and Values

### GsPluginRefineData

    typedef struct {
    	GsAppList *list;  /* (owned) (not nullable) */
    	GsPluginRefineFlags flags;
    } GsPluginRefineData;

### GsPluginRefreshMetadataData

    typedef struct {
    	guint64 cache_age_secs;
    	GsPluginRefreshMetadataFlags flags;
    } GsPluginRefreshMetadataData;

### GsPluginListAppsData

    typedef struct {
    	GsAppQuery *query;  /* (owned) (nullable) */
    	GsPluginListAppsFlags flags;
    } GsPluginListAppsData;

### GsPluginManageRepositoryData

    typedef struct {
    	GsApp *repository;  /* (owned) (nullable) */
    	GsPluginManageRepositoryFlags flags;
    } GsPluginManageRepositoryData;

### GsPluginRefineCategoriesData

    typedef struct {
    	GPtrArray *list;  /* (element-type GsCategory) (owned) (not nullable) */
    	GsPluginRefineCategoriesFlags flags;
    } GsPluginRefineCategoriesData;