Glib.Notification

Entities

Simple Types

Tagged Types

Access Types

Subprograms

Generic Instantiations

Description

Glib.Notification.Gnotification 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 Glib.Notification.Gnotification and other similar APIs is that, if supported by the desktop environment, notifications sent with Glib.Notification.Gnotification 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 Glib.Notification.Gnotification should be able to be started as a D-Bus service, using Glib.Application.Gapplication.

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 Glib.Application.Send_Notification.

Add_Button

procedure Add_Button
   (Self            : not null access Gnotification_Record;
    Label           : UTF8_String;
    Detailed_Action : UTF8_String)

Adds a button to Notification that activates the action in Detailed_Action when clicked. That action must be an application-wide action (starting with "app."). If Detailed_Action contains a target, the action will be activated with that target as its parameter. See g_action_parse_detailed_name for a description of the format for Detailed_Action. Since: gtk+ 2.40

Parameters
Self
Label

label of the button

Detailed_Action

a detailed action name

Add_Button_With_Target_Value

procedure Add_Button_With_Target_Value
   (Self   : not null access Gnotification_Record;
    Label  : UTF8_String;
    Action : UTF8_String;
    Target : Glib.Variant.Gvariant)

Adds a button to Notification that activates Action when clicked. Action must be an application-wide action (it must start with "app."). If Target is non-null, Action will be activated with Target as its parameter. Since: gtk+ 2.40

Parameters
Self
Label

label of the button

Action

an action name

Target

a Glib.Variant.Gvariant to use as Action's parameter, or null

G_New

procedure G_New (Self : out Gnotification; Title : UTF8_String)

Creates a new Glib.Notification.Gnotification with Title as its title. After populating Notification with more details, it can be sent to the desktop shell with Glib.Application.Send_Notification. Changing any properties after this call will not have any effect until resending Notification. Since: gtk+ 2.40

Parameters
Self
Title

the title of the notification

Get_Type

function Get_Type return Glib.GType
Return Value

Gnotification

type Gnotification is access all Gnotification_Record'Class;

Gnotification_New

function Gnotification_New (Title : UTF8_String) return Gnotification

Creates a new Glib.Notification.Gnotification with Title as its title. After populating Notification with more details, it can be sent to the desktop shell with Glib.Application.Send_Notification. Changing any properties after this call will not have any effect until resending Notification. Since: gtk+ 2.40

Parameters
Title

the title of the notification

Return Value

GNotification_Priority

type GNotification_Priority is (
   G_Notification_Priority_Normal,
   G_Notification_Priority_Low,
   G_Notification_Priority_High,
   G_Notification_Priority_Urgent);

Priority levels for GNotifications.

Enumeration Literal
G_Notification_Priority_Normal
G_Notification_Priority_Low
G_Notification_Priority_High
G_Notification_Priority_Urgent

GNotification_Priority_Properties

package GNotification_Priority_Properties is
   new Generic_Internal_Discrete_Property (GNotification_Priority);

Gnotification_Record

type Gnotification_Record is new GObject_Record with null record;

Initialize

procedure Initialize
   (Self  : not null access Gnotification_Record'Class;
    Title : UTF8_String)

Creates a new Glib.Notification.Gnotification with Title as its title. After populating Notification with more details, it can be sent to the desktop shell with Glib.Application.Send_Notification. Changing any properties after this call will not have any effect until resending Notification. Since: gtk+ 2.40 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self
Title

the title of the notification

Property_GNotification_Priority

type Property_GNotification_Priority is new GNotification_Priority_Properties.Property;

Set_Body

procedure Set_Body
   (Self     : not null access Gnotification_Record;
    The_Body : UTF8_String := "")

Sets the body of Notification to Body. Since: gtk+ 2.40

Parameters
Self
The_Body

the new body for Notification, or null

Set_Default_Action

procedure Set_Default_Action
   (Self            : not null access Gnotification_Record;
    Detailed_Action : UTF8_String)

Sets the default action of Notification to Detailed_Action. This action is activated when the notification is clicked on. The action in Detailed_Action must be an application-wide action (it must start with "app."). If Detailed_Action contains a target, the given action will be activated with that target as its parameter. See g_action_parse_detailed_name for a description of the format for Detailed_Action. When no default action is set, the application that the notification was sent on is activated. Since: gtk+ 2.40

Parameters
Self
Detailed_Action

a detailed action name

Set_Default_Action_And_Target_Value

procedure Set_Default_Action_And_Target_Value
   (Self   : not null access Gnotification_Record;
    Action : UTF8_String;
    Target : Glib.Variant.Gvariant)

Sets the default action of Notification to Action. This action is activated when the notification is clicked on. It must be an application-wide action (start with "app."). If Target is non-null, Action will be activated with Target as its parameter. When no default action is set, the application that the notification was sent on is activated. Since: gtk+ 2.40

Parameters
Self
Action

an action name

Target

a Glib.Variant.Gvariant to use as Action's parameter, or null

Set_Icon

procedure Set_Icon
   (Self : not null access Gnotification_Record;
    Icon : Glib.G_Icon.G_Icon)

Sets the icon of Notification to Icon. Since: gtk+ 2.40

Parameters
Self
Icon

the icon to be shown in Notification, as a Glib.G_Icon.G_Icon

Set_Priority

procedure Set_Priority
   (Self     : not null access Gnotification_Record;
    Priority : GNotification_Priority)

Sets the priority of Notification to Priority. See Glib.Notification.GNotification_Priority for possible values.

Parameters
Self
Priority

a Glib.Notification.GNotification_Priority

Set_Title

procedure Set_Title
   (Self  : not null access Gnotification_Record;
    Title : UTF8_String)

Sets the title of Notification to Title. Since: gtk+ 2.40

Parameters
Self
Title

the new title for Notification

Set_Urgent

procedure Set_Urgent
   (Self   : not null access Gnotification_Record;
    Urgent : Boolean)

Deprecated in favor of Glib.Notification.Set_Priority. Since: gtk+ 2.40 Deprecated since 2.42, 1

Parameters
Self
Urgent

True if Notification is urgent