Package ch.bailu.gtk.gio
Class Notification
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gio.Notification
- All Implemented Interfaces:
PointerInterface
#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 #GNotification and other similar APIs is
that, if supported by the desktop environment, notifications sent
with #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 #GNotification should be able to be
started as a D-Bus service, using #GApplication.
In order for #GNotification to work, the application must have installed
a `.desktop` file. For example:
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 g_application_new().
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 g_application_send_notification().
to the user -- typically as a pop-up notification presented by the
desktop environment shell.
The key difference between #GNotification and other similar APIs is
that, if supported by the desktop environment, notifications sent
with #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 #GNotification should be able to be
started as a D-Bus service, using #GApplication.
In order for #GNotification 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 g_application_new().
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 g_application_send_notification().
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
ConstructorDescriptionNotification
(PointerContainer pointer) Notification
(Str title) Creates a new #GNotification with @title as its title.Notification
(String title) Creates a new #GNotification with @title as its title. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a button to @notification that activates the action in
@detailed_action when clicked.void
Adds a button to @notification that activates the action in
@detailed_action when clicked.void
addButtonWithTarget
(Str label, Str action, Str target_format, Object... _elipse) Adds a button to @notification that activates @action when clicked.void
addButtonWithTarget
(String label, String action, String target_format, Object... _elipse) Adds a button to @notification that activates @action when clicked.void
addButtonWithTargetValue
(Str label, Str action, Variant target) Adds a button to @notification that activates @action when clicked.void
addButtonWithTargetValue
(String label, String action, Variant target) Adds a button to @notification that activates @action when clicked.static ClassHandler
static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
void
Sets the body of @notification to @body.void
Sets the body of @notification to @body.void
setCategory
(Str category) Sets the type of @notification to @category.void
setCategory
(String category) Sets the type of @notification to @category.void
setDefaultAction
(Str detailed_action) Sets the default action of @notification to @detailed_action.void
setDefaultAction
(String detailed_action) Sets the default action of @notification to @detailed_action.void
setDefaultActionAndTarget
(Str action, Str target_format, Object... _elipse) Sets the default action of @notification to @action.void
setDefaultActionAndTarget
(String action, String target_format, Object... _elipse) Sets the default action of @notification to @action.void
setDefaultActionAndTargetValue
(Str action, Variant target) Sets the default action of @notification to @action.void
setDefaultActionAndTargetValue
(String action, Variant target) Sets the default action of @notification to @action.void
Sets the icon of @notification to @icon.void
setPriority
(int priority) Sets the priority of @notification to @priority.void
Sets the title of @notification to @title.void
Sets the title of @notification to @title.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
Notification
-
Notification
Creates a new #GNotification with @title as its title.
After populating @notification with more details, it can be sent to
the desktop shell with g_application_send_notification(). Changing
any properties after this call will not have any effect until
resending @notification.- Parameters:
title
- the title of the notification
-
Notification
Creates a new #GNotification with @title as its title.
After populating @notification with more details, it can be sent to
the desktop shell with g_application_send_notification(). Changing
any properties after this call will not have any effect until
resending @notification.- Parameters:
title
- the title of the notification
-
-
Method Details
-
getClassHandler
-
addButton
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.- Parameters:
label
- label of the buttondetailed_action
- a detailed action name
-
addButton
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.- Parameters:
label
- label of the buttondetailed_action
- a detailed action name
-
addButtonWithTarget
public void addButtonWithTarget(@Nonnull Str label, @Nonnull Str action, @Nullable Str target_format, Object... _elipse) Adds a button to @notification that activates @action when clicked.
@action must be an application-wide action (it must start with "app.").
If @target_format is given, it is used to collect remaining
positional parameters into a #GVariant instance, similar to
g_variant_new(). @action will be activated with that #GVariant as its
parameter.- Parameters:
label
- label of the buttonaction
- an action nametarget_format
- a #GVariant format string, or %NULL_elipse
- positional parameters, as determined by @target_format
-
addButtonWithTarget
public void addButtonWithTarget(String label, String action, String target_format, Object... _elipse) Adds a button to @notification that activates @action when clicked.
@action must be an application-wide action (it must start with "app.").
If @target_format is given, it is used to collect remaining
positional parameters into a #GVariant instance, similar to
g_variant_new(). @action will be activated with that #GVariant as its
parameter.- Parameters:
label
- label of the buttonaction
- an action nametarget_format
- a #GVariant format string, or %NULL_elipse
- positional parameters, as determined by @target_format
-
addButtonWithTargetValue
public void addButtonWithTargetValue(@Nonnull Str label, @Nonnull Str action, @Nullable Variant target) 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.- Parameters:
label
- label of the buttonaction
- an action nametarget
- a #GVariant to use as @action's parameter, or %NULL
-
addButtonWithTargetValue
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.- Parameters:
label
- label of the buttonaction
- an action nametarget
- a #GVariant to use as @action's parameter, or %NULL
-
setBody
Sets the body of @notification to @body.- Parameters:
body
- the new body for @notification, or %NULL
-
setBody
Sets the body of @notification to @body.- Parameters:
body
- the new body for @notification, or %NULL
-
setCategory
Sets the type of @notification to @category. Categories have a main
type like `email`, `im` or `device` and can have a detail separated
by a `.`, e.g. `im.received` or `email.arrived`. Setting the category
helps the notification server to select proper feedback to the user.
Standard categories are [listed in the specification](https://specifications.freedesktop.org/notification-spec/latest/ar01s06.html).- Parameters:
category
- the category for @notification, or %NULL for no category
-
setCategory
Sets the type of @notification to @category. Categories have a main
type like `email`, `im` or `device` and can have a detail separated
by a `.`, e.g. `im.received` or `email.arrived`. Setting the category
helps the notification server to select proper feedback to the user.
Standard categories are [listed in the specification](https://specifications.freedesktop.org/notification-spec/latest/ar01s06.html).- Parameters:
category
- the category for @notification, or %NULL for no category
-
setDefaultAction
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.- Parameters:
detailed_action
- a detailed action name
-
setDefaultAction
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.- Parameters:
detailed_action
- a detailed action name
-
setDefaultActionAndTarget
public void setDefaultActionAndTarget(@Nonnull Str action, @Nullable Str target_format, Object... _elipse) 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 (it must start with "app.").
If @target_format is given, it is used to collect remaining
positional parameters into a #GVariant instance, similar to
g_variant_new(). @action will be activated with that #GVariant as its
parameter.
When no default action is set, the application that the notification
was sent on is activated.- Parameters:
action
- an action nametarget_format
- a #GVariant format string, or %NULL_elipse
- positional parameters, as determined by @target_format
-
setDefaultActionAndTarget
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 (it must start with "app.").
If @target_format is given, it is used to collect remaining
positional parameters into a #GVariant instance, similar to
g_variant_new(). @action will be activated with that #GVariant as its
parameter.
When no default action is set, the application that the notification
was sent on is activated.- Parameters:
action
- an action nametarget_format
- a #GVariant format string, or %NULL_elipse
- positional parameters, as determined by @target_format
-
setDefaultActionAndTargetValue
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.- Parameters:
action
- an action nametarget
- a #GVariant to use as @action's parameter, or %NULL
-
setDefaultActionAndTargetValue
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.- Parameters:
action
- an action nametarget
- a #GVariant to use as @action's parameter, or %NULL
-
setIcon
Sets the icon of @notification to @icon.- Parameters:
icon
- the icon to be shown in @notification, as a #GIcon
-
setPriority
public void setPriority(int priority) Sets the priority of @notification to @priority. See
#GNotificationPriority for possible values.- Parameters:
priority
- a #GNotificationPriority
-
setTitle
Sets the title of @notification to @title.- Parameters:
title
- the new title for @notification
-
setTitle
Sets the title of @notification to @title.- Parameters:
title
- the new title for @notification
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-