1use crate::{ffi,Setting,SettingSecretFlags};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11 #[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 #[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 pub fn builder() -> SettingAdslBuilder {
97 SettingAdslBuilder::new()
98 }
99
100
101 #[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 #[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 #[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 #[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 #[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 #[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 #[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 pub fn set_encapsulation(&self, encapsulation: Option<&str>) {
188 ObjectExt::set_property(self,"encapsulation", encapsulation)
189 }
190
191 pub fn set_password(&self, password: Option<&str>) {
193 ObjectExt::set_property(self,"password", password)
194 }
195
196 #[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 pub fn set_protocol(&self, protocol: Option<&str>) {
204 ObjectExt::set_property(self,"protocol", protocol)
205 }
206
207 pub fn set_username(&self, username: Option<&str>) {
209 ObjectExt::set_property(self,"username", username)
210 }
211
212 pub fn set_vci(&self, vci: u32) {
214 ObjectExt::set_property(self,"vci", vci)
215 }
216
217 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#[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 pub fn encapsulation(self, encapsulation: impl Into<glib::GString>) -> Self {
336 Self { builder: self.builder.property("encapsulation", encapsulation.into()), }
337 }
338
339 pub fn password(self, password: impl Into<glib::GString>) -> Self {
341 Self { builder: self.builder.property("password", password.into()), }
342 }
343
344 pub fn password_flags(self, password_flags: SettingSecretFlags) -> Self {
346 Self { builder: self.builder.property("password-flags", password_flags), }
347 }
348
349 pub fn protocol(self, protocol: impl Into<glib::GString>) -> Self {
351 Self { builder: self.builder.property("protocol", protocol.into()), }
352 }
353
354 pub fn username(self, username: impl Into<glib::GString>) -> Self {
356 Self { builder: self.builder.property("username", username.into()), }
357 }
358
359 pub fn vci(self, vci: u32) -> Self {
361 Self { builder: self.builder.property("vci", vci), }
362 }
363
364 pub fn vpi(self, vpi: u32) -> Self {
366 Self { builder: self.builder.property("vpi", vpi), }
367 }
368
369 #[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}