1use crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
10 pub struct FileList(Boxed<ffi::GdkFileList>);
11
12 match fn {
13 copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gdk_file_list_get_type(), ptr as *mut _) as *mut ffi::GdkFileList,
14 free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gdk_file_list_get_type(), ptr as *mut _),
15 type_ => || ffi::gdk_file_list_get_type(),
16 }
17}
18
19impl FileList {
20 #[cfg(feature = "v4_8")]
21 #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
22 #[doc(alias = "gdk_file_list_new_from_array")]
23 #[doc(alias = "new_from_array")]
24 pub fn from_array(files: &[gio::File]) -> FileList {
25 assert_initialized_main_thread!();
26 let n_files = files.len() as _;
27 unsafe {
28 from_glib_full(ffi::gdk_file_list_new_from_array(
29 files.to_glib_none().0,
30 n_files,
31 ))
32 }
33 }
34
35 #[doc(alias = "gdk_file_list_get_files")]
36 #[doc(alias = "get_files")]
37 pub fn files(&self) -> Vec<gio::File> {
38 unsafe {
39 FromGlibPtrContainer::from_glib_container(ffi::gdk_file_list_get_files(mut_override(
40 self.to_glib_none().0,
41 )))
42 }
43 }
44}