nm_rs/auto/
setting_cdma.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    /// CDMA-based Mobile Broadband Settings
12    ///
13    /// ## Properties
14    ///
15    ///
16    /// #### `mtu`
17    ///  If non-zero, only transmit packets of the specified size or smaller,
18    /// breaking larger packets up into multiple frames.
19    ///
20    /// Readable | Writeable
21    ///
22    ///
23    /// #### `number`
24    ///  The number to dial to establish the connection to the CDMA-based mobile
25    /// broadband network, if any.  If not specified, the default number (#777)
26    /// is used when required.
27    ///
28    /// Readable | Writeable
29    ///
30    ///
31    /// #### `password`
32    ///  The password used to authenticate with the network, if required.  Many
33    /// providers do not require a password, or accept any password.  But if a
34    /// password is required, it is specified here.
35    ///
36    /// Readable | Writeable
37    ///
38    ///
39    /// #### `password-flags`
40    ///  Flags indicating how to handle the #NMSettingCdma:password property.
41    ///
42    /// Readable | Writeable
43    ///
44    ///
45    /// #### `username`
46    ///  The username used to authenticate with the network, if required.  Many
47    /// providers do not require a username, or accept any username.  But if a
48    /// username is required, it is specified here.
49    ///
50    /// Readable | Writeable
51    /// <details><summary><h4>Setting</h4></summary>
52    ///
53    ///
54    /// #### `name`
55    ///  The setting's name, which uniquely identifies the setting within the
56    /// connection.  Each setting type has a name unique to that type, for
57    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
58    ///
59    /// Readable
60    /// </details>
61    ///
62    /// # Implements
63    ///
64    /// [`SettingExt`][trait@crate::prelude::SettingExt]
65    #[doc(alias = "NMSettingCdma")]
66    pub struct SettingCdma(Object<ffi::NMSettingCdma, ffi::NMSettingCdmaClass>) @extends Setting;
67
68    match fn {
69        type_ => || ffi::nm_setting_cdma_get_type(),
70    }
71}
72
73impl SettingCdma {
74    /// Creates a new #NMSettingCdma object with default values.
75    ///
76    /// # Returns
77    ///
78    /// the new empty #NMSettingCdma object
79    #[doc(alias = "nm_setting_cdma_new")]
80    pub fn new() -> SettingCdma {
81        assert_initialized_main_thread!();
82        unsafe {
83            Setting::from_glib_full(ffi::nm_setting_cdma_new()).unsafe_cast()
84        }
85    }
86
87            // rustdoc-stripper-ignore-next
88            /// Creates a new builder-pattern struct instance to construct [`SettingCdma`] objects.
89            ///
90            /// This method returns an instance of [`SettingCdmaBuilder`](crate::builders::SettingCdmaBuilder) which can be used to create [`SettingCdma`] objects.
91            pub fn builder() -> SettingCdmaBuilder {
92                SettingCdmaBuilder::new()
93            }
94        
95
96    ///
97    /// # Returns
98    ///
99    /// the #NMSettingCdma:mtu property of the setting
100    #[cfg(feature = "v1_8")]
101    #[cfg_attr(docsrs, doc(cfg(feature = "v1_8")))]
102    #[doc(alias = "nm_setting_cdma_get_mtu")]
103    #[doc(alias = "get_mtu")]
104    pub fn mtu(&self) -> u32 {
105        unsafe {
106            ffi::nm_setting_cdma_get_mtu(self.to_glib_none().0)
107        }
108    }
109
110    ///
111    /// # Returns
112    ///
113    /// the #NMSettingCdma:number property of the setting
114    #[doc(alias = "nm_setting_cdma_get_number")]
115    #[doc(alias = "get_number")]
116    pub fn number(&self) -> glib::GString {
117        unsafe {
118            from_glib_none(ffi::nm_setting_cdma_get_number(self.to_glib_none().0))
119        }
120    }
121
122    ///
123    /// # Returns
124    ///
125    /// the #NMSettingCdma:password property of the setting
126    #[doc(alias = "nm_setting_cdma_get_password")]
127    #[doc(alias = "get_password")]
128    pub fn password(&self) -> glib::GString {
129        unsafe {
130            from_glib_none(ffi::nm_setting_cdma_get_password(self.to_glib_none().0))
131        }
132    }
133
134    ///
135    /// # Returns
136    ///
137    /// the #NMSettingSecretFlags pertaining to the #NMSettingCdma:password
138    #[doc(alias = "nm_setting_cdma_get_password_flags")]
139    #[doc(alias = "get_password_flags")]
140    #[doc(alias = "password-flags")]
141    pub fn password_flags(&self) -> SettingSecretFlags {
142        unsafe {
143            from_glib(ffi::nm_setting_cdma_get_password_flags(self.to_glib_none().0))
144        }
145    }
146
147    ///
148    /// # Returns
149    ///
150    /// the #NMSettingCdma:username property of the setting
151    #[doc(alias = "nm_setting_cdma_get_username")]
152    #[doc(alias = "get_username")]
153    pub fn username(&self) -> glib::GString {
154        unsafe {
155            from_glib_none(ffi::nm_setting_cdma_get_username(self.to_glib_none().0))
156        }
157    }
158
159    /// If non-zero, only transmit packets of the specified size or smaller,
160    /// breaking larger packets up into multiple frames.
161    #[cfg(feature = "v1_8")]
162    #[cfg_attr(docsrs, doc(cfg(feature = "v1_8")))]
163    pub fn set_mtu(&self, mtu: u32) {
164        ObjectExt::set_property(self,"mtu", mtu)
165    }
166
167    /// The number to dial to establish the connection to the CDMA-based mobile
168    /// broadband network, if any.  If not specified, the default number (#777)
169    /// is used when required.
170    pub fn set_number(&self, number: Option<&str>) {
171        ObjectExt::set_property(self,"number", number)
172    }
173
174    /// The password used to authenticate with the network, if required.  Many
175    /// providers do not require a password, or accept any password.  But if a
176    /// password is required, it is specified here.
177    pub fn set_password(&self, password: Option<&str>) {
178        ObjectExt::set_property(self,"password", password)
179    }
180
181    /// Flags indicating how to handle the #NMSettingCdma:password property.
182    #[doc(alias = "password-flags")]
183    pub fn set_password_flags(&self, password_flags: SettingSecretFlags) {
184        ObjectExt::set_property(self,"password-flags", password_flags)
185    }
186
187    /// The username used to authenticate with the network, if required.  Many
188    /// providers do not require a username, or accept any username.  But if a
189    /// username is required, it is specified here.
190    pub fn set_username(&self, username: Option<&str>) {
191        ObjectExt::set_property(self,"username", username)
192    }
193
194    #[cfg(feature = "v1_8")]
195    #[cfg_attr(docsrs, doc(cfg(feature = "v1_8")))]
196    #[doc(alias = "mtu")]
197    pub fn connect_mtu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
198        unsafe extern "C" fn notify_mtu_trampoline<F: Fn(&SettingCdma) + 'static>(this: *mut ffi::NMSettingCdma, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
199            let f: &F = &*(f as *const F);
200            f(&from_glib_borrow(this))
201        }
202        unsafe {
203            let f: Box_<F> = Box_::new(f);
204            connect_raw(self.as_ptr() as *mut _, c"notify::mtu".as_ptr() as *const _,
205                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mtu_trampoline::<F> as *const ())), Box_::into_raw(f))
206        }
207    }
208
209    #[doc(alias = "number")]
210    pub fn connect_number_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
211        unsafe extern "C" fn notify_number_trampoline<F: Fn(&SettingCdma) + 'static>(this: *mut ffi::NMSettingCdma, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
212            let f: &F = &*(f as *const F);
213            f(&from_glib_borrow(this))
214        }
215        unsafe {
216            let f: Box_<F> = Box_::new(f);
217            connect_raw(self.as_ptr() as *mut _, c"notify::number".as_ptr() as *const _,
218                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_number_trampoline::<F> as *const ())), Box_::into_raw(f))
219        }
220    }
221
222    #[doc(alias = "password")]
223    pub fn connect_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
224        unsafe extern "C" fn notify_password_trampoline<F: Fn(&SettingCdma) + 'static>(this: *mut ffi::NMSettingCdma, _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::password".as_ptr() as *const _,
231                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_trampoline::<F> as *const ())), Box_::into_raw(f))
232        }
233    }
234
235    #[doc(alias = "password-flags")]
236    pub fn connect_password_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
237        unsafe extern "C" fn notify_password_flags_trampoline<F: Fn(&SettingCdma) + 'static>(this: *mut ffi::NMSettingCdma, _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-flags".as_ptr() as *const _,
244                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
245        }
246    }
247
248    #[doc(alias = "username")]
249    pub fn connect_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
250        unsafe extern "C" fn notify_username_trampoline<F: Fn(&SettingCdma) + 'static>(this: *mut ffi::NMSettingCdma, _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::username".as_ptr() as *const _,
257                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_username_trampoline::<F> as *const ())), Box_::into_raw(f))
258        }
259    }
260}
261
262impl Default for SettingCdma {
263                     fn default() -> Self {
264                         Self::new()
265                     }
266                 }
267
268// rustdoc-stripper-ignore-next
269        /// A [builder-pattern] type to construct [`SettingCdma`] objects.
270        ///
271        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
272#[must_use = "The builder must be built to be used"]
273pub struct SettingCdmaBuilder {
274            builder: glib::object::ObjectBuilder<'static, SettingCdma>,
275        }
276
277        impl SettingCdmaBuilder {
278        fn new() -> Self {
279            Self { builder: glib::object::Object::builder() }
280        }
281
282                            /// If non-zero, only transmit packets of the specified size or smaller,
283                            /// breaking larger packets up into multiple frames.
284                            #[cfg(feature = "v1_8")]
285    #[cfg_attr(docsrs, doc(cfg(feature = "v1_8")))]
286    pub fn mtu(self, mtu: u32) -> Self {
287                            Self { builder: self.builder.property("mtu", mtu), }
288                        }
289
290                            /// The number to dial to establish the connection to the CDMA-based mobile
291                            /// broadband network, if any.  If not specified, the default number (#777)
292                            /// is used when required.
293                            pub fn number(self, number: impl Into<glib::GString>) -> Self {
294                            Self { builder: self.builder.property("number", number.into()), }
295                        }
296
297                            /// The password used to authenticate with the network, if required.  Many
298                            /// providers do not require a password, or accept any password.  But if a
299                            /// password is required, it is specified here.
300                            pub fn password(self, password: impl Into<glib::GString>) -> Self {
301                            Self { builder: self.builder.property("password", password.into()), }
302                        }
303
304                            /// Flags indicating how to handle the #NMSettingCdma:password property.
305                            pub fn password_flags(self, password_flags: SettingSecretFlags) -> Self {
306                            Self { builder: self.builder.property("password-flags", password_flags), }
307                        }
308
309                            /// The username used to authenticate with the network, if required.  Many
310                            /// providers do not require a username, or accept any username.  But if a
311                            /// username is required, it is specified here.
312                            pub fn username(self, username: impl Into<glib::GString>) -> Self {
313                            Self { builder: self.builder.property("username", username.into()), }
314                        }
315
316    // rustdoc-stripper-ignore-next
317    /// Build the [`SettingCdma`].
318    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
319    pub fn build(self) -> SettingCdma {
320assert_initialized_main_thread!();
321    self.builder.build() }
322}