Struct notify_rust::Notification
[−]
[src]
pub struct Notification {
pub appname: String,
pub summary: String,
pub body: String,
pub icon: String,
pub actions: Vec<String>,
pub timeout: i32,
}Desktop Notification.
A desktop notification is configured via builder pattern, before it is launched with show().
Fields
appname: String
summary: String
body: String
icon: String
actions: Vec<String>
timeout: i32
Methods
impl Notification[src]
fn new() -> Notification
Constructs a new Notification.
Most fields are empty by default, only appname is prefilled with the name of the current
executable.
The appname is used by some desktop environments to group notifications.
fn appname(&mut self, appname: &str) -> &mut Notification
Overwrite the appname field used for Notification.
fn summary(&mut self, summary: &str) -> &mut Notification
Set the summary.
Often acts as title of the notification. For more elaborate content use the body field.
fn body(&mut self, body: &str) -> &mut Notification
Set the content of the body field.
Multiline textual content of the notification. Each line should be treated as a paragraph. Simple html markup should be supported, depending on the server implementation.
fn icon(&mut self, icon: &str) -> &mut Notification
Set the icon field.
You can use commom icon names here, usually those in /usr/share/icons
can all be used.
You can also use an absolute path to file.
fn timeout(&mut self, timeout: i32) -> &mut Notification
Set the timeout.
This sets the time (in miliseconds) from the time the notification is displayed until it is closed again by the Notification Server. According to specification -1 will leave the timeout to be set by the server and 0 will cause the notification never to expire.
fn actions(&mut self, actions: Vec<String>) -> &mut Notification
Set actions.
To quote http://www.galago-project.org/specs/notification/0.9/x408.html#command-notify
Actions are sent over as a list of pairs. Each even element in the list (starting at index 0) represents the identifier for the action. Each odd element in the list is the localized string that will be displayed to the user.
There is nothing fancy going on here yet.
fn finalize(&self) -> Notification
Finalizes a Notification.
Part of the builder pattern, returns a complete copy of the built notification.
fn show(&self) -> u32
Sends Notification to DBus.
Returns id from DBus.
fn send(&self) -> u32
Deprecated, please use show()
fn show_debug(&self) -> u32
Wraps show() but prints notification to stdout.
fn send_debug(&self) -> u32
Deprecated, please use show_debug()
fn get_capabilities() -> Vec<String>
Get list of all capabilities of the running Notification Server.