Skip to content

Commit ed44365

Browse files
fbrouillesdroege
authored andcommitted
Implement gio::FileInfo::set_attribute
Closes #40 Signed-off-by: fbrouille <fbrouille@users.noreply.github.com>
1 parent 5059cf5 commit ed44365

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

gio/src/file_info.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77

88
use glib::{translate::*, StrV};
99

10-
use crate::{ffi, FileInfo};
10+
use crate::{ffi, FileAttributeValue, FileInfo};
1111

1212
impl FileInfo {
1313
#[cfg_attr(feature = "v2_62", deprecated)]
@@ -71,4 +71,17 @@ impl FileInfo {
7171
});
7272
}
7373
}
74+
75+
#[doc(alias = "g_file_info_set_attribute")]
76+
pub fn set_attribute<'a>(&self, attribute: &str, value: impl Into<FileAttributeValue<'a>>) {
77+
unsafe {
78+
let value: FileAttributeValue<'a> = value.into();
79+
ffi::g_file_info_set_attribute(
80+
self.to_glib_none().0,
81+
attribute.to_glib_none().0,
82+
value.type_().into_glib(),
83+
value.as_ptr(),
84+
);
85+
}
86+
}
7487
}

0 commit comments

Comments
 (0)