## 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 ()
void | gs_plugin_event_set_app ()
GsApp * | gs_plugin_event_get_app ()
void | gs_plugin_event_set_origin ()
GsApp * | gs_plugin_event_get_origin ()
void | gs_plugin_event_set_action ()
GsPluginAction | gs_plugin_event_get_action ()
void | gs_plugin_event_set_error ()
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

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

Creates a new event.

#### Returns

A newly allocated GsPluginEvent

Since: 3.22

### 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, or `NULL` for invalid

Since: 3.22

### gs_plugin_event_set_app ()

    void
    gs_plugin_event_set_app (GsPluginEvent *event,
                             GsApp *app);

Set the application (or source, or whatever component) that caused the event to be created.

#### Parameters

event | A GsPluginEvent |
app | A GsApp |

Since: 3.22

### gs_plugin_event_get_app ()

    GsApp *
    gs_plugin_event_get_app (GsPluginEvent *event);

Gets an application that created the event.

#### Parameters

event | A GsPluginEvent |

#### Returns

a GsApp, or `NULL` if unset.

[transfer none]

Since: 3.22

### gs_plugin_event_set_origin ()

    void
    gs_plugin_event_set_origin (GsPluginEvent *event,
                                GsApp *origin);

Set the origin that caused the event to be created.

#### Parameters

event | A GsPluginEvent |
origin | A GsApp |

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

    void
    gs_plugin_event_set_action (GsPluginEvent *event,
                                GsPluginAction action);

Set the action that caused the event to be created.

#### Parameters

event | A GsPluginEvent |
action | A GsPluginAction, e.g. `GS_PLUGIN_ACTION_UPDATE` |

Since: 3.22

### gs_plugin_event_get_action ()

    GsPluginAction
    gs_plugin_event_get_action (GsPluginEvent *event);

Gets an action that created the event.

#### Parameters

event | A GsPluginEvent |

#### Returns

a GsPluginAction, e.g. `GS_PLUGIN_ACTION_UPDATE`.

[transfer none]

Since: 3.22

### gs_plugin_event_set_error ()

    void
    gs_plugin_event_set_error (GsPluginEvent *event,
                               const GError *error);

Sets the event error.

#### Parameters

event | A GsPluginEvent |
error | A GError |

Since: 3.22

### 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, or `NULL` for unset

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 |

### GsPluginEvent

    typedef struct _GsPluginEvent GsPluginEvent;