use crate::{ffi,Setting,SettingSecretFlags};
use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
use std::{boxed::Box as Box_};
glib::wrapper! {
#[doc(alias = "NMSettingAdsl")]
pub struct SettingAdsl(Object<ffi::NMSettingAdsl, ffi::NMSettingAdslClass>) @extends Setting;
match fn {
type_ => || ffi::nm_setting_adsl_get_type(),
}
}
impl SettingAdsl {
#[doc(alias = "nm_setting_adsl_new")]
pub fn new() -> SettingAdsl {
assert_initialized_main_thread!();
unsafe {
Setting::from_glib_full(ffi::nm_setting_adsl_new()).unsafe_cast()
}
}
pub fn builder() -> SettingAdslBuilder {
SettingAdslBuilder::new()
}
#[doc(alias = "nm_setting_adsl_get_encapsulation")]
#[doc(alias = "get_encapsulation")]
pub fn encapsulation(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_setting_adsl_get_encapsulation(self.to_glib_none().0))
}
}
#[doc(alias = "nm_setting_adsl_get_password")]
#[doc(alias = "get_password")]
pub fn password(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_setting_adsl_get_password(self.to_glib_none().0))
}
}
#[doc(alias = "nm_setting_adsl_get_password_flags")]
#[doc(alias = "get_password_flags")]
#[doc(alias = "password-flags")]
pub fn password_flags(&self) -> SettingSecretFlags {
unsafe {
from_glib(ffi::nm_setting_adsl_get_password_flags(self.to_glib_none().0))
}
}
#[doc(alias = "nm_setting_adsl_get_protocol")]
#[doc(alias = "get_protocol")]
pub fn protocol(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_setting_adsl_get_protocol(self.to_glib_none().0))
}
}
#[doc(alias = "nm_setting_adsl_get_username")]
#[doc(alias = "get_username")]
pub fn username(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_setting_adsl_get_username(self.to_glib_none().0))
}
}
#[doc(alias = "nm_setting_adsl_get_vci")]
#[doc(alias = "get_vci")]
pub fn vci(&self) -> u32 {
unsafe {
ffi::nm_setting_adsl_get_vci(self.to_glib_none().0)
}
}
#[doc(alias = "nm_setting_adsl_get_vpi")]
#[doc(alias = "get_vpi")]
pub fn vpi(&self) -> u32 {
unsafe {
ffi::nm_setting_adsl_get_vpi(self.to_glib_none().0)
}
}
pub fn set_encapsulation(&self, encapsulation: Option<&str>) {
ObjectExt::set_property(self,"encapsulation", encapsulation)
}
pub fn set_password(&self, password: Option<&str>) {
ObjectExt::set_property(self,"password", password)
}
#[doc(alias = "password-flags")]
pub fn set_password_flags(&self, password_flags: SettingSecretFlags) {
ObjectExt::set_property(self,"password-flags", password_flags)
}
pub fn set_protocol(&self, protocol: Option<&str>) {
ObjectExt::set_property(self,"protocol", protocol)
}
pub fn set_username(&self, username: Option<&str>) {
ObjectExt::set_property(self,"username", username)
}
pub fn set_vci(&self, vci: u32) {
ObjectExt::set_property(self,"vci", vci)
}
pub fn set_vpi(&self, vpi: u32) {
ObjectExt::set_property(self,"vpi", vpi)
}
#[doc(alias = "encapsulation")]
pub fn connect_encapsulation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_encapsulation_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::encapsulation".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_encapsulation_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "password")]
pub fn connect_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_password_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::password".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "password-flags")]
pub fn connect_password_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
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) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::password-flags".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "protocol")]
pub fn connect_protocol_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_protocol_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::protocol".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_protocol_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "username")]
pub fn connect_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_username_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::username".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_username_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "vci")]
pub fn connect_vci_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_vci_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::vci".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vci_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "vpi")]
pub fn connect_vpi_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_vpi_trampoline<F: Fn(&SettingAdsl) + 'static>(this: *mut ffi::NMSettingAdsl, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::vpi".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vpi_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
}
impl Default for SettingAdsl {
fn default() -> Self {
Self::new()
}
}
#[must_use = "The builder must be built to be used"]
pub struct SettingAdslBuilder {
builder: glib::object::ObjectBuilder<'static, SettingAdsl>,
}
impl SettingAdslBuilder {
fn new() -> Self {
Self { builder: glib::object::Object::builder() }
}
pub fn encapsulation(self, encapsulation: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("encapsulation", encapsulation.into()), }
}
pub fn password(self, password: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("password", password.into()), }
}
pub fn password_flags(self, password_flags: SettingSecretFlags) -> Self {
Self { builder: self.builder.property("password-flags", password_flags), }
}
pub fn protocol(self, protocol: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("protocol", protocol.into()), }
}
pub fn username(self, username: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("username", username.into()), }
}
pub fn vci(self, vci: u32) -> Self {
Self { builder: self.builder.property("vci", vci), }
}
pub fn vpi(self, vpi: u32) -> Self {
Self { builder: self.builder.property("vpi", vpi), }
}
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
pub fn build(self) -> SettingAdsl {
assert_initialized_main_thread!();
self.builder.build() }
}