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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
use StateType;
use TextDirection;
use ffi;
use gdk_pixbuf;
use glib::translate::*;
use std;
glib_wrapper! {
pub struct IconSource(Boxed<ffi::GtkIconSource>);
match fn {
copy => |ptr| ffi::gtk_icon_source_copy(mut_override(ptr)),
free => |ptr| ffi::gtk_icon_source_free(ptr),
}
}
impl IconSource {
pub fn new() -> IconSource {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gtk_icon_source_new())
}
}
pub fn get_direction(&self) -> TextDirection {
unsafe {
from_glib(ffi::gtk_icon_source_get_direction(self.to_glib_none().0))
}
}
pub fn get_direction_wildcarded(&self) -> bool {
unsafe {
from_glib(ffi::gtk_icon_source_get_direction_wildcarded(self.to_glib_none().0))
}
}
pub fn get_filename(&self) -> Option<std::path::PathBuf> {
unsafe {
from_glib_none(ffi::gtk_icon_source_get_filename(self.to_glib_none().0))
}
}
pub fn get_icon_name(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gtk_icon_source_get_icon_name(self.to_glib_none().0))
}
}
pub fn get_pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf> {
unsafe {
from_glib_none(ffi::gtk_icon_source_get_pixbuf(self.to_glib_none().0))
}
}
pub fn get_size(&self) -> i32 {
unsafe {
ffi::gtk_icon_source_get_size(self.to_glib_none().0)
}
}
pub fn get_size_wildcarded(&self) -> bool {
unsafe {
from_glib(ffi::gtk_icon_source_get_size_wildcarded(self.to_glib_none().0))
}
}
pub fn get_state(&self) -> StateType {
unsafe {
from_glib(ffi::gtk_icon_source_get_state(self.to_glib_none().0))
}
}
pub fn get_state_wildcarded(&self) -> bool {
unsafe {
from_glib(ffi::gtk_icon_source_get_state_wildcarded(self.to_glib_none().0))
}
}
pub fn set_direction(&mut self, direction: TextDirection) {
unsafe {
ffi::gtk_icon_source_set_direction(self.to_glib_none_mut().0, direction.to_glib());
}
}
pub fn set_direction_wildcarded(&mut self, setting: bool) {
unsafe {
ffi::gtk_icon_source_set_direction_wildcarded(self.to_glib_none_mut().0, setting.to_glib());
}
}
pub fn set_filename<P: AsRef<std::path::Path>>(&mut self, filename: P) {
unsafe {
ffi::gtk_icon_source_set_filename(self.to_glib_none_mut().0, filename.as_ref().to_glib_none().0);
}
}
pub fn set_icon_name<'a, P: Into<Option<&'a str>>>(&mut self, icon_name: P) {
let icon_name = icon_name.into();
let icon_name = icon_name.to_glib_none();
unsafe {
ffi::gtk_icon_source_set_icon_name(self.to_glib_none_mut().0, icon_name.0);
}
}
pub fn set_pixbuf(&mut self, pixbuf: &gdk_pixbuf::Pixbuf) {
unsafe {
ffi::gtk_icon_source_set_pixbuf(self.to_glib_none_mut().0, pixbuf.to_glib_none().0);
}
}
pub fn set_size(&mut self, size: i32) {
unsafe {
ffi::gtk_icon_source_set_size(self.to_glib_none_mut().0, size);
}
}
pub fn set_size_wildcarded(&mut self, setting: bool) {
unsafe {
ffi::gtk_icon_source_set_size_wildcarded(self.to_glib_none_mut().0, setting.to_glib());
}
}
pub fn set_state(&mut self, state: StateType) {
unsafe {
ffi::gtk_icon_source_set_state(self.to_glib_none_mut().0, state.to_glib());
}
}
pub fn set_state_wildcarded(&mut self, setting: bool) {
unsafe {
ffi::gtk_icon_source_set_state_wildcarded(self.to_glib_none_mut().0, setting.to_glib());
}
}
}