GsPluginJob

GsPluginJob

Functions

Types and Values

Description

Functions

gs_plugin_job_run_async ()

void
gs_plugin_job_run_async (GsPluginJob *self,
                         GsPluginLoader *plugin_loader,
                         GCancellable *cancellable,
                         GAsyncReadyCallback callback,
                         gpointer user_data);

Asynchronously run the job.

This stores a reference to cancellable so that gs_plugin_job_cancel() can be used to asynchronously cancel the job from another thread.

Parameters

self

a GsPluginJob

 

plugin_loader

plugin loader to provide the plugins to run the job against

 

cancellable

a GCancellable, or NULL.

[nullable]

callback

callback to call once the job is finished

 

user_data

data to pass to callback

 

Since: 49


gs_plugin_job_run_finish ()

gboolean
gs_plugin_job_run_finish (GsPluginJob *self,
                          GAsyncResult *result,
                          GError **error);

Finish an asynchronous plugin job started with gs_plugin_job_run_async().

Parameters

self

a GsPluginJob

 

result

result of the asynchronous operation

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE otherwise

Since: 49


gs_plugin_job_get_interactive ()

gboolean
gs_plugin_job_get_interactive (GsPluginJob *self);

gs_plugin_job_emit_event ()

void
gs_plugin_job_emit_event (GsPluginJob *self,
                          GsPlugin *plugin,
                          GsPluginEvent *event);

Emit an event from the plugin job.

This is typically used to report errors while running the job, and it allows multiple errors to be reported and for the job to continue after those errors. Returning a GError would not allow that.

plugin may be NULL if the event is not associated with a specific plugin. It will typically be non-NULL, though, as most events come from plugin-specific code.

Parameters

self

a plugin job

 

plugin

plugin which reported the event, or NULL if the event is not associated to a specific plugin.

[nullable][transfer none]

event

event being reported.

[transfer none]

Since: 49

Types and Values

GS_TYPE_PLUGIN_JOB

#define GS_TYPE_PLUGIN_JOB (gs_plugin_job_get_type ())

struct GsPluginJobClass

struct GsPluginJobClass {
	GObjectClass parent_class;

	void (*run_async) (GsPluginJob         *self,
	                   GsPluginLoader      *plugin_loader,
	                   GCancellable        *cancellable,
	                   GAsyncReadyCallback  callback,
	                   gpointer             user_data);
	gboolean (*run_finish) (GsPluginJob   *self,
	                        GAsyncResult  *result,
	                        GError       **error);
	gboolean (*get_interactive) (GsPluginJob *self);
};

GsPluginJob

typedef struct _GsPluginJob GsPluginJob;