1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
// Copyright 2013-2017, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib; use glib::object::IsA; use glib::translate::*; use gtk_sys; use libc::c_int; use TreeIter; use TreePath; use TreeRowReference; impl TreeRowReference { // This is unsafe because new_order bounds can't be checked. /// Lets a set of row reference created by /// `TreeRowReference::new_proxy` know that the /// model emitted the `TreeModel::rows-reordered` signal. /// ## `proxy` /// a `gobject::Object` /// ## `path` /// the parent path of the reordered signal /// ## `iter` /// the iter pointing to the parent of the reordered /// ## `new_order` /// the new order of rows /// /// # Safety /// The `proxy` must be a proxy returned by `gtk::TreeRowReference` and /// the `new_order` bounds **must** be valid as they cannot be checked. pub unsafe fn reordered<T: IsA<glib::Object>>( proxy: &T, path: &TreePath, iter: Option<&TreeIter>, new_order: &[u32], ) { assert_initialized_main_thread!(); assert!( iter.is_some() || path.get_depth() == 0, "If 'iter' is None, 'path' must point to the root." ); gtk_sys::gtk_tree_row_reference_reordered( proxy.as_ref().to_glib_none().0, mut_override(path.to_glib_none().0), mut_override(iter.to_glib_none().0), mut_override(new_order.as_ptr() as *const c_int), ); } }