GsPluginEvent: GNOME Software Reference Manual

## GsPluginEvent GsPluginEvent — Information about a plugin event |

## Stability Level

Unstable, unless otherwise indicated

## Functions

GsPluginEvent * | gs_plugin_event_new ()
const gchar * | gs_plugin_event_get_unique_id ()
GsApp * | gs_plugin_event_get_app ()
GsApp * | gs_plugin_event_get_origin ()
GsPluginJob * | gs_plugin_event_get_job ()
void | gs_plugin_event_set_job ()
const GError * | gs_plugin_event_get_error ()
void | gs_plugin_event_add_flag ()
void | gs_plugin_event_remove_flag ()
gboolean | gs_plugin_event_has_flag ()

## Types and Values

#define | GS_TYPE_PLUGIN_EVENT
enum | GsPluginEventFlag
| GsPluginEvent
| GsPluginJob

## Includes

    #include <gnome-software.h>

## Description

These functions provide a way for plugins to tell the UI layer about events that may require displaying to the user. Plugins should not assume that a specific event is actually shown to the user as it may be ignored automatically.

## Functions

### gs_plugin_event_new ()

    GsPluginEvent *
    gs_plugin_event_new (const gchar *first_property_name,
                         ...);

Creates a new event.

The arguments are as for `g_object_new()`: property name/value pairs to set the properties of the event.

#### Parameters

first_property_name | the name of the first property |
... | the value of the first property, followed by zero or more pairs of property name/value pairs, then `NULL` |

#### Returns

A newly allocated GsPluginEvent.

[transfer full]

Since: 42

### gs_plugin_event_get_unique_id ()

    const gchar *
    gs_plugin_event_get_unique_id (GsPluginEvent *event);

Gets the unique ID for the event. In most cases (if an app has been set) this will just be the actual GsApp unique-id. In the cases where only error has been set a virtual (but plausible) ID will be generated.

#### Parameters

event | A GsPluginEvent |

#### Returns

a string.

[not nullable]

Since: 3.22

### gs_plugin_event_get_app ()

    GsApp *
    gs_plugin_event_get_app (GsPluginEvent *event);

Gets an app that created the event.

#### Parameters

event | A GsPluginEvent |

#### Returns

a GsApp, or `NULL` if unset.

[transfer none]

Since: 3.22

### gs_plugin_event_get_origin ()

    GsApp *
    gs_plugin_event_get_origin (GsPluginEvent *event);

Gets an origin that created the event.

#### Parameters

event | A GsPluginEvent |

#### Returns

a GsApp, or `NULL` if unset.

[transfer none]

Since: 3.22

### gs_plugin_event_get_job ()

    GsPluginJob *
    gs_plugin_event_get_job (GsPluginEvent *event);

Gets the job that created the event.

#### Parameters

event | A GsPluginEvent |

#### Returns

a GsPluginJob.

[transfer none][nullable]

Since: 42

### gs_plugin_event_set_job ()

    void
    gs_plugin_event_set_job (GsPluginEvent *event,
                             GsPluginJob *job);

Sets the job that created the event.

This can be set after construction time, because typically the GsPluginJob pointer isn’t available when constructing an event — only later on in the event handling chain.

#### Parameters

event | A GsPluginEvent |
job | a plugin job, or `NULL` to clear. | [nullable]

Since: 49

### gs_plugin_event_get_error ()

    const GError *
    gs_plugin_event_get_error (GsPluginEvent *event);

Gets the event error.

#### Parameters

event | A GsPluginEvent |

#### Returns

a GError.

[not nullable]

Since: 3.22

### gs_plugin_event_add_flag ()

    void
    gs_plugin_event_add_flag (GsPluginEvent *event,
                              GsPluginEventFlag flag);

### gs_plugin_event_remove_flag ()

    void
    gs_plugin_event_remove_flag (GsPluginEvent *event,
                                 GsPluginEventFlag flag);

### gs_plugin_event_has_flag ()

    gboolean
    gs_plugin_event_has_flag (GsPluginEvent *event,
                              GsPluginEventFlag flag);

Finds out if the event has a specific flag.

#### Parameters

event | A GsPluginEvent |
flag | A GsPluginEventFlag, e.g. `GS_PLUGIN_EVENT_FLAG_INVALID` |

#### Returns

`TRUE` if the flag is set

Since: 3.22

## Types and Values

### GS_TYPE_PLUGIN_EVENT

    #define GS_TYPE_PLUGIN_EVENT (gs_plugin_event_get_type ())

### enum GsPluginEventFlag

Any flags an event can have.

#### Members

GS_PLUGIN_EVENT_FLAG_NONE | No special flags set |
GS_PLUGIN_EVENT_FLAG_INVALID | Event is no longer valid, e.g. was dismissed |
GS_PLUGIN_EVENT_FLAG_VISIBLE | Event is is visible on the screen |
GS_PLUGIN_EVENT_FLAG_WARNING | Event should be shown with more urgency |
GS_PLUGIN_EVENT_FLAG_INTERACTIVE | The plugin job was created with interactive=True |
GS_PLUGIN_EVENT_FLAG_LAST |  |

### GsPluginEvent

    typedef struct _GsPluginEvent GsPluginEvent;

### GsPluginJob

    typedef struct _GsPluginJob GsPluginJob;