1use glib_sys;
6use gobject_sys;
7use translate::*;
8use value::FromValue;
9use value::FromValueOptional;
10use value::SetValue;
11use value::Value;
12use StaticType;
13use Type;
14
15bitflags! {
16 pub struct FileTest: u32 {
17 const IS_REGULAR = 1;
18 const IS_SYMLINK = 2;
19 const IS_DIR = 4;
20 const IS_EXECUTABLE = 8;
21 const EXISTS = 16;
22 }
23}
24
25#[doc(hidden)]
26impl ToGlib for FileTest {
27 type GlibType = glib_sys::GFileTest;
28
29 fn to_glib(&self) -> glib_sys::GFileTest {
30 self.bits()
31 }
32}
33
34#[doc(hidden)]
35impl FromGlib<glib_sys::GFileTest> for FileTest {
36 fn from_glib(value: glib_sys::GFileTest) -> FileTest {
37 FileTest::from_bits_truncate(value)
38 }
39}
40
41bitflags! {
42 pub struct FormatSizeFlags: u32 {
43 const DEFAULT = 0;
44 const LONG_FORMAT = 1;
45 const IEC_UNITS = 2;
46 const BITS = 4;
47 }
48}
49
50#[doc(hidden)]
51impl ToGlib for FormatSizeFlags {
52 type GlibType = glib_sys::GFormatSizeFlags;
53
54 fn to_glib(&self) -> glib_sys::GFormatSizeFlags {
55 self.bits()
56 }
57}
58
59#[doc(hidden)]
60impl FromGlib<glib_sys::GFormatSizeFlags> for FormatSizeFlags {
61 fn from_glib(value: glib_sys::GFormatSizeFlags) -> FormatSizeFlags {
62 FormatSizeFlags::from_bits_truncate(value)
63 }
64}
65
66bitflags! {
67 pub struct IOCondition: u32 {
68 const IN = 1;
69 const OUT = 4;
70 const PRI = 2;
71 const ERR = 8;
72 const HUP = 16;
73 const NVAL = 32;
74 }
75}
76
77#[doc(hidden)]
78impl ToGlib for IOCondition {
79 type GlibType = glib_sys::GIOCondition;
80
81 fn to_glib(&self) -> glib_sys::GIOCondition {
82 self.bits()
83 }
84}
85
86#[doc(hidden)]
87impl FromGlib<glib_sys::GIOCondition> for IOCondition {
88 fn from_glib(value: glib_sys::GIOCondition) -> IOCondition {
89 IOCondition::from_bits_truncate(value)
90 }
91}
92
93impl StaticType for IOCondition {
94 fn static_type() -> Type {
95 unsafe { from_glib(glib_sys::g_io_condition_get_type()) }
96 }
97}
98
99impl<'a> FromValueOptional<'a> for IOCondition {
100 unsafe fn from_value_optional(value: &Value) -> Option<Self> {
101 Some(FromValue::from_value(value))
102 }
103}
104
105impl<'a> FromValue<'a> for IOCondition {
106 unsafe fn from_value(value: &Value) -> Self {
107 from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
108 }
109}
110
111impl SetValue for IOCondition {
112 unsafe fn set_value(value: &mut Value, this: &Self) {
113 gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
114 }
115}
116
117bitflags! {
118 pub struct KeyFileFlags: u32 {
119 const NONE = 0;
120 const KEEP_COMMENTS = 1;
121 const KEEP_TRANSLATIONS = 2;
122 }
123}
124
125#[doc(hidden)]
126impl ToGlib for KeyFileFlags {
127 type GlibType = glib_sys::GKeyFileFlags;
128
129 fn to_glib(&self) -> glib_sys::GKeyFileFlags {
130 self.bits()
131 }
132}
133
134#[doc(hidden)]
135impl FromGlib<glib_sys::GKeyFileFlags> for KeyFileFlags {
136 fn from_glib(value: glib_sys::GKeyFileFlags) -> KeyFileFlags {
137 KeyFileFlags::from_bits_truncate(value)
138 }
139}
140
141bitflags! {
142 pub struct OptionFlags: u32 {
143 const NONE = 0;
144 const HIDDEN = 1;
145 const IN_MAIN = 2;
146 const REVERSE = 4;
147 const NO_ARG = 8;
148 const FILENAME = 16;
149 const OPTIONAL_ARG = 32;
150 const NOALIAS = 64;
151 }
152}
153
154#[doc(hidden)]
155impl ToGlib for OptionFlags {
156 type GlibType = glib_sys::GOptionFlags;
157
158 fn to_glib(&self) -> glib_sys::GOptionFlags {
159 self.bits()
160 }
161}
162
163#[doc(hidden)]
164impl FromGlib<glib_sys::GOptionFlags> for OptionFlags {
165 fn from_glib(value: glib_sys::GOptionFlags) -> OptionFlags {
166 OptionFlags::from_bits_truncate(value)
167 }
168}
169
170bitflags! {
171 pub struct SpawnFlags: u32 {
172 const DEFAULT = 0;
173 const LEAVE_DESCRIPTORS_OPEN = 1;
174 const DO_NOT_REAP_CHILD = 2;
175 const SEARCH_PATH = 4;
176 const STDOUT_TO_DEV_NULL = 8;
177 const STDERR_TO_DEV_NULL = 16;
178 const CHILD_INHERITS_STDIN = 32;
179 const FILE_AND_ARGV_ZERO = 64;
180 const SEARCH_PATH_FROM_ENVP = 128;
181 const CLOEXEC_PIPES = 256;
182 }
183}
184
185#[doc(hidden)]
186impl ToGlib for SpawnFlags {
187 type GlibType = glib_sys::GSpawnFlags;
188
189 fn to_glib(&self) -> glib_sys::GSpawnFlags {
190 self.bits()
191 }
192}
193
194#[doc(hidden)]
195impl FromGlib<glib_sys::GSpawnFlags> for SpawnFlags {
196 fn from_glib(value: glib_sys::GSpawnFlags) -> SpawnFlags {
197 SpawnFlags::from_bits_truncate(value)
198 }
199}