1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// This file was generated by gir (89daf8f) from gir-files (1f01de0)
// DO NOT EDIT

use ffi;
use glib::translate::*;
use std;

/// The urgency level of the notification.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum Urgency {
    /// Low urgency. Used for unimportant notifications.
    Low,
    /// Normal urgency. Used for most standard notifications.
    Normal,
    /// Critical urgency. Used for very important notifications.
    Critical,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for Urgency {
    type GlibType = ffi::NotifyUrgency;

    fn to_glib(&self) -> ffi::NotifyUrgency {
        match *self {
            Urgency::Low => ffi::NOTIFY_URGENCY_LOW,
            Urgency::Normal => ffi::NOTIFY_URGENCY_NORMAL,
            Urgency::Critical => ffi::NOTIFY_URGENCY_CRITICAL,
            Urgency::__Unknown(value) => unsafe { std::mem::transmute(value) },
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::NotifyUrgency> for Urgency {
    fn from_glib(value: ffi::NotifyUrgency) -> Self {
        match value as i32 {
            0 => Urgency::Low,
            1 => Urgency::Normal,
            2 => Urgency::Critical,
            value => Urgency::__Unknown(value),
        }
    }
}