add_notification


Description:

public async bool add_notification (string id, Variant notification, NotificationFlags flags, Cancellable? cancellable) throws Error

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 [[email protected]])
  • 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 [signal@Portal:XdpPortal:notification-action-invoked] signal.

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

To withdraw a notification, use [[email protected]_notification].

Parameters:

this

a [class@Portal]

id

unique ID for the notification

notification

a [[email protected]] dictionary with the content of the notification

flags

options for this call

cancellable

optional [[email protected]]

callback

a callback to call when the request is done

data

data to pass to callback




2022 vala-language.org