1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4
5 use crate::AsyncResult;
6 use crate::BusType;
7 use crate::Cancellable;
8 use crate::DBusConnection;
9 use crate::File;
10 use crate::IOErrorEnum;
11 use crate::IOStream;
12 use crate::Icon;
13 use crate::InputStream;
14 use crate::Resource;
15 use crate::ResourceLookupFlags;
16 use crate::SettingsBackend;
17 use glib::object::IsA;
18 use glib::translate::*;
19 use std::boxed::Box as Box_;
20 use std::mem;
21 use std::pin::Pin;
22 use std::ptr;
23
24 #[doc(alias = "g_bus_get")]
bus_get< P: IsA<Cancellable>, Q: FnOnce(Result<DBusConnection, glib::Error>) + Send + 'static, >( bus_type: BusType, cancellable: Option<&P>, callback: Q, )25 pub fn bus_get<
26 P: IsA<Cancellable>,
27 Q: FnOnce(Result<DBusConnection, glib::Error>) + Send + 'static,
28 >(
29 bus_type: BusType,
30 cancellable: Option<&P>,
31 callback: Q,
32 ) {
33 let user_data: Box_<Q> = Box_::new(callback);
34 unsafe extern "C" fn bus_get_trampoline<
35 Q: FnOnce(Result<DBusConnection, glib::Error>) + Send + 'static,
36 >(
37 _source_object: *mut glib::gobject_ffi::GObject,
38 res: *mut crate::ffi::GAsyncResult,
39 user_data: glib::ffi::gpointer,
40 ) {
41 let mut error = ptr::null_mut();
42 let ret = ffi::g_bus_get_finish(res, &mut error);
43 let result = if error.is_null() {
44 Ok(from_glib_full(ret))
45 } else {
46 Err(from_glib_full(error))
47 };
48 let callback: Box_<Q> = Box_::from_raw(user_data as *mut _);
49 callback(result);
50 }
51 let callback = bus_get_trampoline::<Q>;
52 unsafe {
53 ffi::g_bus_get(
54 bus_type.into_glib(),
55 cancellable.map(|p| p.as_ref()).to_glib_none().0,
56 Some(callback),
57 Box_::into_raw(user_data) as *mut _,
58 );
59 }
60 }
61
bus_get_future( bus_type: BusType, ) -> Pin<Box_<dyn std::future::Future<Output = Result<DBusConnection, glib::Error>> + 'static>>62 pub fn bus_get_future(
63 bus_type: BusType,
64 ) -> Pin<Box_<dyn std::future::Future<Output = Result<DBusConnection, glib::Error>> + 'static>> {
65 Box_::pin(crate::GioFuture::new(
66 &(),
67 move |_obj, cancellable, send| {
68 bus_get(bus_type, Some(cancellable), move |res| {
69 send.resolve(res);
70 });
71 },
72 ))
73 }
74
75 #[doc(alias = "g_bus_get_sync")]
bus_get_sync<P: IsA<Cancellable>>( bus_type: BusType, cancellable: Option<&P>, ) -> Result<DBusConnection, glib::Error>76 pub fn bus_get_sync<P: IsA<Cancellable>>(
77 bus_type: BusType,
78 cancellable: Option<&P>,
79 ) -> Result<DBusConnection, glib::Error> {
80 unsafe {
81 let mut error = ptr::null_mut();
82 let ret = ffi::g_bus_get_sync(
83 bus_type.into_glib(),
84 cancellable.map(|p| p.as_ref()).to_glib_none().0,
85 &mut error,
86 );
87 if error.is_null() {
88 Ok(from_glib_full(ret))
89 } else {
90 Err(from_glib_full(error))
91 }
92 }
93 }
94
95 //#[doc(alias = "g_bus_own_name")]
96 //pub fn bus_own_name(bus_type: BusType, name: &str, flags: BusNameOwnerFlags, bus_acquired_handler: Option<Box_<dyn Fn(&DBusConnection, &str) + 'static>>, name_acquired_handler: Option<Box_<dyn Fn(&DBusConnection, &str) + 'static>>, name_lost_handler: Option<Box_<dyn Fn(&DBusConnection, &str) + 'static>>) -> u32 {
97 // unsafe { TODO: call ffi:g_bus_own_name() }
98 //}
99
100 //#[doc(alias = "g_bus_own_name_on_connection")]
101 //pub fn bus_own_name_on_connection(connection: &DBusConnection, name: &str, flags: BusNameOwnerFlags, name_acquired_handler: Option<Box_<dyn Fn(&DBusConnection, &str) + 'static>>, name_lost_handler: Option<Box_<dyn Fn(&DBusConnection, &str) + 'static>>) -> u32 {
102 // unsafe { TODO: call ffi:g_bus_own_name_on_connection() }
103 //}
104
105 //#[doc(alias = "g_bus_watch_name")]
106 //pub fn bus_watch_name(bus_type: BusType, name: &str, flags: BusNameWatcherFlags, name_appeared_handler: Option<Box_<dyn Fn(&DBusConnection, &str, &str) + 'static>>, name_vanished_handler: Option<Box_<dyn Fn(&DBusConnection, &str) + 'static>>) -> u32 {
107 // unsafe { TODO: call ffi:g_bus_watch_name() }
108 //}
109
110 //#[doc(alias = "g_bus_watch_name_on_connection")]
111 //pub fn bus_watch_name_on_connection(connection: &DBusConnection, name: &str, flags: BusNameWatcherFlags, name_appeared_handler: Option<Box_<dyn Fn(&DBusConnection, &str, &str) + 'static>>, name_vanished_handler: Option<Box_<dyn Fn(&DBusConnection, &str) + 'static>>) -> u32 {
112 // unsafe { TODO: call ffi:g_bus_watch_name_on_connection() }
113 //}
114
115 #[doc(alias = "g_content_type_can_be_executable")]
content_type_can_be_executable(type_: &str) -> bool116 pub fn content_type_can_be_executable(type_: &str) -> bool {
117 unsafe {
118 from_glib(ffi::g_content_type_can_be_executable(
119 type_.to_glib_none().0,
120 ))
121 }
122 }
123
124 #[doc(alias = "g_content_type_equals")]
content_type_equals(type1: &str, type2: &str) -> bool125 pub fn content_type_equals(type1: &str, type2: &str) -> bool {
126 unsafe {
127 from_glib(ffi::g_content_type_equals(
128 type1.to_glib_none().0,
129 type2.to_glib_none().0,
130 ))
131 }
132 }
133
134 #[doc(alias = "g_content_type_from_mime_type")]
content_type_from_mime_type(mime_type: &str) -> Option<glib::GString>135 pub fn content_type_from_mime_type(mime_type: &str) -> Option<glib::GString> {
136 unsafe {
137 from_glib_full(ffi::g_content_type_from_mime_type(
138 mime_type.to_glib_none().0,
139 ))
140 }
141 }
142
143 #[doc(alias = "g_content_type_get_description")]
content_type_get_description(type_: &str) -> glib::GString144 pub fn content_type_get_description(type_: &str) -> glib::GString {
145 unsafe { from_glib_full(ffi::g_content_type_get_description(type_.to_glib_none().0)) }
146 }
147
148 #[doc(alias = "g_content_type_get_generic_icon_name")]
content_type_get_generic_icon_name(type_: &str) -> Option<glib::GString>149 pub fn content_type_get_generic_icon_name(type_: &str) -> Option<glib::GString> {
150 unsafe {
151 from_glib_full(ffi::g_content_type_get_generic_icon_name(
152 type_.to_glib_none().0,
153 ))
154 }
155 }
156
157 #[doc(alias = "g_content_type_get_icon")]
content_type_get_icon(type_: &str) -> Icon158 pub fn content_type_get_icon(type_: &str) -> Icon {
159 unsafe { from_glib_full(ffi::g_content_type_get_icon(type_.to_glib_none().0)) }
160 }
161
162 #[cfg(any(feature = "v2_60", feature = "dox"))]
163 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
164 #[doc(alias = "g_content_type_get_mime_dirs")]
content_type_get_mime_dirs() -> Vec<glib::GString>165 pub fn content_type_get_mime_dirs() -> Vec<glib::GString> {
166 unsafe { FromGlibPtrContainer::from_glib_none(ffi::g_content_type_get_mime_dirs()) }
167 }
168
169 #[doc(alias = "g_content_type_get_mime_type")]
content_type_get_mime_type(type_: &str) -> Option<glib::GString>170 pub fn content_type_get_mime_type(type_: &str) -> Option<glib::GString> {
171 unsafe { from_glib_full(ffi::g_content_type_get_mime_type(type_.to_glib_none().0)) }
172 }
173
174 #[doc(alias = "g_content_type_get_symbolic_icon")]
content_type_get_symbolic_icon(type_: &str) -> Icon175 pub fn content_type_get_symbolic_icon(type_: &str) -> Icon {
176 unsafe {
177 from_glib_full(ffi::g_content_type_get_symbolic_icon(
178 type_.to_glib_none().0,
179 ))
180 }
181 }
182
183 #[doc(alias = "g_content_type_guess")]
content_type_guess(filename: Option<&str>, data: &[u8]) -> (glib::GString, bool)184 pub fn content_type_guess(filename: Option<&str>, data: &[u8]) -> (glib::GString, bool) {
185 let data_size = data.len() as usize;
186 unsafe {
187 let mut result_uncertain = mem::MaybeUninit::uninit();
188 let ret = from_glib_full(ffi::g_content_type_guess(
189 filename.to_glib_none().0,
190 data.to_glib_none().0,
191 data_size,
192 result_uncertain.as_mut_ptr(),
193 ));
194 let result_uncertain = result_uncertain.assume_init();
195 (ret, from_glib(result_uncertain))
196 }
197 }
198
199 #[doc(alias = "g_content_type_guess_for_tree")]
content_type_guess_for_tree<P: IsA<File>>(root: &P) -> Vec<glib::GString>200 pub fn content_type_guess_for_tree<P: IsA<File>>(root: &P) -> Vec<glib::GString> {
201 unsafe {
202 FromGlibPtrContainer::from_glib_full(ffi::g_content_type_guess_for_tree(
203 root.as_ref().to_glib_none().0,
204 ))
205 }
206 }
207
208 #[doc(alias = "g_content_type_is_a")]
content_type_is_a(type_: &str, supertype: &str) -> bool209 pub fn content_type_is_a(type_: &str, supertype: &str) -> bool {
210 unsafe {
211 from_glib(ffi::g_content_type_is_a(
212 type_.to_glib_none().0,
213 supertype.to_glib_none().0,
214 ))
215 }
216 }
217
218 #[cfg(any(feature = "v2_52", feature = "dox"))]
219 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_52")))]
220 #[doc(alias = "g_content_type_is_mime_type")]
content_type_is_mime_type(type_: &str, mime_type: &str) -> bool221 pub fn content_type_is_mime_type(type_: &str, mime_type: &str) -> bool {
222 unsafe {
223 from_glib(ffi::g_content_type_is_mime_type(
224 type_.to_glib_none().0,
225 mime_type.to_glib_none().0,
226 ))
227 }
228 }
229
230 #[doc(alias = "g_content_type_is_unknown")]
content_type_is_unknown(type_: &str) -> bool231 pub fn content_type_is_unknown(type_: &str) -> bool {
232 unsafe { from_glib(ffi::g_content_type_is_unknown(type_.to_glib_none().0)) }
233 }
234
235 #[cfg(any(feature = "v2_60", feature = "dox"))]
236 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
237 #[doc(alias = "g_content_type_set_mime_dirs")]
content_type_set_mime_dirs(dirs: &[&str])238 pub fn content_type_set_mime_dirs(dirs: &[&str]) {
239 unsafe {
240 ffi::g_content_type_set_mime_dirs(dirs.to_glib_none().0);
241 }
242 }
243
244 #[doc(alias = "g_content_types_get_registered")]
content_types_get_registered() -> Vec<glib::GString>245 pub fn content_types_get_registered() -> Vec<glib::GString> {
246 unsafe { FromGlibPtrContainer::from_glib_full(ffi::g_content_types_get_registered()) }
247 }
248
249 #[doc(alias = "g_dbus_address_escape_value")]
dbus_address_escape_value(string: &str) -> glib::GString250 pub fn dbus_address_escape_value(string: &str) -> glib::GString {
251 unsafe { from_glib_full(ffi::g_dbus_address_escape_value(string.to_glib_none().0)) }
252 }
253
254 #[doc(alias = "g_dbus_address_get_for_bus_sync")]
dbus_address_get_for_bus_sync<P: IsA<Cancellable>>( bus_type: BusType, cancellable: Option<&P>, ) -> Result<glib::GString, glib::Error>255 pub fn dbus_address_get_for_bus_sync<P: IsA<Cancellable>>(
256 bus_type: BusType,
257 cancellable: Option<&P>,
258 ) -> Result<glib::GString, glib::Error> {
259 unsafe {
260 let mut error = ptr::null_mut();
261 let ret = ffi::g_dbus_address_get_for_bus_sync(
262 bus_type.into_glib(),
263 cancellable.map(|p| p.as_ref()).to_glib_none().0,
264 &mut error,
265 );
266 if error.is_null() {
267 Ok(from_glib_full(ret))
268 } else {
269 Err(from_glib_full(error))
270 }
271 }
272 }
273
274 #[doc(alias = "g_dbus_address_get_stream")]
dbus_address_get_stream< P: IsA<Cancellable>, Q: FnOnce(Result<(IOStream, Option<glib::GString>), glib::Error>) + Send + 'static, >( address: &str, cancellable: Option<&P>, callback: Q, )275 pub fn dbus_address_get_stream<
276 P: IsA<Cancellable>,
277 Q: FnOnce(Result<(IOStream, Option<glib::GString>), glib::Error>) + Send + 'static,
278 >(
279 address: &str,
280 cancellable: Option<&P>,
281 callback: Q,
282 ) {
283 let user_data: Box_<Q> = Box_::new(callback);
284 unsafe extern "C" fn dbus_address_get_stream_trampoline<
285 Q: FnOnce(Result<(IOStream, Option<glib::GString>), glib::Error>) + Send + 'static,
286 >(
287 _source_object: *mut glib::gobject_ffi::GObject,
288 res: *mut crate::ffi::GAsyncResult,
289 user_data: glib::ffi::gpointer,
290 ) {
291 let mut error = ptr::null_mut();
292 let mut out_guid = ptr::null_mut();
293 let ret = ffi::g_dbus_address_get_stream_finish(res, &mut out_guid, &mut error);
294 let result = if error.is_null() {
295 Ok((from_glib_full(ret), from_glib_full(out_guid)))
296 } else {
297 Err(from_glib_full(error))
298 };
299 let callback: Box_<Q> = Box_::from_raw(user_data as *mut _);
300 callback(result);
301 }
302 let callback = dbus_address_get_stream_trampoline::<Q>;
303 unsafe {
304 ffi::g_dbus_address_get_stream(
305 address.to_glib_none().0,
306 cancellable.map(|p| p.as_ref()).to_glib_none().0,
307 Some(callback),
308 Box_::into_raw(user_data) as *mut _,
309 );
310 }
311 }
312
dbus_address_get_stream_future( address: &str, ) -> Pin< Box_< dyn std::future::Future<Output = Result<(IOStream, Option<glib::GString>), glib::Error>> + 'static, >, >313 pub fn dbus_address_get_stream_future(
314 address: &str,
315 ) -> Pin<
316 Box_<
317 dyn std::future::Future<Output = Result<(IOStream, Option<glib::GString>), glib::Error>>
318 + 'static,
319 >,
320 > {
321 let address = String::from(address);
322 Box_::pin(crate::GioFuture::new(
323 &(),
324 move |_obj, cancellable, send| {
325 dbus_address_get_stream(&address, Some(cancellable), move |res| {
326 send.resolve(res);
327 });
328 },
329 ))
330 }
331
332 #[doc(alias = "g_dbus_address_get_stream_sync")]
dbus_address_get_stream_sync<P: IsA<Cancellable>>( address: &str, cancellable: Option<&P>, ) -> Result<(IOStream, Option<glib::GString>), glib::Error>333 pub fn dbus_address_get_stream_sync<P: IsA<Cancellable>>(
334 address: &str,
335 cancellable: Option<&P>,
336 ) -> Result<(IOStream, Option<glib::GString>), glib::Error> {
337 unsafe {
338 let mut out_guid = ptr::null_mut();
339 let mut error = ptr::null_mut();
340 let ret = ffi::g_dbus_address_get_stream_sync(
341 address.to_glib_none().0,
342 &mut out_guid,
343 cancellable.map(|p| p.as_ref()).to_glib_none().0,
344 &mut error,
345 );
346 if error.is_null() {
347 Ok((from_glib_full(ret), from_glib_full(out_guid)))
348 } else {
349 Err(from_glib_full(error))
350 }
351 }
352 }
353
354 #[doc(alias = "g_dbus_generate_guid")]
dbus_generate_guid() -> glib::GString355 pub fn dbus_generate_guid() -> glib::GString {
356 unsafe { from_glib_full(ffi::g_dbus_generate_guid()) }
357 }
358
359 #[doc(alias = "g_dbus_gvalue_to_gvariant")]
dbus_gvalue_to_gvariant(gvalue: &glib::Value, type_: &glib::VariantTy) -> glib::Variant360 pub fn dbus_gvalue_to_gvariant(gvalue: &glib::Value, type_: &glib::VariantTy) -> glib::Variant {
361 unsafe {
362 from_glib_full(ffi::g_dbus_gvalue_to_gvariant(
363 gvalue.to_glib_none().0,
364 type_.to_glib_none().0,
365 ))
366 }
367 }
368
369 #[doc(alias = "g_dbus_gvariant_to_gvalue")]
dbus_gvariant_to_gvalue(value: &glib::Variant) -> glib::Value370 pub fn dbus_gvariant_to_gvalue(value: &glib::Variant) -> glib::Value {
371 unsafe {
372 let mut out_gvalue = glib::Value::uninitialized();
373 ffi::g_dbus_gvariant_to_gvalue(value.to_glib_none().0, out_gvalue.to_glib_none_mut().0);
374 out_gvalue
375 }
376 }
377
378 #[doc(alias = "g_dbus_is_address")]
dbus_is_address(string: &str) -> bool379 pub fn dbus_is_address(string: &str) -> bool {
380 unsafe { from_glib(ffi::g_dbus_is_address(string.to_glib_none().0)) }
381 }
382
383 #[doc(alias = "g_dbus_is_guid")]
dbus_is_guid(string: &str) -> bool384 pub fn dbus_is_guid(string: &str) -> bool {
385 unsafe { from_glib(ffi::g_dbus_is_guid(string.to_glib_none().0)) }
386 }
387
388 #[doc(alias = "g_dbus_is_interface_name")]
dbus_is_interface_name(string: &str) -> bool389 pub fn dbus_is_interface_name(string: &str) -> bool {
390 unsafe { from_glib(ffi::g_dbus_is_interface_name(string.to_glib_none().0)) }
391 }
392
393 #[doc(alias = "g_dbus_is_member_name")]
dbus_is_member_name(string: &str) -> bool394 pub fn dbus_is_member_name(string: &str) -> bool {
395 unsafe { from_glib(ffi::g_dbus_is_member_name(string.to_glib_none().0)) }
396 }
397
398 #[doc(alias = "g_dbus_is_name")]
dbus_is_name(string: &str) -> bool399 pub fn dbus_is_name(string: &str) -> bool {
400 unsafe { from_glib(ffi::g_dbus_is_name(string.to_glib_none().0)) }
401 }
402
403 #[doc(alias = "g_dbus_is_supported_address")]
dbus_is_supported_address(string: &str) -> Result<(), glib::Error>404 pub fn dbus_is_supported_address(string: &str) -> Result<(), glib::Error> {
405 unsafe {
406 let mut error = ptr::null_mut();
407 let _ = ffi::g_dbus_is_supported_address(string.to_glib_none().0, &mut error);
408 if error.is_null() {
409 Ok(())
410 } else {
411 Err(from_glib_full(error))
412 }
413 }
414 }
415
416 #[doc(alias = "g_dbus_is_unique_name")]
dbus_is_unique_name(string: &str) -> bool417 pub fn dbus_is_unique_name(string: &str) -> bool {
418 unsafe { from_glib(ffi::g_dbus_is_unique_name(string.to_glib_none().0)) }
419 }
420
421 #[doc(alias = "g_io_error_from_errno")]
io_error_from_errno(err_no: i32) -> IOErrorEnum422 pub fn io_error_from_errno(err_no: i32) -> IOErrorEnum {
423 unsafe { from_glib(ffi::g_io_error_from_errno(err_no)) }
424 }
425
426 //#[doc(alias = "g_io_modules_load_all_in_directory")]
427 //pub fn io_modules_load_all_in_directory<P: AsRef<std::path::Path>>(dirname: P) -> /*Ignored*/Vec<IOModule> {
428 // unsafe { TODO: call ffi:g_io_modules_load_all_in_directory() }
429 //}
430
431 //#[doc(alias = "g_io_modules_load_all_in_directory_with_scope")]
432 //pub fn io_modules_load_all_in_directory_with_scope<P: AsRef<std::path::Path>>(dirname: P, scope: /*Ignored*/&mut IOModuleScope) -> /*Ignored*/Vec<IOModule> {
433 // unsafe { TODO: call ffi:g_io_modules_load_all_in_directory_with_scope() }
434 //}
435
436 #[doc(alias = "g_io_modules_scan_all_in_directory")]
io_modules_scan_all_in_directory<P: AsRef<std::path::Path>>(dirname: P)437 pub fn io_modules_scan_all_in_directory<P: AsRef<std::path::Path>>(dirname: P) {
438 unsafe {
439 ffi::g_io_modules_scan_all_in_directory(dirname.as_ref().to_glib_none().0);
440 }
441 }
442
443 //#[doc(alias = "g_io_modules_scan_all_in_directory_with_scope")]
444 //pub fn io_modules_scan_all_in_directory_with_scope<P: AsRef<std::path::Path>>(dirname: P, scope: /*Ignored*/&mut IOModuleScope) {
445 // unsafe { TODO: call ffi:g_io_modules_scan_all_in_directory_with_scope() }
446 //}
447
448 #[doc(alias = "g_io_scheduler_cancel_all_jobs")]
io_scheduler_cancel_all_jobs()449 pub fn io_scheduler_cancel_all_jobs() {
450 unsafe {
451 ffi::g_io_scheduler_cancel_all_jobs();
452 }
453 }
454
455 //#[doc(alias = "g_io_scheduler_push_job")]
456 //pub fn io_scheduler_push_job<P: IsA<Cancellable>>(job_func: /*Unimplemented*/Fn(/*Ignored*/IOSchedulerJob, Option<&Cancellable>) -> bool, user_data: /*Unimplemented*/Option<Fundamental: Pointer>, io_priority: i32, cancellable: Option<&P>) {
457 // unsafe { TODO: call ffi:g_io_scheduler_push_job() }
458 //}
459
460 #[doc(alias = "g_keyfile_settings_backend_new")]
keyfile_settings_backend_new( filename: &str, root_path: &str, root_group: Option<&str>, ) -> SettingsBackend461 pub fn keyfile_settings_backend_new(
462 filename: &str,
463 root_path: &str,
464 root_group: Option<&str>,
465 ) -> SettingsBackend {
466 unsafe {
467 from_glib_full(ffi::g_keyfile_settings_backend_new(
468 filename.to_glib_none().0,
469 root_path.to_glib_none().0,
470 root_group.to_glib_none().0,
471 ))
472 }
473 }
474
475 #[doc(alias = "g_memory_settings_backend_new")]
memory_settings_backend_new() -> SettingsBackend476 pub fn memory_settings_backend_new() -> SettingsBackend {
477 unsafe { from_glib_full(ffi::g_memory_settings_backend_new()) }
478 }
479
480 #[doc(alias = "g_networking_init")]
networking_init()481 pub fn networking_init() {
482 unsafe {
483 ffi::g_networking_init();
484 }
485 }
486
487 #[doc(alias = "g_null_settings_backend_new")]
null_settings_backend_new() -> SettingsBackend488 pub fn null_settings_backend_new() -> SettingsBackend {
489 unsafe { from_glib_full(ffi::g_null_settings_backend_new()) }
490 }
491
492 #[doc(alias = "g_resources_enumerate_children")]
resources_enumerate_children( path: &str, lookup_flags: ResourceLookupFlags, ) -> Result<Vec<glib::GString>, glib::Error>493 pub fn resources_enumerate_children(
494 path: &str,
495 lookup_flags: ResourceLookupFlags,
496 ) -> Result<Vec<glib::GString>, glib::Error> {
497 unsafe {
498 let mut error = ptr::null_mut();
499 let ret = ffi::g_resources_enumerate_children(
500 path.to_glib_none().0,
501 lookup_flags.into_glib(),
502 &mut error,
503 );
504 if error.is_null() {
505 Ok(FromGlibPtrContainer::from_glib_full(ret))
506 } else {
507 Err(from_glib_full(error))
508 }
509 }
510 }
511
512 #[doc(alias = "g_resources_get_info")]
resources_get_info( path: &str, lookup_flags: ResourceLookupFlags, ) -> Result<(usize, u32), glib::Error>513 pub fn resources_get_info(
514 path: &str,
515 lookup_flags: ResourceLookupFlags,
516 ) -> Result<(usize, u32), glib::Error> {
517 unsafe {
518 let mut size = mem::MaybeUninit::uninit();
519 let mut flags = mem::MaybeUninit::uninit();
520 let mut error = ptr::null_mut();
521 let _ = ffi::g_resources_get_info(
522 path.to_glib_none().0,
523 lookup_flags.into_glib(),
524 size.as_mut_ptr(),
525 flags.as_mut_ptr(),
526 &mut error,
527 );
528 let size = size.assume_init();
529 let flags = flags.assume_init();
530 if error.is_null() {
531 Ok((size, flags))
532 } else {
533 Err(from_glib_full(error))
534 }
535 }
536 }
537
538 #[doc(alias = "g_resources_lookup_data")]
resources_lookup_data( path: &str, lookup_flags: ResourceLookupFlags, ) -> Result<glib::Bytes, glib::Error>539 pub fn resources_lookup_data(
540 path: &str,
541 lookup_flags: ResourceLookupFlags,
542 ) -> Result<glib::Bytes, glib::Error> {
543 unsafe {
544 let mut error = ptr::null_mut();
545 let ret = ffi::g_resources_lookup_data(
546 path.to_glib_none().0,
547 lookup_flags.into_glib(),
548 &mut error,
549 );
550 if error.is_null() {
551 Ok(from_glib_full(ret))
552 } else {
553 Err(from_glib_full(error))
554 }
555 }
556 }
557
558 #[doc(alias = "g_resources_open_stream")]
resources_open_stream( path: &str, lookup_flags: ResourceLookupFlags, ) -> Result<InputStream, glib::Error>559 pub fn resources_open_stream(
560 path: &str,
561 lookup_flags: ResourceLookupFlags,
562 ) -> Result<InputStream, glib::Error> {
563 unsafe {
564 let mut error = ptr::null_mut();
565 let ret = ffi::g_resources_open_stream(
566 path.to_glib_none().0,
567 lookup_flags.into_glib(),
568 &mut error,
569 );
570 if error.is_null() {
571 Ok(from_glib_full(ret))
572 } else {
573 Err(from_glib_full(error))
574 }
575 }
576 }
577
578 #[doc(alias = "g_resources_register")]
resources_register(resource: &Resource)579 pub fn resources_register(resource: &Resource) {
580 unsafe {
581 ffi::g_resources_register(resource.to_glib_none().0);
582 }
583 }
584
585 #[doc(alias = "g_resources_unregister")]
resources_unregister(resource: &Resource)586 pub fn resources_unregister(resource: &Resource) {
587 unsafe {
588 ffi::g_resources_unregister(resource.to_glib_none().0);
589 }
590 }
591
592 #[cfg(any(unix, feature = "dox"))]
593 #[cfg_attr(feature = "dox", doc(cfg(unix)))]
594 #[doc(alias = "g_unix_is_mount_path_system_internal")]
unix_is_mount_path_system_internal<P: AsRef<std::path::Path>>(mount_path: P) -> bool595 pub fn unix_is_mount_path_system_internal<P: AsRef<std::path::Path>>(mount_path: P) -> bool {
596 unsafe {
597 from_glib(ffi::g_unix_is_mount_path_system_internal(
598 mount_path.as_ref().to_glib_none().0,
599 ))
600 }
601 }
602
603 #[cfg(any(unix, feature = "dox"))]
604 #[cfg_attr(feature = "dox", doc(cfg(unix)))]
605 #[cfg(any(feature = "v2_56", feature = "dox"))]
606 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_56")))]
607 #[doc(alias = "g_unix_is_system_device_path")]
unix_is_system_device_path<P: AsRef<std::path::Path>>(device_path: P) -> bool608 pub fn unix_is_system_device_path<P: AsRef<std::path::Path>>(device_path: P) -> bool {
609 unsafe {
610 from_glib(ffi::g_unix_is_system_device_path(
611 device_path.as_ref().to_glib_none().0,
612 ))
613 }
614 }
615
616 #[cfg(any(unix, feature = "dox"))]
617 #[cfg_attr(feature = "dox", doc(cfg(unix)))]
618 #[cfg(any(feature = "v2_56", feature = "dox"))]
619 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_56")))]
620 #[doc(alias = "g_unix_is_system_fs_type")]
unix_is_system_fs_type(fs_type: &str) -> bool621 pub fn unix_is_system_fs_type(fs_type: &str) -> bool {
622 unsafe { from_glib(ffi::g_unix_is_system_fs_type(fs_type.to_glib_none().0)) }
623 }
624