Gio.Notification¶
| Subclasses: | None |
|---|
Methods¶
| Inherited: | GObject.Object (37) |
|---|---|
| Structs: | GObject.ObjectClass (5) |
| class | new (title) |
add_button (label, detailed_action) |
|
add_button_with_target (label, action, target) |
|
set_body (body) |
|
set_default_action (detailed_action) |
|
set_default_action_and_target (action, target) |
|
set_icon (icon) |
|
set_priority (priority) |
|
set_title (title) |
|
set_urgent (urgent) |
Virtual Methods¶
| Inherited: | GObject.Object (7) |
|---|
Properties¶
None
Signals¶
| Inherited: | GObject.Object (1) |
|---|
Fields¶
| Inherited: | GObject.Object (1) |
|---|
Class Details¶
-
class
Gio.Notification(**kwargs)¶ Bases: GObject.ObjectAbstract: No Gio.Notificationis 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
Gio.Notificationand other similar APIs is that, if supported by the desktop environment, notifications sent withGio.Notificationwill 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
Gio.Notificationshould be able to be started as a D-Bus service, usingGio.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
Gio.Application.send_notification().New in version 2.40.
-
classmethod
new(title)[source]¶ Parameters: title ( str) – the title of the notificationReturns: a new Gio.NotificationinstanceReturn type: Gio.NotificationCreates a new
Gio.Notificationwith title as its title.After populating notification with more details, it can be sent to the desktop shell with
Gio.Application.send_notification(). Changing any properties after this call will not have any effect until resending notification.New in version 2.40.
Parameters: Adds a button to self 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
Gio.Action.parse_detailed_name() for a description of the format for detailed_action.New in version 2.40.
Parameters: - label (
str) – label of the button - action (
str) – an action name - target (
GLib.VariantorNone) – aGLib.Variantto use as action’s parameter, orNone
Adds a button to self that activates action when clicked. action must be an application-wide action (it must start with “app.”).
If target is non-
None, action will be activated with target as its parameter.New in version 2.40.
- label (
-
set_body(body)[source]¶ Parameters: body ( strorNone) – the new body for self, orNoneSets the body of self to body.
New in version 2.40.
-
set_default_action(detailed_action)[source]¶ Parameters: detailed_action ( str) – a detailed action nameSets the default action of self 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
Gio.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.
New in version 2.40.
-
set_default_action_and_target(action, target)[source]¶ Parameters: - action (
str) – an action name - target (
GLib.VariantorNone) – aGLib.Variantto use as action’s parameter, orNone
Sets the default action of self 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-
None, 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.
New in version 2.40.
- action (
-
set_icon(icon)[source]¶ Parameters: icon ( Gio.Icon) – the icon to be shown in self, as aGio.IconSets the icon of self to icon.
New in version 2.40.
-
set_priority(priority)[source]¶ Parameters: priority ( Gio.NotificationPriority) – aGio.NotificationPrioritySets the priority of self to priority. See
Gio.NotificationPriorityfor possible values.
-
set_title(title)[source]¶ Parameters: title ( str) – the new title for selfSets the title of self to title.
New in version 2.40.
-
set_urgent(urgent)[source]¶ Parameters: urgent ( bool) –Trueif self is urgentDeprecated in favor of
Gio.Notification.set_priority().New in version 2.40.
Deprecated since version 2.42: Since 2.42, this has been deprecated in favour of
Gio.Notification.set_priority().
-
classmethod