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
// Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de)
// from /usr/share/gir-1.0 (@ ???)
// DO NOT EDIT
use glib::translate::*;
glib::wrapper! {
/// An object used for passing details around.
///
/// # Implements
///
/// [`trait@glib::ObjectExt`]
#[doc(alias = "PolkitDetails")]
pub struct Details(Object<ffi::PolkitDetails, ffi::PolkitDetailsClass>);
match fn {
type_ => || ffi::polkit_details_get_type(),
}
}
impl Details {
/// Creates a new [`Details`][crate::Details] object.
///
/// # Returns
///
/// A [`Details`][crate::Details] object. Free with `g_object_unref()`.
#[doc(alias = "polkit_details_new")]
pub fn new() -> Details {
unsafe { from_glib_full(ffi::polkit_details_new()) }
}
/// Gets a list of all keys on `self`.
///
/// # Returns
///
/// [`None`] if there are no keys
/// otherwise an array of strings that should be freed with
/// `g_strfreev()`.
#[doc(alias = "polkit_details_get_keys")]
#[doc(alias = "get_keys")]
pub fn keys(&self) -> Vec<glib::GString> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::polkit_details_get_keys(
self.to_glib_none().0,
))
}
}
/// Inserts a copy of `key` and `value` on `self`.
///
/// If `value` is [`None`], the key will be removed.
/// ## `key`
/// A key.
/// ## `value`
/// A value.
#[doc(alias = "polkit_details_insert")]
pub fn insert(&self, key: &str, value: Option<&str>) {
unsafe {
ffi::polkit_details_insert(
self.to_glib_none().0,
key.to_glib_none().0,
value.to_glib_none().0,
);
}
}
/// Gets the value for `key` on `self`.
/// ## `key`
/// A key.
///
/// # Returns
///
/// [`None`] if there is no value for `key`, otherwise a string owned by `self`.
#[doc(alias = "polkit_details_lookup")]
pub fn lookup(&self, key: &str) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::polkit_details_lookup(
self.to_glib_none().0,
key.to_glib_none().0,
))
}
}
}
impl Default for Details {
fn default() -> Self {
Self::new()
}
}