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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
// 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::{ffi, FileAttributeInfoFlags, FileAttributeType};
use glib::translate::*;
glib::wrapper! {
/// Acts as a lightweight registry for possible valid file attributes.
/// The registry stores Key-Value pair formats as #GFileAttributeInfos.
#[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 {
/// Creates a new file attribute info list.
///
/// # Returns
///
/// a #GFileAttributeInfoList.
#[doc(alias = "g_file_attribute_info_list_new")]
pub fn new() -> FileAttributeInfoList {
unsafe { from_glib_full(ffi::g_file_attribute_info_list_new()) }
}
/// Adds a new attribute with @name to the @self, setting
/// its @type_ and @flags.
/// ## `name`
/// the name of the attribute to add.
/// ## `type_`
/// the #GFileAttributeType for the attribute.
/// ## `flags`
/// #GFileAttributeInfoFlags for the attribute.
#[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(),
);
}
}
/// Makes a duplicate of a file attribute info list.
///
/// # Returns
///
/// a copy of the given @self.
#[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()
}
}