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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
use glib::translate::*;
use std::mem;
use std::ptr;
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RecentInfo(Shared<ffi::GtkRecentInfo>);
match fn {
ref => |ptr| ffi::gtk_recent_info_ref(ptr),
unref => |ptr| ffi::gtk_recent_info_unref(ptr),
type_ => || ffi::gtk_recent_info_get_type(),
}
}
impl RecentInfo {
#[doc(alias = "gtk_recent_info_create_app_info")]
pub fn create_app_info(
&self,
app_name: Option<&str>,
) -> Result<Option<gio::AppInfo>, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::gtk_recent_info_create_app_info(
self.to_glib_none().0,
app_name.to_glib_none().0,
&mut error,
);
if error.is_null() {
Ok(from_glib_full(ret))
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gtk_recent_info_exists")]
pub fn exists(&self) -> bool {
unsafe { from_glib(ffi::gtk_recent_info_exists(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_added")]
#[doc(alias = "get_added")]
pub fn added(&self) -> glib::DateTime {
unsafe { from_glib_none(ffi::gtk_recent_info_get_added(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_age")]
#[doc(alias = "get_age")]
pub fn age(&self) -> i32 {
unsafe { ffi::gtk_recent_info_get_age(self.to_glib_none().0) }
}
#[doc(alias = "gtk_recent_info_get_application_info")]
#[doc(alias = "get_application_info")]
pub fn application_info(&self, app_name: &str) -> Option<(glib::GString, u32, glib::DateTime)> {
unsafe {
let mut app_exec = ptr::null();
let mut count = mem::MaybeUninit::uninit();
let mut stamp = ptr::null_mut();
let ret = from_glib(ffi::gtk_recent_info_get_application_info(
self.to_glib_none().0,
app_name.to_glib_none().0,
&mut app_exec,
count.as_mut_ptr(),
&mut stamp,
));
let count = count.assume_init();
if ret {
Some((from_glib_none(app_exec), count, from_glib_none(stamp)))
} else {
None
}
}
}
#[doc(alias = "gtk_recent_info_get_applications")]
#[doc(alias = "get_applications")]
pub fn applications(&self) -> Vec<glib::GString> {
unsafe {
let mut length = mem::MaybeUninit::uninit();
let ret = FromGlibContainer::from_glib_full_num(
ffi::gtk_recent_info_get_applications(self.to_glib_none().0, length.as_mut_ptr()),
length.assume_init() as usize,
);
ret
}
}
#[doc(alias = "gtk_recent_info_get_description")]
#[doc(alias = "get_description")]
pub fn description(&self) -> glib::GString {
unsafe { from_glib_none(ffi::gtk_recent_info_get_description(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_display_name")]
#[doc(alias = "get_display_name")]
pub fn display_name(&self) -> glib::GString {
unsafe { from_glib_none(ffi::gtk_recent_info_get_display_name(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_gicon")]
#[doc(alias = "get_gicon")]
pub fn gicon(&self) -> Option<gio::Icon> {
unsafe { from_glib_full(ffi::gtk_recent_info_get_gicon(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_groups")]
#[doc(alias = "get_groups")]
pub fn groups(&self) -> Vec<glib::GString> {
unsafe {
let mut length = mem::MaybeUninit::uninit();
let ret = FromGlibContainer::from_glib_full_num(
ffi::gtk_recent_info_get_groups(self.to_glib_none().0, length.as_mut_ptr()),
length.assume_init() as usize,
);
ret
}
}
#[doc(alias = "gtk_recent_info_get_mime_type")]
#[doc(alias = "get_mime_type")]
pub fn mime_type(&self) -> glib::GString {
unsafe { from_glib_none(ffi::gtk_recent_info_get_mime_type(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_modified")]
#[doc(alias = "get_modified")]
pub fn modified(&self) -> glib::DateTime {
unsafe { from_glib_none(ffi::gtk_recent_info_get_modified(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_private_hint")]
#[doc(alias = "get_private_hint")]
pub fn is_private_hint(&self) -> bool {
unsafe { from_glib(ffi::gtk_recent_info_get_private_hint(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_short_name")]
#[doc(alias = "get_short_name")]
pub fn short_name(&self) -> glib::GString {
unsafe { from_glib_full(ffi::gtk_recent_info_get_short_name(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_uri")]
#[doc(alias = "get_uri")]
pub fn uri(&self) -> glib::GString {
unsafe { from_glib_none(ffi::gtk_recent_info_get_uri(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_uri_display")]
#[doc(alias = "get_uri_display")]
pub fn uri_display(&self) -> Option<glib::GString> {
unsafe { from_glib_full(ffi::gtk_recent_info_get_uri_display(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_get_visited")]
#[doc(alias = "get_visited")]
pub fn visited(&self) -> glib::DateTime {
unsafe { from_glib_none(ffi::gtk_recent_info_get_visited(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_has_application")]
pub fn has_application(&self, app_name: &str) -> bool {
unsafe {
from_glib(ffi::gtk_recent_info_has_application(
self.to_glib_none().0,
app_name.to_glib_none().0,
))
}
}
#[doc(alias = "gtk_recent_info_has_group")]
pub fn has_group(&self, group_name: &str) -> bool {
unsafe {
from_glib(ffi::gtk_recent_info_has_group(
self.to_glib_none().0,
group_name.to_glib_none().0,
))
}
}
#[doc(alias = "gtk_recent_info_is_local")]
pub fn is_local(&self) -> bool {
unsafe { from_glib(ffi::gtk_recent_info_is_local(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_last_application")]
pub fn last_application(&self) -> glib::GString {
unsafe { from_glib_full(ffi::gtk_recent_info_last_application(self.to_glib_none().0)) }
}
#[doc(alias = "gtk_recent_info_match")]
#[doc(alias = "match")]
pub fn match_(&self, info_b: &RecentInfo) -> bool {
unsafe {
from_glib(ffi::gtk_recent_info_match(
self.to_glib_none().0,
info_b.to_glib_none().0,
))
}
}
}