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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de)
// from /usr/share/gir-1.0 (@ ???)
// DO NOT EDIT
use crate::Subject;
use glib::translate::*;
glib::wrapper! {
/// Object used to describe a temporary authorization.
///
/// # Implements
///
/// [`trait@glib::ObjectExt`]
#[doc(alias = "PolkitTemporaryAuthorization")]
pub struct TemporaryAuthorization(Object<ffi::PolkitTemporaryAuthorization, ffi::PolkitTemporaryAuthorizationClass>);
match fn {
type_ => || ffi::polkit_temporary_authorization_get_type(),
}
}
impl TemporaryAuthorization {
/// Gets the action that `self` is for.
///
/// # Returns
///
/// A string owned by `self`. Do not free.
#[doc(alias = "polkit_temporary_authorization_get_action_id")]
#[doc(alias = "get_action_id")]
pub fn action_id(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::polkit_temporary_authorization_get_action_id(
self.to_glib_none().0,
))
}
}
/// Gets the opaque identifier for `self`.
///
/// # Returns
///
/// A string owned by `self`. Do not free.
#[doc(alias = "polkit_temporary_authorization_get_id")]
#[doc(alias = "get_id")]
pub fn id(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::polkit_temporary_authorization_get_id(
self.to_glib_none().0,
))
}
}
/// Gets the subject that `self` is for.
///
/// # Returns
///
/// A [`Subject`][crate::Subject], free with `g_object_unref()`.
#[doc(alias = "polkit_temporary_authorization_get_subject")]
#[doc(alias = "get_subject")]
pub fn subject(&self) -> Subject {
unsafe {
from_glib_full(ffi::polkit_temporary_authorization_get_subject(
self.to_glib_none().0,
))
}
}
/// Gets the time when `self` will expire.
///
/// (Note that the PolicyKit daemon is using monotonic time internally
/// so the returned value may change if system time changes.)
///
/// # Returns
///
/// Seconds since the Epoch Jan 1. 1970, 0:00 UTC.
#[doc(alias = "polkit_temporary_authorization_get_time_expires")]
#[doc(alias = "get_time_expires")]
pub fn time_expires(&self) -> u64 {
unsafe { ffi::polkit_temporary_authorization_get_time_expires(self.to_glib_none().0) }
}
/// Gets the time when `self` was obtained.
///
/// (Note that the PolicyKit daemon is using monotonic time internally
/// so the returned value may change if system time changes.)
///
/// # Returns
///
/// Seconds since the Epoch Jan 1. 1970, 0:00 UTC.
#[doc(alias = "polkit_temporary_authorization_get_time_obtained")]
#[doc(alias = "get_time_obtained")]
pub fn time_obtained(&self) -> u64 {
unsafe { ffi::polkit_temporary_authorization_get_time_obtained(self.to_glib_none().0) }
}
}