Skip to main content

glib/gobject/auto/
binding.rs

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
5use crate::{BindingFlags, ffi, translate::*};
6
7crate::wrapper! {
8    ///  object1:propertyA
9    /// ```text
10    ///
11    /// might lead to an infinite loop. The loop, in this particular case,
12    /// can be avoided if the objects emit the `GObject::notify` signal only
13    /// if the value has effectively been changed. A binding is implemented
14    /// using the `GObject::notify` signal, so it is susceptible to all the
15    /// various ways of blocking a signal emission, like `signal_stop_emission()`
16    /// or `signal_handler_block()`.
17    ///
18    /// A binding will be severed, and the resources it allocates freed, whenever
19    /// either one of the `GObject` instances it refers to are finalized, or when
20    /// the #GBinding instance loses its last reference.
21    ///
22    /// Bindings for languages with garbage collection can use
23    /// [`unbind()`][Self::unbind()] to explicitly release a binding between the source
24    /// and target properties, instead of relying on the last reference on the
25    /// binding, source, and target instances to drop.
26    ///
27    /// ## Properties
28    ///
29    ///
30    /// #### `flags`
31    ///  Flags to be used to control the #GBinding
32    ///
33    /// Readable | Writable | Construct Only
34    ///
35    ///
36    /// #### `source`
37    ///  The #GObject that should be used as the source of the binding
38    ///
39    /// Readable | Writable | Construct Only
40    ///
41    ///
42    /// #### `source-property`
43    ///  The name of the property of #GBinding:source that should be used
44    /// as the source of the binding.
45    ///
46    /// This should be in [canonical form][`ParamSpec`][crate::ParamSpec]#parameter-names] to get the
47    /// best performance.
48    ///
49    /// Readable | Writable | Construct Only
50    ///
51    ///
52    /// #### `target`
53    ///  The #GObject that should be used as the target of the binding
54    ///
55    /// Readable | Writable | Construct Only
56    ///
57    ///
58    /// #### `target-property`
59    ///  The name of the property of #GBinding:target that should be used
60    /// as the target of the binding.
61    ///
62    /// This should be in [canonical form][`ParamSpec`][crate::ParamSpec]#parameter-names] to get the
63    /// best performance.
64    ///
65    /// Readable | Writable | Construct Only
66    ///
67    /// # Implements
68    ///
69    /// [`ObjectExt`][trait@crate::prelude::ObjectExt]
70    // rustdoc-stripper-ignore-next-stop
71    ///  object1:propertyA
72    /// ```text
73    ///
74    /// might lead to an infinite loop. The loop, in this particular case,
75    /// can be avoided if the objects emit the `GObject::notify` signal only
76    /// if the value has effectively been changed. A binding is implemented
77    /// using the `GObject::notify` signal, so it is susceptible to all the
78    /// various ways of blocking a signal emission, like `signal_stop_emission()`
79    /// or `signal_handler_block()`.
80    ///
81    /// A binding will be severed, and the resources it allocates freed, whenever
82    /// either one of the `GObject` instances it refers to are finalized, or when
83    /// the #GBinding instance loses its last reference.
84    ///
85    /// Bindings for languages with garbage collection can use
86    /// [`unbind()`][Self::unbind()] to explicitly release a binding between the source
87    /// and target properties, instead of relying on the last reference on the
88    /// binding, source, and target instances to drop.
89    ///
90    /// ## Properties
91    ///
92    ///
93    /// #### `flags`
94    ///  Flags to be used to control the #GBinding
95    ///
96    /// Readable | Writable | Construct Only
97    ///
98    ///
99    /// #### `source`
100    ///  The #GObject that should be used as the source of the binding
101    ///
102    /// Readable | Writable | Construct Only
103    ///
104    ///
105    /// #### `source-property`
106    ///  The name of the property of #GBinding:source that should be used
107    /// as the source of the binding.
108    ///
109    /// This should be in [canonical form][`ParamSpec`][crate::ParamSpec]#parameter-names] to get the
110    /// best performance.
111    ///
112    /// Readable | Writable | Construct Only
113    ///
114    ///
115    /// #### `target`
116    ///  The #GObject that should be used as the target of the binding
117    ///
118    /// Readable | Writable | Construct Only
119    ///
120    ///
121    /// #### `target-property`
122    ///  The name of the property of #GBinding:target that should be used
123    /// as the target of the binding.
124    ///
125    /// This should be in [canonical form][`ParamSpec`][crate::ParamSpec]#parameter-names] to get the
126    /// best performance.
127    ///
128    /// Readable | Writable | Construct Only
129    ///
130    /// # Implements
131    ///
132    /// [`ObjectExt`][trait@crate::prelude::ObjectExt]
133    #[doc(alias = "GBinding")]
134    pub struct Binding(Object<crate::gobject_ffi::GBinding>);
135
136    match fn {
137        type_ => || crate::gobject_ffi::g_binding_get_type(),
138    }
139}
140
141impl Binding {
142    /// Retrieves the flags passed when constructing the #GBinding.
143    ///
144    /// # Returns
145    ///
146    /// the #GBindingFlags used by the #GBinding
147    // rustdoc-stripper-ignore-next-stop
148    /// Retrieves the flags passed when constructing the #GBinding.
149    ///
150    /// # Returns
151    ///
152    /// the #GBindingFlags used by the #GBinding
153    #[doc(alias = "g_binding_get_flags")]
154    #[doc(alias = "get_flags")]
155    pub fn flags(&self) -> BindingFlags {
156        unsafe {
157            from_glib(crate::gobject_ffi::g_binding_get_flags(
158                self.to_glib_none().0,
159            ))
160        }
161    }
162
163    /// Retrieves the name of the property of #GBinding:source used as the source
164    /// of the binding.
165    ///
166    /// # Returns
167    ///
168    /// the name of the source property
169    // rustdoc-stripper-ignore-next-stop
170    /// Retrieves the name of the property of #GBinding:source used as the source
171    /// of the binding.
172    ///
173    /// # Returns
174    ///
175    /// the name of the source property
176    #[doc(alias = "g_binding_get_source_property")]
177    #[doc(alias = "get_source_property")]
178    #[doc(alias = "source-property")]
179    pub fn source_property(&self) -> crate::GString {
180        unsafe {
181            from_glib_none(crate::gobject_ffi::g_binding_get_source_property(
182                self.to_glib_none().0,
183            ))
184        }
185    }
186
187    /// Retrieves the name of the property of #GBinding:target used as the target
188    /// of the binding.
189    ///
190    /// # Returns
191    ///
192    /// the name of the target property
193    // rustdoc-stripper-ignore-next-stop
194    /// Retrieves the name of the property of #GBinding:target used as the target
195    /// of the binding.
196    ///
197    /// # Returns
198    ///
199    /// the name of the target property
200    #[doc(alias = "g_binding_get_target_property")]
201    #[doc(alias = "get_target_property")]
202    #[doc(alias = "target-property")]
203    pub fn target_property(&self) -> crate::GString {
204        unsafe {
205            from_glib_none(crate::gobject_ffi::g_binding_get_target_property(
206                self.to_glib_none().0,
207            ))
208        }
209    }
210
211    /// Explicitly releases the binding between the source and the target
212    /// property expressed by @self.
213    ///
214    /// This function will release the reference that is being held on
215    /// the @self instance if the binding is still bound; if you want to hold on
216    /// to the #GBinding instance after calling g_binding_unbind(), you will need
217    /// to hold a reference to it.
218    ///
219    /// Note however that this function does not take ownership of @self, it
220    /// only unrefs the reference that was initially created by
221    /// g_object_bind_property() and is owned by the binding.
222    // rustdoc-stripper-ignore-next-stop
223    /// Explicitly releases the binding between the source and the target
224    /// property expressed by @self.
225    ///
226    /// This function will release the reference that is being held on
227    /// the @self instance if the binding is still bound; if you want to hold on
228    /// to the #GBinding instance after calling g_binding_unbind(), you will need
229    /// to hold a reference to it.
230    ///
231    /// Note however that this function does not take ownership of @self, it
232    /// only unrefs the reference that was initially created by
233    /// g_object_bind_property() and is owned by the binding.
234    #[doc(alias = "g_binding_unbind")]
235    pub fn unbind(&self) {
236        unsafe {
237            crate::gobject_ffi::g_binding_unbind(self.to_glib_none().0);
238        }
239    }
240}
241
242unsafe impl Send for Binding {}
243unsafe impl Sync for Binding {}