use crate::{FileAttributeInfoFlags, 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()
}
}