[]Struct gio::Notification

pub struct Notification(_, _);

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.

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 ApplicationExt::send_notification.

Implements

glib::object::ObjectExt

Methods

impl Notification[src]

pub fn new(title: &str) -> Notification[src]

Creates a new Notification with title as its title.

After populating notification with more details, it can be sent to the desktop shell with ApplicationExt::send_notification. Changing any properties after this call will not have any effect until resending notification.

title

the title of the notification

Returns

a new Notification instance

pub fn add_button(&self, label: &str, detailed_action: &str)[src]

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 Action::parse_detailed_name for a description of the format for detailed_action.

label

label of the button

detailed_action

a detailed action name

pub fn add_button_with_target_value(
    &self,
    label: &str,
    action: &str,
    target: Option<&Variant>
)
[src]

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.

label

label of the button

action

an action name

target

a glib::Variant to use as action's parameter, or None

pub fn set_body(&self, body: Option<&str>)[src]

Sets the body of self to body.

body

the new body for self, or None

pub fn set_default_action(&self, detailed_action: &str)[src]

Sets 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 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

pub fn set_default_action_and_target_value(
    &self,
    action: &str,
    target: Option<&Variant>
)
[src]

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.

action

an action name

target

a glib::Variant to use as action's parameter, or None

pub fn set_icon<P: IsA<Icon>>(&self, icon: &P)[src]

Sets the icon of self to icon.

icon

the icon to be shown in self, as a Icon

pub fn set_priority(&self, priority: NotificationPriority)[src]

Sets the priority of self to priority. See NotificationPriority for possible values.

priority

a NotificationPriority

pub fn set_title(&self, title: &str)[src]

Sets the title of self to title.

title

the new title for self

Trait Implementations

impl Clone for Notification

impl Debug for Notification

impl Display for Notification[src]

impl Eq for Notification

impl Hash for Notification

impl Ord for Notification

impl<T: ObjectType> PartialEq<T> for Notification

impl<T: ObjectType> PartialOrd<T> for Notification

impl StaticType for Notification

Auto Trait Implementations

impl RefUnwindSafe for Notification

impl !Send for Notification

impl !Sync for Notification

impl Unpin for Notification

impl UnwindSafe for Notification

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> Cast for T where
    T: ObjectType
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.