gtk/tree_model_filter.rs
1// Copyright 2013-2015, 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::object::{Cast, IsA};
6use glib::translate::*;
7use gtk_sys;
8
9use {TreeModel, TreeModelFilter, TreePath};
10
11impl TreeModelFilter {
12 pub fn new<T: IsA<TreeModel>>(child_model: &T, root: Option<&TreePath>) -> TreeModelFilter {
13 skip_assert_initialized!();
14 unsafe {
15 TreeModel::from_glib_none(gtk_sys::gtk_tree_model_filter_new(
16 child_model.as_ref().to_glib_none().0,
17 mut_override(root.to_glib_none().0),
18 ))
19 .unsafe_cast()
20 }
21 }
22}