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::Action;
6 use glib::object::IsA;
7 use glib::object::ObjectType as ObjectType_;
8 use glib::signal::connect_raw;
9 use glib::signal::SignalHandlerId;
10 use glib::translate::*;
11 use glib::StaticType;
12 use std::boxed::Box as Box_;
13 use std::fmt;
14 use std::mem::transmute;
15 
16 glib::wrapper! {
17     #[doc(alias = "GPropertyAction")]
18     pub struct PropertyAction(Object<ffi::GPropertyAction>) @implements Action;
19 
20     match fn {
21         type_ => || ffi::g_property_action_get_type(),
22     }
23 }
24 
25 impl PropertyAction {
26     #[doc(alias = "g_property_action_new")]
new<P: IsA<glib::Object>>( name: &str, object: &P, property_name: &str, ) -> PropertyAction27     pub fn new<P: IsA<glib::Object>>(
28         name: &str,
29         object: &P,
30         property_name: &str,
31     ) -> PropertyAction {
32         unsafe {
33             from_glib_full(ffi::g_property_action_new(
34                 name.to_glib_none().0,
35                 object.as_ref().to_glib_none().0,
36                 property_name.to_glib_none().0,
37             ))
38         }
39     }
40 
41     #[doc(alias = "invert-boolean")]
inverts_boolean(&self) -> bool42     pub fn inverts_boolean(&self) -> bool {
43         unsafe {
44             let mut value = glib::Value::from_type(<bool as StaticType>::static_type());
45             glib::gobject_ffi::g_object_get_property(
46                 self.as_ptr() as *mut glib::gobject_ffi::GObject,
47                 b"invert-boolean\0".as_ptr() as *const _,
48                 value.to_glib_none_mut().0,
49             );
50             value
51                 .get()
52                 .expect("Return Value for property `invert-boolean` getter")
53         }
54     }
55 
56     #[doc(alias = "enabled")]
connect_enabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId57     pub fn connect_enabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
58         unsafe extern "C" fn notify_enabled_trampoline<F: Fn(&PropertyAction) + 'static>(
59             this: *mut ffi::GPropertyAction,
60             _param_spec: glib::ffi::gpointer,
61             f: glib::ffi::gpointer,
62         ) {
63             let f: &F = &*(f as *const F);
64             f(&from_glib_borrow(this))
65         }
66         unsafe {
67             let f: Box_<F> = Box_::new(f);
68             connect_raw(
69                 self.as_ptr() as *mut _,
70                 b"notify::enabled\0".as_ptr() as *const _,
71                 Some(transmute::<_, unsafe extern "C" fn()>(
72                     notify_enabled_trampoline::<F> as *const (),
73                 )),
74                 Box_::into_raw(f),
75             )
76         }
77     }
78 
79     #[doc(alias = "parameter-type")]
connect_parameter_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId80     pub fn connect_parameter_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
81         unsafe extern "C" fn notify_parameter_type_trampoline<F: Fn(&PropertyAction) + 'static>(
82             this: *mut ffi::GPropertyAction,
83             _param_spec: glib::ffi::gpointer,
84             f: glib::ffi::gpointer,
85         ) {
86             let f: &F = &*(f as *const F);
87             f(&from_glib_borrow(this))
88         }
89         unsafe {
90             let f: Box_<F> = Box_::new(f);
91             connect_raw(
92                 self.as_ptr() as *mut _,
93                 b"notify::parameter-type\0".as_ptr() as *const _,
94                 Some(transmute::<_, unsafe extern "C" fn()>(
95                     notify_parameter_type_trampoline::<F> as *const (),
96                 )),
97                 Box_::into_raw(f),
98             )
99         }
100     }
101 
102     #[doc(alias = "state")]
connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId103     pub fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
104         unsafe extern "C" fn notify_state_trampoline<F: Fn(&PropertyAction) + 'static>(
105             this: *mut ffi::GPropertyAction,
106             _param_spec: glib::ffi::gpointer,
107             f: glib::ffi::gpointer,
108         ) {
109             let f: &F = &*(f as *const F);
110             f(&from_glib_borrow(this))
111         }
112         unsafe {
113             let f: Box_<F> = Box_::new(f);
114             connect_raw(
115                 self.as_ptr() as *mut _,
116                 b"notify::state\0".as_ptr() as *const _,
117                 Some(transmute::<_, unsafe extern "C" fn()>(
118                     notify_state_trampoline::<F> as *const (),
119                 )),
120                 Box_::into_raw(f),
121             )
122         }
123     }
124 
125     #[doc(alias = "state-type")]
connect_state_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId126     pub fn connect_state_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
127         unsafe extern "C" fn notify_state_type_trampoline<F: Fn(&PropertyAction) + 'static>(
128             this: *mut ffi::GPropertyAction,
129             _param_spec: glib::ffi::gpointer,
130             f: glib::ffi::gpointer,
131         ) {
132             let f: &F = &*(f as *const F);
133             f(&from_glib_borrow(this))
134         }
135         unsafe {
136             let f: Box_<F> = Box_::new(f);
137             connect_raw(
138                 self.as_ptr() as *mut _,
139                 b"notify::state-type\0".as_ptr() as *const _,
140                 Some(transmute::<_, unsafe extern "C" fn()>(
141                     notify_state_type_trampoline::<F> as *const (),
142                 )),
143                 Box_::into_raw(f),
144             )
145         }
146     }
147 }
148 
149 impl fmt::Display for PropertyAction {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result150     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
151         f.write_str("PropertyAction")
152     }
153 }
154