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
use glib_container::GlibContainer;
use ffi;
pub struct Permission {
pointer: *mut ffi::GPermission
}
impl Permission {
pub fn get_allowed(&self) -> bool {
match unsafe { ffi::g_permission_get_allowed(self.pointer) } {
0 => false,
_ => true
}
}
pub fn get_can_acquire(&self) -> bool {
match unsafe { ffi::g_permission_get_can_acquire(self.pointer) } {
0 => false,
_ => true
}
}
pub fn get_can_release(&self) -> bool {
match unsafe { ffi::g_permission_get_can_release(self.pointer) } {
0 => false,
_ => true
}
}
pub fn impl_update(&self, allowed: bool, can_acquire: bool, can_release: bool) {
unsafe { ffi::g_permission_impl_update(self.pointer,
if allowed == true { 1 } else { 0 },
if can_acquire == true { 1 } else { 0 },
if can_release == true { 1 } else { 0 }) }
}
}
impl GlibContainer<*mut ffi::GPermission> for Permission {
fn wrap(pointer: *mut ffi::GPermission) -> Permission {
Permission {
pointer: pointer
}
}
fn unwrap(&self) -> *mut ffi::GPermission {
self.pointer
}
}