nm_rs/auto/
setting_cdma.rs1use crate::{ffi,Setting,SettingSecretFlags};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11 #[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 #[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 pub fn builder() -> SettingCdmaBuilder {
92 SettingCdmaBuilder::new()
93 }
94
95
96 #[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 #[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 #[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 #[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 #[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 #[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 pub fn set_number(&self, number: Option<&str>) {
171 ObjectExt::set_property(self,"number", number)
172 }
173
174 pub fn set_password(&self, password: Option<&str>) {
178 ObjectExt::set_property(self,"password", password)
179 }
180
181 #[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 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#[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 #[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 pub fn number(self, number: impl Into<glib::GString>) -> Self {
294 Self { builder: self.builder.property("number", number.into()), }
295 }
296
297 pub fn password(self, password: impl Into<glib::GString>) -> Self {
301 Self { builder: self.builder.property("password", password.into()), }
302 }
303
304 pub fn password_flags(self, password_flags: SettingSecretFlags) -> Self {
306 Self { builder: self.builder.property("password-flags", password_flags), }
307 }
308
309 pub fn username(self, username: impl Into<glib::GString>) -> Self {
313 Self { builder: self.builder.property("username", username.into()), }
314 }
315
316 #[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}