nm_rs/auto/
setting_adsl.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{ffi,Setting,SettingSecretFlags};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11    /// ADSL Settings
12    ///
13    /// ## Properties
14    ///
15    ///
16    /// #### `encapsulation`
17    ///  Encapsulation of ADSL connection.  Can be "vcmux" or "llc".
18    ///
19    /// Readable | Writeable
20    ///
21    ///
22    /// #### `password`
23    ///  Password used to authenticate with the ADSL service.
24    ///
25    /// Readable | Writeable
26    ///
27    ///
28    /// #### `password-flags`
29    ///  Flags indicating how to handle the #NMSettingAdsl:password property.
30    ///
31    /// Readable | Writeable
32    ///
33    ///
34    /// #### `protocol`
35    ///  ADSL connection protocol.  Can be "pppoa", "pppoe" or "ipoatm".
36    ///
37    /// Readable | Writeable
38    ///
39    ///
40    /// #### `username`
41    ///  Username used to authenticate with the ADSL service.
42    ///
43    /// Readable | Writeable
44    ///
45    ///
46    /// #### `vci`
47    ///  VCI of ADSL connection
48    ///
49    /// Readable | Writeable
50    ///
51    ///
52    /// #### `vpi`
53    ///  VPI of ADSL connection
54    ///
55    /// Readable | Writeable
56    /// <details><summary><h4>Setting</h4></summary>
57    ///
58    ///
59    /// #### `name`
60    ///  The setting's name, which uniquely identifies the setting within the
61    /// connection.  Each setting type has a name unique to that type, for
62    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
63    ///
64    /// Readable
65    /// </details>
66    ///
67    /// # Implements
68    ///
69    /// [`SettingExt`][trait@crate::prelude::SettingExt]
70    #[doc(alias = "NMSettingAdsl")]
71    pub struct SettingAdsl(Object<ffi::NMSettingAdsl, ffi::NMSettingAdslClass>) @extends Setting;
72
73    match fn {
74        type_ => || ffi::nm_setting_adsl_get_type(),
75    }
76}
77
78impl SettingAdsl {
79    /// Creates a new #NMSettingAdsl object with default values.
80    ///
81    /// # Returns
82    ///
83    /// the new empty #NMSettingAdsl object
84    #[doc(alias = "nm_setting_adsl_new")]
85    pub fn new() -> SettingAdsl {
86        assert_initialized_main_thread!();
87        unsafe {
88            Setting::from_glib_full(ffi::nm_setting_adsl_new()).unsafe_cast()
89        }
90    }
91
92            // rustdoc-stripper-ignore-next
93            /// Creates a new builder-pattern struct instance to construct [`SettingAdsl`] objects.
94            ///
95            /// This method returns an instance of [`SettingAdslBuilder`](crate::builders::SettingAdslBuilder) which can be used to create [`SettingAdsl`] objects.
96            pub fn builder() -> SettingAdslBuilder {
97                SettingAdslBuilder::new()
98            }
99        
100
101    ///
102    /// # Returns
103    ///
104    /// the #NMSettingAdsl:encapsulation property of the setting
105    #[doc(alias = "nm_setting_adsl_get_encapsulation")]
106    #[doc(alias = "get_encapsulation")]
107    pub fn encapsulation(&self) -> glib::GString {
108        unsafe {
109            from_glib_none(ffi::nm_setting_adsl_get_encapsulation(self.to_glib_none().0))
110        }
111    }
112
113    ///
114    /// # Returns
115    ///
116    /// the #NMSettingAdsl:password property of the setting
117    #[doc(alias = "nm_setting_adsl_get_password")]
118    #[doc(alias = "get_password")]
119    pub fn password(&self) -> glib::GString {
120        unsafe {
121            from_glib_none(ffi::nm_setting_adsl_get_password(self.to_glib_none().0))
122        }
123    }
124
125    ///
126    /// # Returns
127    ///
128    /// the #NMSettingSecretFlags pertaining to the #NMSettingAdsl:password
129    #[doc(alias = "nm_setting_adsl_get_password_flags")]
130    #[doc(alias = "get_password_flags")]
131    #[doc(alias = "password-flags")]
132    pub fn password_flags(&self) -> SettingSecretFlags {
133        unsafe {
134            from_glib(ffi::nm_setting_adsl_get_password_flags(self.to_glib_none().0))
135        }
136    }
137
138    ///
139    /// # Returns
140    ///
141    /// the #NMSettingAdsl:protocol property of the setting
142    #[doc(alias = "nm_setting_adsl_get_protocol")]
143    #[doc(alias = "get_protocol")]
144    pub fn protocol(&self) -> glib::GString {
145        unsafe {
146            from_glib_none(ffi::nm_setting_adsl_get_protocol(self.to_glib_none().0))
147        }
148    }
149
150    ///
151    /// # Returns
152    ///
153    /// the #NMSettingAdsl:username property of the setting
154    #[doc(alias = "nm_setting_adsl_get_username")]
155    #[doc(alias = "get_username")]
156    pub fn username(&self) -> glib::GString {
157        unsafe {
158            from_glib_none(ffi::nm_setting_adsl_get_username(self.to_glib_none().0))
159        }
160    }
161
162    ///
163    /// # Returns
164    ///
165    /// the #NMSettingAdsl:vci property of the setting
166    #[doc(alias = "nm_setting_adsl_get_vci")]
167    #[doc(alias = "get_vci")]
168    pub fn vci(&self) -> u32 {
169        unsafe {
170            ffi::nm_setting_adsl_get_vci(self.to_glib_none().0)
171        }
172    }
173
174    ///
175    /// # Returns
176    ///
177    /// the #NMSettingAdsl:vpi property of the setting
178    #[doc(alias = "nm_setting_adsl_get_vpi")]
179    #[doc(alias = "get_vpi")]
180    pub fn vpi(&self) -> u32 {
181        unsafe {
182            ffi::nm_setting_adsl_get_vpi(self.to_glib_none().0)
183        }
184    }
185
186    /// Encapsulation of ADSL connection.  Can be "vcmux" or "llc".
187    pub fn set_encapsulation(&self, encapsulation: Option<&str>) {
188        ObjectExt::set_property(self,"encapsulation", encapsulation)
189    }
190
191    /// Password used to authenticate with the ADSL service.
192    pub fn set_password(&self, password: Option<&str>) {
193        ObjectExt::set_property(self,"password", password)
194    }
195
196    /// Flags indicating how to handle the #NMSettingAdsl:password property.
197    #[doc(alias = "password-flags")]
198    pub fn set_password_flags(&self, password_flags: SettingSecretFlags) {
199        ObjectExt::set_property(self,"password-flags", password_flags)
200    }
201
202    /// ADSL connection protocol.  Can be "pppoa", "pppoe" or "ipoatm".
203    pub fn set_protocol(&self, protocol: Option<&str>) {
204        ObjectExt::set_property(self,"protocol", protocol)
205    }
206
207    /// Username used to authenticate with the ADSL service.
208    pub fn set_username(&self, username: Option<&str>) {
209        ObjectExt::set_property(self,"username", username)
210    }
211
212    /// VCI of ADSL connection
213    pub fn set_vci(&self, vci: u32) {
214        ObjectExt::set_property(self,"vci", vci)
215    }
216
217    /// VPI of ADSL connection
218    pub fn set_vpi(&self, vpi: u32) {
219        ObjectExt::set_property(self,"vpi", vpi)
220    }
221
222    #[doc(alias = "encapsulation")]
223    pub fn connect_encapsulation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
224        unsafe extern "C" fn notify_encapsulation_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
225            let f: &F = &*(f as *const F);
226            f(&from_glib_borrow(this))
227        }
228        unsafe {
229            let f: Box_<F> = Box_::new(f);
230            connect_raw(self.as_ptr() as *mut _, c"notify::encapsulation".as_ptr() as *const _,
231                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_encapsulation_trampoline::<F> as *const ())), Box_::into_raw(f))
232        }
233    }
234
235    #[doc(alias = "password")]
236    pub fn connect_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
237        unsafe extern "C" fn notify_password_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
238            let f: &F = &*(f as *const F);
239            f(&from_glib_borrow(this))
240        }
241        unsafe {
242            let f: Box_<F> = Box_::new(f);
243            connect_raw(self.as_ptr() as *mut _, c"notify::password".as_ptr() as *const _,
244                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_trampoline::<F> as *const ())), Box_::into_raw(f))
245        }
246    }
247
248    #[doc(alias = "password-flags")]
249    pub fn connect_password_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
250        unsafe extern "C" fn notify_password_flags_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
251            let f: &F = &*(f as *const F);
252            f(&from_glib_borrow(this))
253        }
254        unsafe {
255            let f: Box_<F> = Box_::new(f);
256            connect_raw(self.as_ptr() as *mut _, c"notify::password-flags".as_ptr() as *const _,
257                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
258        }
259    }
260
261    #[doc(alias = "protocol")]
262    pub fn connect_protocol_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
263        unsafe extern "C" fn notify_protocol_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
264            let f: &F = &*(f as *const F);
265            f(&from_glib_borrow(this))
266        }
267        unsafe {
268            let f: Box_<F> = Box_::new(f);
269            connect_raw(self.as_ptr() as *mut _, c"notify::protocol".as_ptr() as *const _,
270                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_protocol_trampoline::<F> as *const ())), Box_::into_raw(f))
271        }
272    }
273
274    #[doc(alias = "username")]
275    pub fn connect_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
276        unsafe extern "C" fn notify_username_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
277            let f: &F = &*(f as *const F);
278            f(&from_glib_borrow(this))
279        }
280        unsafe {
281            let f: Box_<F> = Box_::new(f);
282            connect_raw(self.as_ptr() as *mut _, c"notify::username".as_ptr() as *const _,
283                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_username_trampoline::<F> as *const ())), Box_::into_raw(f))
284        }
285    }
286
287    #[doc(alias = "vci")]
288    pub fn connect_vci_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
289        unsafe extern "C" fn notify_vci_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
290            let f: &F = &*(f as *const F);
291            f(&from_glib_borrow(this))
292        }
293        unsafe {
294            let f: Box_<F> = Box_::new(f);
295            connect_raw(self.as_ptr() as *mut _, c"notify::vci".as_ptr() as *const _,
296                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vci_trampoline::<F> as *const ())), Box_::into_raw(f))
297        }
298    }
299
300    #[doc(alias = "vpi")]
301    pub fn connect_vpi_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
302        unsafe extern "C" fn notify_vpi_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
303            let f: &F = &*(f as *const F);
304            f(&from_glib_borrow(this))
305        }
306        unsafe {
307            let f: Box_<F> = Box_::new(f);
308            connect_raw(self.as_ptr() as *mut _, c"notify::vpi".as_ptr() as *const _,
309                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vpi_trampoline::<F> as *const ())), Box_::into_raw(f))
310        }
311    }
312}
313
314impl Default for SettingAdsl {
315                     fn default() -> Self {
316                         Self::new()
317                     }
318                 }
319
320// rustdoc-stripper-ignore-next
321        /// A [builder-pattern] type to construct [`SettingAdsl`] objects.
322        ///
323        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
324#[must_use = "The builder must be built to be used"]
325pub struct SettingAdslBuilder {
326            builder: glib::object::ObjectBuilder<'static, SettingAdsl>,
327        }
328
329        impl SettingAdslBuilder {
330        fn new() -> Self {
331            Self { builder: glib::object::Object::builder() }
332        }
333
334                            /// Encapsulation of ADSL connection.  Can be "vcmux" or "llc".
335                            pub fn encapsulation(self, encapsulation: impl Into<glib::GString>) -> Self {
336                            Self { builder: self.builder.property("encapsulation", encapsulation.into()), }
337                        }
338
339                            /// Password used to authenticate with the ADSL service.
340                            pub fn password(self, password: impl Into<glib::GString>) -> Self {
341                            Self { builder: self.builder.property("password", password.into()), }
342                        }
343
344                            /// Flags indicating how to handle the #NMSettingAdsl:password property.
345                            pub fn password_flags(self, password_flags: SettingSecretFlags) -> Self {
346                            Self { builder: self.builder.property("password-flags", password_flags), }
347                        }
348
349                            /// ADSL connection protocol.  Can be "pppoa", "pppoe" or "ipoatm".
350                            pub fn protocol(self, protocol: impl Into<glib::GString>) -> Self {
351                            Self { builder: self.builder.property("protocol", protocol.into()), }
352                        }
353
354                            /// Username used to authenticate with the ADSL service.
355                            pub fn username(self, username: impl Into<glib::GString>) -> Self {
356                            Self { builder: self.builder.property("username", username.into()), }
357                        }
358
359                            /// VCI of ADSL connection
360                            pub fn vci(self, vci: u32) -> Self {
361                            Self { builder: self.builder.property("vci", vci), }
362                        }
363
364                            /// VPI of ADSL connection
365                            pub fn vpi(self, vpi: u32) -> Self {
366                            Self { builder: self.builder.property("vpi", vpi), }
367                        }
368
369    // rustdoc-stripper-ignore-next
370    /// Build the [`SettingAdsl`].
371    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
372    pub fn build(self) -> SettingAdsl {
373assert_initialized_main_thread!();
374    self.builder.build() }
375}