Skip to main content

gtk/
buildable.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::Buildable;
4use glib::translate::*;
5use glib::IsA;
6
7mod sealed {
8    pub trait Sealed {}
9    impl<T: glib::IsA<crate::Buildable>> Sealed for T {}
10}
11
12pub trait BuildableExtManual: IsA<Buildable> + sealed::Sealed + 'static {
13    #[doc(alias = "gtk_buildable_get_name")]
14    #[doc(alias = "get_buildable_name")]
15    fn buildable_name(&self) -> Option<String> {
16        unsafe { from_glib_none(ffi::gtk_buildable_get_name(self.as_ref().to_glib_none().0)) }
17    }
18
19    #[doc(alias = "gtk_buildable_set_name")]
20    fn set_buildable_name(&self, name: &str) {
21        unsafe {
22            ffi::gtk_buildable_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
23        }
24    }
25}
26
27impl<O: IsA<Buildable>> BuildableExtManual for O {}