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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
use TreeIter;
use TreeModel;
use TreePath;
use ffi;
use glib;
use glib::Value;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;
glib_wrapper! {
pub struct TreeModelFilter(Object<ffi::GtkTreeModelFilter>): TreeModel;
match fn {
get_type => || ffi::gtk_tree_model_filter_get_type(),
}
}
pub trait TreeModelFilterExt {
fn clear_cache(&self);
fn convert_child_iter_to_iter(&self, child_iter: &TreeIter) -> Option<TreeIter>;
fn convert_child_path_to_path(&self, child_path: &TreePath) -> Option<TreePath>;
fn convert_iter_to_child_iter(&self, filter_iter: &TreeIter) -> TreeIter;
fn convert_path_to_child_path(&self, filter_path: &TreePath) -> Option<TreePath>;
fn get_model(&self) -> Option<TreeModel>;
fn refilter(&self);
fn set_visible_column(&self, column: i32);
fn get_property_child_model(&self) -> Option<TreeModel>;
}
impl<O: IsA<TreeModelFilter> + IsA<glib::object::Object>> TreeModelFilterExt for O {
fn clear_cache(&self) {
unsafe {
ffi::gtk_tree_model_filter_clear_cache(self.to_glib_none().0);
}
}
fn convert_child_iter_to_iter(&self, child_iter: &TreeIter) -> Option<TreeIter> {
unsafe {
let mut filter_iter = TreeIter::uninitialized();
let ret = from_glib(ffi::gtk_tree_model_filter_convert_child_iter_to_iter(self.to_glib_none().0, filter_iter.to_glib_none_mut().0, mut_override(child_iter.to_glib_none().0)));
if ret { Some(filter_iter) } else { None }
}
}
fn convert_child_path_to_path(&self, child_path: &TreePath) -> Option<TreePath> {
unsafe {
from_glib_full(ffi::gtk_tree_model_filter_convert_child_path_to_path(self.to_glib_none().0, mut_override(child_path.to_glib_none().0)))
}
}
fn convert_iter_to_child_iter(&self, filter_iter: &TreeIter) -> TreeIter {
unsafe {
let mut child_iter = TreeIter::uninitialized();
ffi::gtk_tree_model_filter_convert_iter_to_child_iter(self.to_glib_none().0, child_iter.to_glib_none_mut().0, mut_override(filter_iter.to_glib_none().0));
child_iter
}
}
fn convert_path_to_child_path(&self, filter_path: &TreePath) -> Option<TreePath> {
unsafe {
from_glib_full(ffi::gtk_tree_model_filter_convert_path_to_child_path(self.to_glib_none().0, mut_override(filter_path.to_glib_none().0)))
}
}
fn get_model(&self) -> Option<TreeModel> {
unsafe {
from_glib_none(ffi::gtk_tree_model_filter_get_model(self.to_glib_none().0))
}
}
fn refilter(&self) {
unsafe {
ffi::gtk_tree_model_filter_refilter(self.to_glib_none().0);
}
}
fn set_visible_column(&self, column: i32) {
unsafe {
ffi::gtk_tree_model_filter_set_visible_column(self.to_glib_none().0, column);
}
}
fn get_property_child_model(&self) -> Option<TreeModel> {
let mut value = Value::from(None::<&TreeModel>);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "child-model".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get()
}
}