Debian Codegraph @

debian/missing-sources/gio/src/auto/debug_controller.rs

raw
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::{Initable, ffi};
6 use glib::{
7 prelude::*,
8 signal::{SignalHandlerId, connect_raw},
9 translate::*,
10 };
11 use std::boxed::Box as Box_;
12
13 glib::wrapper! {
14 #[doc(alias = "GDebugController")]
15 pub struct DebugController(Interface<ffi::GDebugController, ffi::GDebugControllerInterface>) @requires Initable;
16
17 match fn {
18 type_ => || ffi::g_debug_controller_get_type(),
19 }
20 }
21
22 impl DebugController {
23 pub const NONE: Option<&'static DebugController> = None;
24 }
25
26 pub trait DebugControllerExt: IsA<DebugController> + 'static {
27 #[doc(alias = "g_debug_controller_get_debug_enabled")]
28 #[doc(alias = "get_debug_enabled")]
29 #[doc(alias = "debug-enabled")]
30 fn is_debug_enabled(&self) -> bool {
31 unsafe {
32 from_glib(ffi::g_debug_controller_get_debug_enabled(
33 self.as_ref().to_glib_none().0,
34 ))
35 }
36 }
37
38 #[doc(alias = "g_debug_controller_set_debug_enabled")]
39 #[doc(alias = "debug-enabled")]
40 fn set_debug_enabled(&self, debug_enabled: bool) {
41 unsafe {
42 ffi::g_debug_controller_set_debug_enabled(
43 self.as_ref().to_glib_none().0,
44 debug_enabled.into_glib(),
45 );
46 }
47 }
48
49 #[cfg(feature = "v2_72")]
50 #[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
51 #[doc(alias = "debug-enabled")]
52 fn connect_debug_enabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
53 unsafe extern "C" fn notify_debug_enabled_trampoline<
54 P: IsA<DebugController>,
55 F: Fn(&P) + 'static,
56 >(
57 this: *mut ffi::GDebugController,
58 _param_spec: glib::ffi::gpointer,
59 f: glib::ffi::gpointer,
60 ) {
61 unsafe {
62 let f: &F = &*(f as *const F);
63 f(DebugController::from_glib_borrow(this).unsafe_cast_ref())
64 }
65 }
66 unsafe {
67 let f: Box_<F> = Box_::new(f);
68 connect_raw(
69 self.as_ptr() as *mut _,
70 c"notify::debug-enabled".as_ptr(),
71 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
72 notify_debug_enabled_trampoline::<Self, F> as *const (),
73 )),
74 Box_::into_raw(f),
75 )
76 }
77 }
78 }
79
80 impl<O: IsA<DebugController>> DebugControllerExt for O {}