Method

GioApplicationsend_notification

since: 2.40

Declaration

void
g_application_send_notification (
  GApplication* application,
  const gchar* id,
  GNotification* notification
)

Description

Sends a notification on behalf of application to the desktop shell. There is no guarantee that the notification is displayed immediately, or even at all.

Notifications may persist after the application exits. It will be D-Bus-activated when the notification or one of its actions is activated.

Modifying notification after this call has no effect. However, the object can be reused for a later call to this function.

id may be any string that uniquely identifies the event for the application. It does not need to be in any special format. For example, “new-message” might be appropriate for a notification about new messages.

If a previous notification was sent with the same id, it will be replaced with notification and shown again as if it was a new notification. This works even for notifications sent from a previous execution of the application, as long as id is the same string.

id may be NULL, but it is impossible to replace or withdraw notifications without an id.

If notification is no longer relevant, it can be withdrawn with g_application_withdraw_notification().

It is an error to call this function if application has no application ID.

Available since: 2.40

Parameters

id

Type: const gchar*

Id of the notification, or NULL.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
notification

Type: GNotification

The GNotification to send.

The data is owned by the caller of the function.