gtk/
tree_path.rs

1// Copyright 2013-2016, 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::translate::*;
6use gtk_sys;
7use std::slice;
8use TreePath;
9
10impl TreePath {
11    pub fn get_indices(&self) -> Vec<i32> {
12        unsafe {
13            let mut count = 0;
14            let ptr = gtk_sys::gtk_tree_path_get_indices_with_depth(
15                mut_override(self.to_glib_none().0),
16                &mut count,
17            );
18            if ptr.is_null() {
19                vec![]
20            } else {
21                slice::from_raw_parts(ptr, count as usize).to_owned()
22            }
23        }
24    }
25}