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
use crate::{BoolFilter, Expression};
use glib::translate::*;
impl BoolFilter {
#[doc(alias = "gtk_bool_filter_new")]
pub fn new<E: AsRef<Expression>>(expression: Option<&E>) -> Self {
assert_initialized_main_thread!();
if let Some(e) = expression {
if !e.as_ref().value_type().is_a(glib::Type::BOOL) {
panic!("BoolFilter::new must take either None or an expression that evaluates to a boolean.");
}
}
unsafe {
from_glib_full(ffi::gtk_bool_filter_new(
expression.map(|e| e.as_ref()).to_glib_full(),
))
}
}
#[doc(alias = "gtk_bool_filter_set_expression")]
pub fn set_expression<E: AsRef<Expression>>(&self, expression: Option<&E>) {
if let Some(e) = expression {
if !e.as_ref().value_type().is_a(glib::Type::BOOL) {
panic!("BoolFilter::set_expression must take either None or an expression that evaluates to a boolean.");
}
}
unsafe {
ffi::gtk_bool_filter_set_expression(
self.to_glib_none().0,
expression.map(|e| e.as_ref()).to_glib_none().0,
);
}
}
}