Add missing child property for Hdy.Deck

This commit is contained in:
Felix Häcker 2020-08-28 14:27:05 +02:00
parent f165d56cb4
commit 4bbd4b2f35
2 changed files with 33 additions and 0 deletions

View file

@ -124,6 +124,9 @@ generate_builder = true
name = "Handy.Deck"
status = "generate"
generate_builder = true
[[object.child_prop]]
name = "name"
type = "utf8"
[[object]]
name = "Handy.ExpanderRow"

View file

@ -520,6 +520,10 @@ pub trait DeckExt: 'static {
fn set_property_vhomogeneous(&self, vhomogeneous: bool);
fn get_child_name<T: IsA<Widget>>(&self, item: &T) -> Option<GString>;
fn set_child_name<T: IsA<Widget>>(&self, item: &T, name: Option<&str>);
fn connect_property_can_swipe_back_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
@ -784,6 +788,32 @@ impl<O: IsA<Deck>> DeckExt for O {
}
}
fn get_child_name<T: IsA<Widget>>(&self, item: &T) -> Option<GString> {
unsafe {
let mut value = Value::from_type(<GString as StaticType>::static_type());
gtk_sys::gtk_container_child_get_property(
self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
item.to_glib_none().0 as *mut _,
b"name\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `name` getter")
}
}
fn set_child_name<T: IsA<Widget>>(&self, item: &T, name: Option<&str>) {
unsafe {
gtk_sys::gtk_container_child_set_property(
self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
item.to_glib_none().0 as *mut _,
b"name\0".as_ptr() as *const _,
Value::from(name).to_glib_none().0,
);
}
}
fn connect_property_can_swipe_back_notify<F: Fn(&Self) + 'static>(
&self,
f: F,