gtk: Add include_internals param
use gtk_sys;
use glib::translate::*;
+use glib_sys::gboolean;
use glib::subclass::prelude::*;
@@ -36,8 +37,13 @@ pub trait ContainerImpl: ContainerImplExt + WidgetImpl {
self.parent_get_path_for_child(container, widget)
}
- fn forall<P: FnMut(&Widget)>(&self, container: &Container, callback: P) {
- self.parent_forall(container, callback);
+ fn forall<P: FnMut(&Widget)>(
+ &self,
+ container: &Container,
+ include_internals: gboolean,
+ callback: P,
+ ) {
+ self.parent_forall(container, include_internals, callback);
}
}
@@ -48,7 +54,12 @@ pub trait ContainerImplExt {
fn parent_set_focus_child(&self, container: &Container, widget: Option<&Widget>);
fn parent_child_type(&self, container: &Container) -> glib::Type;
fn parent_get_path_for_child(&self, container: &Container, widget: &Widget) -> WidgetPath;
- fn parent_forall<P: FnMut(&Widget)>(&self, container: &Container, callback: P);
+ fn parent_forall<P: FnMut(&Widget)>(
+ &self,
+ container: &Container,
+ include_internals: gboolean,
+ callback: P,
+ );
}
impl<T: ContainerImpl> ContainerImplExt for T {
@@ -115,12 +126,21 @@ impl<T: ContainerImpl> ContainerImplExt for T {
}
}
- fn parent_forall<P: FnMut(&Widget)>(&self, container: &Container, callback: P) {
+ fn parent_forall<P: FnMut(&Widget)>(
+ &self,
+ container: &Container,
+ include_internals: gboolean,
+ callback: P,
+ ) {
unsafe {
let data = self.get_type_data();
let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkContainerClass;
if let Some(f) = (*parent_class).forall {
- f(container.to_glib_none().0, false, callback.to_glib_none().0)
+ f(
+ container.to_glib_none().0,
+ include_internals,
+ callback.to_glib_none().0,
+ )
}
}
}
@@ -209,14 +229,14 @@ unsafe extern "C" fn container_get_path_for_child<T: ContainerImpl>(
unsafe extern "C" fn container_forall<T: ObjectSubclass, P: FnMut(&Widget)>(
ptr: *mut gtk_sys::GtkContainer,
- callback: P
-)
-where
+ include_internals: gboolean,
+ callback: P,
+) where
T: ContainerImpl,
{
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Container> = from_glib_borrow(ptr);
- imp.forall(&wrap, callback)
+ imp.forall(&wrap, include_internals, callback)
}
