Notification


Object Hierarchy:

GLib.Notification GLib.Notification GLib.Notification GLib.Object GLib.Object GLib.Object->GLib.Notification

Description:

[ CCode ( type_id = "g_notification_get_type ()" ) ]
[ Version ( since = "2.40" ) ]
public class Notification : Object

Notification is a mechanism for creating a notification to be shown to the user -- typically as a pop-up notification presented by the desktop environment shell.

The key difference between Notification and other similar APIs is that, if supported by the desktop environment, notifications sent with Notification will persist after the application has exited, and even across system reboots.

Since the user may click on a notification while the application is not running, applications using Notification should be able to be started as a D-Bus service, using Application.

In order for Notification to work, the application must have installed a `.desktop` file. For example:

 [Desktop Entry]
Name=Test Application
Comment=Description of what Test Application does
Exec=gnome-test-application
Icon=org.gnome.TestApplication
Terminal=false
Type=Application
Categories=GNOME;GTK;TestApplication Category;
StartupNotify=true
DBusActivatable=true
X-GNOME-UsesNotifications=true

The `X-GNOME-UsesNotifications` key indicates to GNOME Control Center that this application uses notifications, so it can be listed in the Control Center’s ‘Notifications’ panel.

The `.desktop` file must be named as `org.gnome.TestApplication.desktop`, where `org.gnome.TestApplication` is the ID passed to Application.

User interaction with a notification (either the default action, or buttons) must be associated with actions on the application (ie: "app." actions). It is not possible to route user interaction through the notification itself, because the object will not exist if the application is autostarted as a result of a notification being clicked.

A notification can be sent with send_notification.


Namespace: GLib
Package: gio-2.0

Content:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class GLib.Object



2022 vala-language.org