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