1use glib::translate::*;
4use libc::c_char;
5
6pub struct RecentData {
9 pub display_name: Option<String>,
10 pub description: Option<String>,
11 pub mime_type: String,
12 pub app_name: String,
13 pub app_exec: String,
14 pub groups: Vec<String>,
15 pub is_private: bool,
16}
17
18#[doc(hidden)]
19impl<'a> ToGlibPtr<'a, *mut ffi::GtkRecentData> for RecentData {
20 type Storage = (
21 Box<ffi::GtkRecentData>,
22 [Stash<'a, *mut c_char, Option<String>>; 2],
23 [Stash<'a, *mut c_char, String>; 3],
24 Stash<'a, *mut *mut c_char, [String]>,
25 );
26
27 fn to_glib_none(&'a self) -> Stash<'a, *mut ffi::GtkRecentData, Self> {
28 let display_name = self.display_name.to_glib_none();
29 let description = self.description.to_glib_none();
30 let mime_type = self.mime_type.to_glib_none();
31 let app_name = self.app_name.to_glib_none();
32 let app_exec = self.app_exec.to_glib_none();
33 let groups = self.groups.to_glib_none();
34
35 let mut data = Box::new(ffi::GtkRecentData {
36 display_name: display_name.0,
37 description: description.0,
38 mime_type: mime_type.0,
39 app_name: app_name.0,
40 app_exec: app_exec.0,
41 groups: groups.0,
42 is_private: self.is_private.into_glib(),
43 });
44
45 Stash(
46 &mut *data,
47 (
48 data,
49 [display_name, description],
50 [mime_type, app_name, app_exec],
51 groups,
52 ),
53 )
54 }
55}