glibmm 2.80.0
|
User Notifications (pop up messages). More...
#include <giomm/notification.h>
Public Types | |
enum class | Priority { NORMAL , LOW , HIGH , URGENT } |
Public Types inherited from Glib::Object | |
using | DestroyNotify = void(*)(gpointer data) |
Public Member Functions | |
Notification (Notification &&src) noexcept | |
Notification & | operator= (Notification &&src) noexcept |
~Notification () noexcept override | |
GNotification * | gobj () |
Provides access to the underlying C GObject. | |
const GNotification * | gobj () const |
Provides access to the underlying C GObject. | |
GNotification * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
void | set_title (const Glib::ustring &title) |
Sets the title of notification to title. | |
void | set_body (const Glib::ustring &body) |
Sets the body of notification to body. | |
void | set_icon (const Glib::RefPtr< Icon > &icon) |
Sets the icon of notification to icon. | |
void | set_priority (Priority priority=Priority::NORMAL) |
Sets the priority of notification to priority. | |
void | set_category (const Glib::ustring & category) |
Sets the type of notification to category. | |
void | add_button (const Glib::ustring &label, const Glib::ustring &detailed_action) |
Adds a button to notification that activates the action in detailed_action when clicked. | |
template<typename T_Value > | |
void | add_button (const Glib::ustring &label, const Glib::ustring &action, const T_Value & target) |
Adds a button that activates action when clicked. | |
void | add_button_variant (const Glib::ustring &label, const Glib::ustring &action, const Glib::VariantBase & target) |
Adds a button to notification that activates action when clicked. | |
void | set_default_action (const Glib::ustring &detailed_action) |
Sets the default action of notification to detailed_action. | |
template<typename T_Value > | |
void | set_default_action (const Glib::ustring &action, const T_Value & target) |
Sets the default action to action. | |
void | set_default_action_variant (const Glib::ustring &action, const Glib::VariantBase & target) |
Sets the default action of notification to action. | |
Public Member Functions inherited from Glib::Object | |
Object (const Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&src) noexcept | |
Object & | operator= (Object &&src) noexcept |
void * | get_data (const QueryQuark & key) |
void | set_data (const Quark & key, void *data) |
void | set_data_with_c_callback (const Quark & key, void *data, GDestroyNotify notify) |
void | set_data (const Quark & key, void *data, DestroyNotify notify) |
Prefer set_data_with_c_callback() with a callback with C linkage. | |
void | remove_data (const QueryQuark &quark) |
void * | steal_data (const QueryQuark &quark) |
Public Member Functions inherited from Glib::ObjectBase | |
ObjectBase (const ObjectBase &)=delete | |
ObjectBase & | operator= (const ObjectBase &)=delete |
void | set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value) |
You probably want to use a specific property_*() accessor method instead. | |
void | get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const |
You probably want to use a specific property_*() accessor method instead. | |
template<class PropertyType > | |
void | set_property (const Glib::ustring & property_name, const PropertyType & value) |
You probably want to use a specific property_*() accessor method instead. | |
template<class PropertyType > | |
void | get_property (const Glib::ustring & property_name, PropertyType & value) const |
You probably want to use a specific property_*() accessor method instead. | |
template<class PropertyType > | |
PropertyType | get_property (const Glib::ustring & property_name) const |
You probably want to use a specific property_*() accessor method instead. | |
sigc::connection | connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void()> &slot) |
You can use the signal_changed() signal of the property proxy instead. | |
sigc::connection | connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> &&slot) |
You can use the signal_changed() signal of the property proxy instead. | |
void | freeze_notify () |
Increases the freeze count on object. | |
void | thaw_notify () |
Reverts the effect of a previous call to freeze_notify(). | |
virtual void | reference () const |
Increment the reference count for this object. | |
virtual void | unreference () const |
Decrement the reference count for this object. | |
GObject * | gobj () |
Provides access to the underlying C GObject. | |
const GObject * | gobj () const |
Provides access to the underlying C GObject. | |
GObject * | gobj_copy () const |
Give a ref-ed copy to someone. Use for direct struct access. | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
static Glib::RefPtr< Notification > | create (const Glib::ustring &title) |
Creates a new Notification with title as its title. | |
Protected Member Functions | |
Notification (const Glib::ustring &title) | |
Protected Member Functions inherited from Glib::Object | |
Object () | |
Object (const Glib::ConstructParams &construct_params) | |
Object (GObject *castitem) | |
~Object () noexcept override | |
Protected Member Functions inherited from Glib::ObjectBase | |
ObjectBase () | |
This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. | |
ObjectBase (const char *custom_type_name) | |
A derived constructor always overrides this choice. | |
ObjectBase (const std::type_info &custom_type_info) | |
This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. | |
ObjectBase (ObjectBase &&src) noexcept | |
ObjectBase & | operator= (ObjectBase &&src) noexcept |
virtual | ~ObjectBase () noexcept=0 |
void | initialize (GObject *castitem) |
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper) |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gio::Notification > | wrap (GNotification *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Related Symbols inherited from Glib::Object | |
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false) |
User Notifications (pop up messages).
Gio::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 Gio::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().
|
strong |
|
noexcept |
|
overridenoexcept |
|
explicitprotected |
void Gio::Notification::add_button | ( | const Glib::ustring & | label, |
const Glib::ustring & | action, | ||
const T_Value & | target | ||
) |
Adds a button that activates action when clicked.
action must be an application-wide action (it must start with "app."). action will be activated with target as its parameter.
label | Label of the button. |
action | An action name. |
target | action's parameter. |
void Gio::Notification::add_button | ( | const Glib::ustring & | label, |
const Glib::ustring & | detailed_action | ||
) |
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.
label | Label of the button. |
detailed_action | A detailed action name. |
void Gio::Notification::add_button_variant | ( | const Glib::ustring & | label, |
const Glib::ustring & | action, | ||
const Glib::VariantBase & | 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-nullptr
, action will be activated with target as its parameter.
label | Label of the button. |
action | An action name. |
target | A Variant to use as action's parameter, or nullptr . |
|
static |
Creates a new Notification 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.
title | The title of the notification. |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GNotification * Gio::Notification::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
|
noexcept |
void Gio::Notification::set_body | ( | const Glib::ustring & | body | ) |
Sets the body of notification to body.
body | The new body for notification, or nullptr . |
void Gio::Notification::set_category | ( | const Glib::ustring & | category | ) |
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.
category | The category for notification, or nullptr for no category. |
void Gio::Notification::set_default_action | ( | const Glib::ustring & | action, |
const T_Value & | target | ||
) |
Sets the default action to action.
This action is activated when the notification is clicked on. It must be an application-wide action (start with "app."). 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.
action | An action name. |
target | action's parameter. |
void Gio::Notification::set_default_action | ( | const Glib::ustring & | detailed_action | ) |
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.
detailed_action | A detailed action name. |
void Gio::Notification::set_default_action_variant | ( | const Glib::ustring & | action, |
const Glib::VariantBase & | target | ||
) |
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-nullptr
, action will be activated with target as its parameter. If target is floating, it will be consumed.
When no default action is set, the application that the notification was sent on is activated.
action | An action name. |
target | A Variant to use as action's parameter, or nullptr . |
void Gio::Notification::set_icon | ( | const Glib::RefPtr< Icon > & | icon | ) |
Sets the icon of notification to icon.
icon | The icon to be shown in notification, as a Icon. |
void Gio::Notification::set_priority | ( | Priority | priority = Priority::NORMAL | ) |
Sets the priority of notification to priority.
See Gio::Notification::Priority for possible values.
priority | A Gio::Notification::Priority. |
void Gio::Notification::set_title | ( | const Glib::ustring & | title | ) |
Sets the title of notification to title.
title | The new title for notification. |
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |