nm_rs/auto/
setting_pppoe.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    /// PPP-over-Ethernet Settings
12    ///
13    /// ## Properties
14    ///
15    ///
16    /// #### `parent`
17    ///  If given, specifies the parent interface name on which this PPPoE
18    /// connection should be created.  If this property is not specified,
19    /// the connection is activated on the interface specified in
20    /// #NMSettingConnection:interface-name of #NMSettingConnection.
21    ///
22    /// Readable | Writeable
23    ///
24    ///
25    /// #### `password`
26    ///  Password used to authenticate with the PPPoE service.
27    ///
28    /// Readable | Writeable
29    ///
30    ///
31    /// #### `password-flags`
32    ///  Flags indicating how to handle the #NMSettingPppoe:password property.
33    ///
34    /// Readable | Writeable
35    ///
36    ///
37    /// #### `service`
38    ///  If specified, instruct PPPoE to only initiate sessions with access
39    /// concentrators that provide the specified service.  For most providers,
40    /// this should be left blank.  It is only required if there are multiple
41    /// access concentrators or a specific service is known to be required.
42    ///
43    /// Readable | Writeable
44    ///
45    ///
46    /// #### `username`
47    ///  Username used to authenticate with the PPPoE service.
48    ///
49    /// Readable | Writeable
50    /// <details><summary><h4>Setting</h4></summary>
51    ///
52    ///
53    /// #### `name`
54    ///  The setting's name, which uniquely identifies the setting within the
55    /// connection.  Each setting type has a name unique to that type, for
56    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
57    ///
58    /// Readable
59    /// </details>
60    ///
61    /// # Implements
62    ///
63    /// [`SettingExt`][trait@crate::prelude::SettingExt]
64    #[doc(alias = "NMSettingPppoe")]
65    pub struct SettingPppoe(Object<ffi::NMSettingPppoe, ffi::NMSettingPppoeClass>) @extends Setting;
66
67    match fn {
68        type_ => || ffi::nm_setting_pppoe_get_type(),
69    }
70}
71
72impl SettingPppoe {
73    /// Creates a new #NMSettingPppoe object with default values.
74    ///
75    /// # Returns
76    ///
77    /// the new empty #NMSettingPppoe object
78    #[doc(alias = "nm_setting_pppoe_new")]
79    pub fn new() -> SettingPppoe {
80        assert_initialized_main_thread!();
81        unsafe {
82            Setting::from_glib_full(ffi::nm_setting_pppoe_new()).unsafe_cast()
83        }
84    }
85
86            // rustdoc-stripper-ignore-next
87            /// Creates a new builder-pattern struct instance to construct [`SettingPppoe`] objects.
88            ///
89            /// This method returns an instance of [`SettingPppoeBuilder`](crate::builders::SettingPppoeBuilder) which can be used to create [`SettingPppoe`] objects.
90            pub fn builder() -> SettingPppoeBuilder {
91                SettingPppoeBuilder::new()
92            }
93        
94
95    ///
96    /// # Returns
97    ///
98    /// the #NMSettingPppoe:parent property of the setting
99    #[cfg(feature = "v1_10")]
100    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
101    #[doc(alias = "nm_setting_pppoe_get_parent")]
102    #[doc(alias = "get_parent")]
103    pub fn parent(&self) -> glib::GString {
104        unsafe {
105            from_glib_none(ffi::nm_setting_pppoe_get_parent(self.to_glib_none().0))
106        }
107    }
108
109    ///
110    /// # Returns
111    ///
112    /// the #NMSettingPppoe:password property of the setting
113    #[doc(alias = "nm_setting_pppoe_get_password")]
114    #[doc(alias = "get_password")]
115    pub fn password(&self) -> glib::GString {
116        unsafe {
117            from_glib_none(ffi::nm_setting_pppoe_get_password(self.to_glib_none().0))
118        }
119    }
120
121    ///
122    /// # Returns
123    ///
124    /// the #NMSettingSecretFlags pertaining to the #NMSettingPppoe:password
125    #[doc(alias = "nm_setting_pppoe_get_password_flags")]
126    #[doc(alias = "get_password_flags")]
127    #[doc(alias = "password-flags")]
128    pub fn password_flags(&self) -> SettingSecretFlags {
129        unsafe {
130            from_glib(ffi::nm_setting_pppoe_get_password_flags(self.to_glib_none().0))
131        }
132    }
133
134    ///
135    /// # Returns
136    ///
137    /// the #NMSettingPppoe:service property of the setting
138    #[doc(alias = "nm_setting_pppoe_get_service")]
139    #[doc(alias = "get_service")]
140    pub fn service(&self) -> glib::GString {
141        unsafe {
142            from_glib_none(ffi::nm_setting_pppoe_get_service(self.to_glib_none().0))
143        }
144    }
145
146    ///
147    /// # Returns
148    ///
149    /// the #NMSettingPppoe:username property of the setting
150    #[doc(alias = "nm_setting_pppoe_get_username")]
151    #[doc(alias = "get_username")]
152    pub fn username(&self) -> glib::GString {
153        unsafe {
154            from_glib_none(ffi::nm_setting_pppoe_get_username(self.to_glib_none().0))
155        }
156    }
157
158    /// If given, specifies the parent interface name on which this PPPoE
159    /// connection should be created.  If this property is not specified,
160    /// the connection is activated on the interface specified in
161    /// #NMSettingConnection:interface-name of #NMSettingConnection.
162    #[cfg(feature = "v1_10")]
163    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
164    pub fn set_parent(&self, parent: Option<&str>) {
165        ObjectExt::set_property(self,"parent", parent)
166    }
167
168    /// Password used to authenticate with the PPPoE service.
169    pub fn set_password(&self, password: Option<&str>) {
170        ObjectExt::set_property(self,"password", password)
171    }
172
173    /// Flags indicating how to handle the #NMSettingPppoe:password property.
174    #[doc(alias = "password-flags")]
175    pub fn set_password_flags(&self, password_flags: SettingSecretFlags) {
176        ObjectExt::set_property(self,"password-flags", password_flags)
177    }
178
179    /// If specified, instruct PPPoE to only initiate sessions with access
180    /// concentrators that provide the specified service.  For most providers,
181    /// this should be left blank.  It is only required if there are multiple
182    /// access concentrators or a specific service is known to be required.
183    pub fn set_service(&self, service: Option<&str>) {
184        ObjectExt::set_property(self,"service", service)
185    }
186
187    /// Username used to authenticate with the PPPoE service.
188    pub fn set_username(&self, username: Option<&str>) {
189        ObjectExt::set_property(self,"username", username)
190    }
191
192    #[cfg(feature = "v1_10")]
193    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
194    #[doc(alias = "parent")]
195    pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
196        unsafe extern "C" fn notify_parent_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
197            let f: &F = &*(f as *const F);
198            f(&from_glib_borrow(this))
199        }
200        unsafe {
201            let f: Box_<F> = Box_::new(f);
202            connect_raw(self.as_ptr() as *mut _, c"notify::parent".as_ptr() as *const _,
203                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
204        }
205    }
206
207    #[doc(alias = "password")]
208    pub fn connect_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
209        unsafe extern "C" fn notify_password_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
210            let f: &F = &*(f as *const F);
211            f(&from_glib_borrow(this))
212        }
213        unsafe {
214            let f: Box_<F> = Box_::new(f);
215            connect_raw(self.as_ptr() as *mut _, c"notify::password".as_ptr() as *const _,
216                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_trampoline::<F> as *const ())), Box_::into_raw(f))
217        }
218    }
219
220    #[doc(alias = "password-flags")]
221    pub fn connect_password_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
222        unsafe extern "C" fn notify_password_flags_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
223            let f: &F = &*(f as *const F);
224            f(&from_glib_borrow(this))
225        }
226        unsafe {
227            let f: Box_<F> = Box_::new(f);
228            connect_raw(self.as_ptr() as *mut _, c"notify::password-flags".as_ptr() as *const _,
229                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
230        }
231    }
232
233    #[doc(alias = "service")]
234    pub fn connect_service_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
235        unsafe extern "C" fn notify_service_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
236            let f: &F = &*(f as *const F);
237            f(&from_glib_borrow(this))
238        }
239        unsafe {
240            let f: Box_<F> = Box_::new(f);
241            connect_raw(self.as_ptr() as *mut _, c"notify::service".as_ptr() as *const _,
242                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_service_trampoline::<F> as *const ())), Box_::into_raw(f))
243        }
244    }
245
246    #[doc(alias = "username")]
247    pub fn connect_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
248        unsafe extern "C" fn notify_username_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
249            let f: &F = &*(f as *const F);
250            f(&from_glib_borrow(this))
251        }
252        unsafe {
253            let f: Box_<F> = Box_::new(f);
254            connect_raw(self.as_ptr() as *mut _, c"notify::username".as_ptr() as *const _,
255                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_username_trampoline::<F> as *const ())), Box_::into_raw(f))
256        }
257    }
258}
259
260impl Default for SettingPppoe {
261                     fn default() -> Self {
262                         Self::new()
263                     }
264                 }
265
266// rustdoc-stripper-ignore-next
267        /// A [builder-pattern] type to construct [`SettingPppoe`] objects.
268        ///
269        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
270#[must_use = "The builder must be built to be used"]
271pub struct SettingPppoeBuilder {
272            builder: glib::object::ObjectBuilder<'static, SettingPppoe>,
273        }
274
275        impl SettingPppoeBuilder {
276        fn new() -> Self {
277            Self { builder: glib::object::Object::builder() }
278        }
279
280                            /// If given, specifies the parent interface name on which this PPPoE
281                            /// connection should be created.  If this property is not specified,
282                            /// the connection is activated on the interface specified in
283                            /// #NMSettingConnection:interface-name of #NMSettingConnection.
284                            #[cfg(feature = "v1_10")]
285    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
286    pub fn parent(self, parent: impl Into<glib::GString>) -> Self {
287                            Self { builder: self.builder.property("parent", parent.into()), }
288                        }
289
290                            /// Password used to authenticate with the PPPoE service.
291                            pub fn password(self, password: impl Into<glib::GString>) -> Self {
292                            Self { builder: self.builder.property("password", password.into()), }
293                        }
294
295                            /// Flags indicating how to handle the #NMSettingPppoe:password property.
296                            pub fn password_flags(self, password_flags: SettingSecretFlags) -> Self {
297                            Self { builder: self.builder.property("password-flags", password_flags), }
298                        }
299
300                            /// If specified, instruct PPPoE to only initiate sessions with access
301                            /// concentrators that provide the specified service.  For most providers,
302                            /// this should be left blank.  It is only required if there are multiple
303                            /// access concentrators or a specific service is known to be required.
304                            pub fn service(self, service: impl Into<glib::GString>) -> Self {
305                            Self { builder: self.builder.property("service", service.into()), }
306                        }
307
308                            /// Username used to authenticate with the PPPoE service.
309                            pub fn username(self, username: impl Into<glib::GString>) -> Self {
310                            Self { builder: self.builder.property("username", username.into()), }
311                        }
312
313    // rustdoc-stripper-ignore-next
314    /// Build the [`SettingPppoe`].
315    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
316    pub fn build(self) -> SettingPppoe {
317assert_initialized_main_thread!();
318    self.builder.build() }
319}