## Notification Notification — send notifications |

## Functions

void | xdp_portal_add_notification ()
gboolean | xdp_portal_add_notification_finish ()
void | xdp_portal_remove_notification ()

## Types and Values

enum | XdpNotificationFlags

## Description

These functions let applications send desktop notifications.

The underlying portal is org.freedesktop.portal.Notification.

## Functions

### xdp_portal_add_notification ()

    void
    xdp_portal_add_notification (XdpPortal *portal,
                                 const char *id,
                                 GVariant *notification,
                                 XdpNotificationFlags flags,
                                 GCancellable *cancellable,
                                 GAsyncReadyCallback callback,
                                 gpointer data);

Sends a desktop notification.

The following keys may be present in `notification` :

- title `s`: a user-visible string to display as title

- body `s`: a user-visible string to display as body

- icon `v`: a serialized icon (in the format produced by `g_icon_serialize()`)

- priority `s`: "low", "normal", "high" or "urgent"

- default-action `s`: name of an action that will be activated when the user clicks on the notification

- default-action-target `v`: target parameter to send along when activating the default action.

- buttons `aa{sv}`: array of serialized buttons

Each serialized button is a dictionary with the following supported keys:

- label `s`: user-visible lable for the button. Mandatory

- action `s`: name of an action that will be activated when the user clicks on the button. Mandatory

- target `v`: target parameter to send along when activating the button

Actions with a prefix of "app." are assumed to be exported by the application and will be activated via the org.freedesktop.Application interface, others are activated by emitting the “notification-action-invoked” signal.

It is the callers responsibility to ensure that the ID is unique among all notifications.

To withdraw a notification, use `xdp_portal_remove_notification()`.

#### Parameters

portal | a XdpPortal |
id | unique ID for the notification |
notification | a GVariant dictionary with the content of the notification |
flags | options for this call |
cancellable | optional GCancellable. | [nullable]
callback | a callback to call when the request is done. | [scope async]
data | data to pass to `callback` . | [closure]

### xdp_portal_add_notification_finish ()

    gboolean
    xdp_portal_add_notification_finish (XdpPortal *portal,
                                        GAsyncResult *result,
                                        GError **error);

Finishes the notification request, and returns the result as a boolean.

#### Parameters

portal | a XdpPortal |
result | a GAsyncResult |
error | return location for an error |

#### Returns

`TRUE` if the notification was added

### xdp_portal_remove_notification ()

    void
    xdp_portal_remove_notification (XdpPortal *portal,
                                    const char *id);

Withdraws a desktop notification.

#### Parameters

portal | a XdpPortal |
id | the ID of an notification |

## Types and Values

### enum XdpNotificationFlags

#### Members

XDP_NOTIFICATION_FLAG_NONE |  |