gtk/
tree_row_reference.rs

1// Copyright 2013-2017, The Gtk-rs Project Developers.
2// See the COPYRIGHT file at the top-level directory of this distribution.
3// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4
5use glib;
6use glib::object::IsA;
7use glib::translate::*;
8use gtk_sys;
9use libc::c_int;
10use TreeIter;
11use TreePath;
12use TreeRowReference;
13
14impl TreeRowReference {
15    // This is unsafe because new_order bounds can't be checked.
16    pub unsafe fn reordered<T: IsA<glib::Object>>(
17        proxy: &T,
18        path: &TreePath,
19        iter: Option<&TreeIter>,
20        new_order: &[u32],
21    ) {
22        assert_initialized_main_thread!();
23        assert!(
24            iter.is_some() || path.get_depth() == 0,
25            "If 'iter' is None, 'path' must point to the root."
26        );
27        gtk_sys::gtk_tree_row_reference_reordered(
28            proxy.as_ref().to_glib_none().0,
29            mut_override(path.to_glib_none().0),
30            mut_override(iter.to_glib_none().0),
31            mut_override(new_order.as_ptr() as *const c_int),
32        );
33    }
34}