gtk/tree_row_reference.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::TreePath;
4use crate::TreeRowReference;
5use crate::{TreeIter, ffi};
6use glib::object::IsA;
7use glib::translate::*;
8use libc::c_int;
9
10impl TreeRowReference {
11 // rustdoc-stripper-ignore-next
12 /// This is unsafe because new_order bounds can't be checked.
13 // rustdoc-stripper-ignore-next-stop
14 /// Lets a set of row reference created by
15 /// [`new_proxy()`][Self::new_proxy()] know that the
16 /// model emitted the [`rows-reordered`][struct@crate::TreeModel#rows-reordered] signal.
17 /// ## `proxy`
18 /// a [`glib::Object`][crate::glib::Object]
19 /// ## `path`
20 /// the parent path of the reordered signal
21 /// ## `iter`
22 /// the iter pointing to the parent of the reordered
23 /// ## `new_order`
24 /// the new order of rows
25 #[allow(clippy::missing_safety_doc)]
26 #[doc(alias = "gtk_tree_row_reference_reordered")]
27 pub unsafe fn reordered<T: IsA<glib::Object>>(
28 proxy: &T,
29 path: &TreePath,
30 iter: Option<&TreeIter>,
31 new_order: &[u32],
32 ) {
33 unsafe {
34 assert_initialized_main_thread!();
35 assert!(
36 iter.is_some() || path.depth() == 0,
37 "If 'iter' is None, 'path' must point to the root."
38 );
39 ffi::gtk_tree_row_reference_reordered(
40 proxy.as_ref().to_glib_none().0,
41 mut_override(path.to_glib_none().0),
42 mut_override(iter.to_glib_none().0),
43 mut_override(new_order.as_ptr() as *const c_int),
44 );
45 }
46 }
47}