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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::FileAttributeInfoFlags;
use crate::FileAttributeType;
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct FileAttributeInfoList(Shared<ffi::GFileAttributeInfoList>);

    match fn {
        ref => |ptr| ffi::g_file_attribute_info_list_ref(ptr),
        unref => |ptr| ffi::g_file_attribute_info_list_unref(ptr),
        type_ => || ffi::g_file_attribute_info_list_get_type(),
    }
}

impl FileAttributeInfoList {
    #[doc(alias = "g_file_attribute_info_list_new")]
    pub fn new() -> FileAttributeInfoList {
        unsafe { from_glib_full(ffi::g_file_attribute_info_list_new()) }
    }

    #[doc(alias = "g_file_attribute_info_list_add")]
    pub fn add(&self, name: &str, type_: FileAttributeType, flags: FileAttributeInfoFlags) {
        unsafe {
            ffi::g_file_attribute_info_list_add(
                self.to_glib_none().0,
                name.to_glib_none().0,
                type_.into_glib(),
                flags.into_glib(),
            );
        }
    }

    #[doc(alias = "g_file_attribute_info_list_dup")]
    #[must_use]
    pub fn dup(&self) -> FileAttributeInfoList {
        unsafe { from_glib_full(ffi::g_file_attribute_info_list_dup(self.to_glib_none().0)) }
    }
}

impl Default for FileAttributeInfoList {
    fn default() -> Self {
        Self::new()
    }
}