mirror of
https://github.com/szymon-jozef/libnotify-rs.git
synced 2026-10-27 19:20:43 +01:00
feat: implement get_closed_reason
This commit is contained in:
@@ -7,10 +7,20 @@ pub enum Urgency {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub enum ClosedReason {
|
pub enum ClosedReason {
|
||||||
|
/// Notification not closed
|
||||||
Unset,
|
Unset,
|
||||||
|
/// Timeout has expired
|
||||||
Expired,
|
Expired,
|
||||||
|
/// It has been dismissed by the user
|
||||||
|
Dismissed,
|
||||||
|
/// It has been closed by a call to `notify_notification_close()`
|
||||||
ApiRequest,
|
ApiRequest,
|
||||||
|
/// Closed by undefined/reserved reasons
|
||||||
Undefined,
|
Undefined,
|
||||||
|
|
||||||
|
/// This variant is returned only if libnotify returns some weird enum value, which should never
|
||||||
|
/// happen
|
||||||
|
Invalid,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enum representing `[GVariant](https://docs.gtk.org/glib/struct.Variant.html)`
|
/// Enum representing `[GVariant](https://docs.gtk.org/glib/struct.Variant.html)`
|
||||||
@@ -137,7 +147,14 @@ impl<'a> Notification {
|
|||||||
///
|
///
|
||||||
/// This is valid only after the Notification::closed signal is emitted.
|
/// This is valid only after the Notification::closed signal is emitted.
|
||||||
pub fn get_closed_reason(&self) -> ClosedReason {
|
pub fn get_closed_reason(&self) -> ClosedReason {
|
||||||
todo!();
|
match unsafe { notify_notification_get_closed_reason(self.inner) } {
|
||||||
|
NotifyClosedReason_NOTIFY_CLOSED_REASON_UNSET => ClosedReason::Unset,
|
||||||
|
NotifyClosedReason_NOTIFY_CLOSED_REASON_EXPIRED => ClosedReason::Expired,
|
||||||
|
NotifyClosedReason_NOTIFY_CLOSED_REASON_DISMISSED => ClosedReason::Dismissed,
|
||||||
|
NotifyClosedReason_NOTIFY_CLOSED_REASON_API_REQUEST => ClosedReason::ApiRequest,
|
||||||
|
NotifyClosedReason_NOTIFY_CLOSED_REASON_UNDEFINED => ClosedReason::Undefined,
|
||||||
|
_ => ClosedReason::Invalid,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the application icon for the notification.
|
/// Sets the application icon for the notification.
|
||||||
|
|||||||
Reference in New Issue
Block a user