use crate::{ffi,Setting};
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
use crate::{SettingIpvlanMode};
use glib::{prelude::*};
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
use glib::{signal::{connect_raw, SignalHandlerId},translate::*};
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
use std::{boxed::Box as Box_};
glib::wrapper! {
#[doc(alias = "NMSettingIpvlan")]
pub struct SettingIpvlan(Object<ffi::NMSettingIpvlan, ffi::NMSettingIpvlanClass>) @extends Setting;
match fn {
type_ => || ffi::nm_setting_ipvlan_get_type(),
}
}
impl SettingIpvlan {
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
#[doc(alias = "nm_setting_ipvlan_new")]
pub fn new() -> SettingIpvlan {
assert_initialized_main_thread!();
unsafe {
Setting::from_glib_full(ffi::nm_setting_ipvlan_new()).unsafe_cast()
}
}
pub fn builder() -> SettingIpvlanBuilder {
SettingIpvlanBuilder::new()
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
#[doc(alias = "nm_setting_ipvlan_get_mode")]
#[doc(alias = "get_mode")]
pub fn mode(&self) -> SettingIpvlanMode {
unsafe {
from_glib(ffi::nm_setting_ipvlan_get_mode(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
#[doc(alias = "nm_setting_ipvlan_get_parent")]
#[doc(alias = "get_parent")]
pub fn parent(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_setting_ipvlan_get_parent(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
#[doc(alias = "nm_setting_ipvlan_get_private")]
#[doc(alias = "get_private")]
#[doc(alias = "private")]
pub fn is_private(&self) -> bool {
unsafe {
from_glib(ffi::nm_setting_ipvlan_get_private(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
#[doc(alias = "nm_setting_ipvlan_get_vepa")]
#[doc(alias = "get_vepa")]
#[doc(alias = "vepa")]
pub fn is_vepa(&self) -> bool {
unsafe {
from_glib(ffi::nm_setting_ipvlan_get_vepa(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
pub fn set_mode(&self, mode: u32) {
ObjectExt::set_property(self,"mode", mode)
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
pub fn set_parent(&self, parent: Option<&str>) {
ObjectExt::set_property(self,"parent", parent)
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
pub fn set_private(&self, private: bool) {
ObjectExt::set_property(self,"private", private)
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
pub fn set_vepa(&self, vepa: bool) {
ObjectExt::set_property(self,"vepa", vepa)
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
#[doc(alias = "mode")]
pub fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_mode_trampoline<F: Fn(&SettingIpvlan) + 'static>(this: *mut ffi::NMSettingIpvlan, _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::mode".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mode_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
#[doc(alias = "parent")]
pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_parent_trampoline<F: Fn(&SettingIpvlan) + 'static>(this: *mut ffi::NMSettingIpvlan, _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::parent".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
#[doc(alias = "private")]
pub fn connect_private_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_private_trampoline<F: Fn(&SettingIpvlan) + 'static>(this: *mut ffi::NMSettingIpvlan, _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::private".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_private_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
#[doc(alias = "vepa")]
pub fn connect_vepa_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_vepa_trampoline<F: Fn(&SettingIpvlan) + 'static>(this: *mut ffi::NMSettingIpvlan, _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::vepa".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vepa_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
impl Default for SettingIpvlan {
fn default() -> Self {
Self::new()
}
}
#[must_use = "The builder must be built to be used"]
pub struct SettingIpvlanBuilder {
builder: glib::object::ObjectBuilder<'static, SettingIpvlan>,
}
impl SettingIpvlanBuilder {
fn new() -> Self {
Self { builder: glib::object::Object::builder() }
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
pub fn mode(self, mode: u32) -> Self {
Self { builder: self.builder.property("mode", mode), }
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
pub fn parent(self, parent: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("parent", parent.into()), }
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
pub fn private(self, private: bool) -> Self {
Self { builder: self.builder.property("private", private), }
}
#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
pub fn vepa(self, vepa: bool) -> Self {
Self { builder: self.builder.property("vepa", vepa), }
}
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
pub fn build(self) -> SettingIpvlan {
assert_initialized_main_thread!();
self.builder.build() }
}