This repository has been archived by the owner on Jun 8, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathfile_filter.rs
97 lines (81 loc) · 2.8 KB
/
file_filter.rs
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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
#[cfg(any(feature = "v3_22", feature = "dox"))]
use glib;
use glib::translate::*;
use glib::GString;
use gtk_sys;
use std::fmt;
use Buildable;
use FileFilterFlags;
glib_wrapper! {
pub struct FileFilter(Object<gtk_sys::GtkFileFilter, FileFilterClass>) @implements Buildable;
match fn {
get_type => || gtk_sys::gtk_file_filter_get_type(),
}
}
impl FileFilter {
pub fn new() -> FileFilter {
assert_initialized_main_thread!();
unsafe { from_glib_none(gtk_sys::gtk_file_filter_new()) }
}
#[cfg(any(feature = "v3_22", feature = "dox"))]
pub fn from_gvariant(variant: &glib::Variant) -> FileFilter {
assert_initialized_main_thread!();
unsafe {
from_glib_full(gtk_sys::gtk_file_filter_new_from_gvariant(
variant.to_glib_none().0,
))
}
}
//pub fn add_custom(&self, needed: FileFilterFlags, func: /*Unimplemented*/Fn(/*Ignored*/FileFilterInfo) -> bool, data: /*Unimplemented*/Option<Fundamental: Pointer>) {
// unsafe { TODO: call gtk_sys:gtk_file_filter_add_custom() }
//}
pub fn add_mime_type(&self, mime_type: &str) {
unsafe {
gtk_sys::gtk_file_filter_add_mime_type(
self.to_glib_none().0,
mime_type.to_glib_none().0,
);
}
}
pub fn add_pattern(&self, pattern: &str) {
unsafe {
gtk_sys::gtk_file_filter_add_pattern(self.to_glib_none().0, pattern.to_glib_none().0);
}
}
pub fn add_pixbuf_formats(&self) {
unsafe {
gtk_sys::gtk_file_filter_add_pixbuf_formats(self.to_glib_none().0);
}
}
//pub fn filter(&self, filter_info: /*Ignored*/&FileFilterInfo) -> bool {
// unsafe { TODO: call gtk_sys:gtk_file_filter_filter() }
//}
pub fn get_name(&self) -> Option<GString> {
unsafe { from_glib_none(gtk_sys::gtk_file_filter_get_name(self.to_glib_none().0)) }
}
pub fn get_needed(&self) -> FileFilterFlags {
unsafe { from_glib(gtk_sys::gtk_file_filter_get_needed(self.to_glib_none().0)) }
}
pub fn set_name(&self, name: Option<&str>) {
unsafe {
gtk_sys::gtk_file_filter_set_name(self.to_glib_none().0, name.to_glib_none().0);
}
}
#[cfg(any(feature = "v3_22", feature = "dox"))]
pub fn to_gvariant(&self) -> Option<glib::Variant> {
unsafe { from_glib_none(gtk_sys::gtk_file_filter_to_gvariant(self.to_glib_none().0)) }
}
}
impl Default for FileFilter {
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for FileFilter {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "FileFilter")
}
}