1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
45use crate::ffi;
6use glib::translate::*;
78glib::wrapper! {
9/// An opaque type representing a list of files.
10#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11pub struct FileList(Boxed<ffi::GdkFileList>);
1213match 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}
1920impl FileList {
21/// Creates a new [`FileList`][crate::FileList] for the given array of files.
22 ///
23 /// This function is meant to be used by language bindings.
24 /// ## `files`
25 /// the files to add to the list
26 ///
27 /// # Returns
28 ///
29 /// the newly create files list
30#[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")]
34pub fn from_array(files: &[gio::File]) -> FileList {
35assert_initialized_main_thread!();
36let n_files = files.len() as _;
37unsafe {
38from_glib_full(ffi::gdk_file_list_new_from_array(
39files.to_glib_none().0,
40n_files,
41 ))
42 }
43 }
4445/// Retrieves the list of files inside a [`FileList`][crate::FileList].
46 ///
47 /// This function is meant for language bindings.
48 ///
49 /// # Returns
50 ///
51 /// the files inside the list
52#[doc(alias = "gdk_file_list_get_files")]
53 #[doc(alias = "get_files")]
54pub fn files(&self) -> Vec<gio::File> {
55unsafe {
56FromGlibPtrContainer::from_glib_container(ffi::gdk_file_list_get_files(mut_override(
57self.to_glib_none().0,
58 )))
59 }
60 }
61}