#![allow(deprecated)]
use crate::{ffi,ActiveConnectionState,Device,DhcpConfig,IPConfig,Object,RemoteConnection};
#[cfg(feature = "v1_8")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_8")))]
use crate::{ActiveConnectionStateReason};
#[cfg(feature = "v1_10")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
use crate::{ActivationStateFlags};
use glib::{object::ObjectType as _,prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
use std::{boxed::Box as Box_};
glib::wrapper! {
#[doc(alias = "NMActiveConnection")]
pub struct ActiveConnection(Object<ffi::NMActiveConnection, ffi::NMActiveConnectionClass>) @extends Object;
match fn {
type_ => || ffi::nm_active_connection_get_type(),
}
}
impl ActiveConnection {
pub const NONE: Option<&'static ActiveConnection> = None;
}
pub trait ActiveConnectionExt: IsA<ActiveConnection> + 'static {
#[doc(alias = "nm_active_connection_get_connection")]
#[doc(alias = "get_connection")]
fn connection(&self) -> RemoteConnection {
unsafe {
from_glib_none(ffi::nm_active_connection_get_connection(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_connection_type")]
#[doc(alias = "get_connection_type")]
fn connection_type(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_active_connection_get_connection_type(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_default")]
#[doc(alias = "get_default")]
#[doc(alias = "default")]
fn is_default(&self) -> bool {
unsafe {
from_glib(ffi::nm_active_connection_get_default(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_default6")]
#[doc(alias = "get_default6")]
#[doc(alias = "default6")]
fn is_default6(&self) -> bool {
unsafe {
from_glib(ffi::nm_active_connection_get_default6(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_devices")]
#[doc(alias = "get_devices")]
fn devices(&self) -> Vec<Device> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::nm_active_connection_get_devices(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_dhcp4_config")]
#[doc(alias = "get_dhcp4_config")]
#[doc(alias = "dhcp4-config")]
fn dhcp4_config(&self) -> DhcpConfig {
unsafe {
from_glib_none(ffi::nm_active_connection_get_dhcp4_config(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_dhcp6_config")]
#[doc(alias = "get_dhcp6_config")]
#[doc(alias = "dhcp6-config")]
fn dhcp6_config(&self) -> DhcpConfig {
unsafe {
from_glib_none(ffi::nm_active_connection_get_dhcp6_config(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_id")]
#[doc(alias = "get_id")]
fn id(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_active_connection_get_id(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_ip4_config")]
#[doc(alias = "get_ip4_config")]
#[doc(alias = "ip4-config")]
fn ip4_config(&self) -> IPConfig {
unsafe {
from_glib_none(ffi::nm_active_connection_get_ip4_config(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_ip6_config")]
#[doc(alias = "get_ip6_config")]
#[doc(alias = "ip6-config")]
fn ip6_config(&self) -> IPConfig {
unsafe {
from_glib_none(ffi::nm_active_connection_get_ip6_config(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_specific_object_path")]
#[doc(alias = "get_specific_object_path")]
#[doc(alias = "specific-object-path")]
fn specific_object_path(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_active_connection_get_specific_object_path(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_state")]
#[doc(alias = "get_state")]
fn state(&self) -> ActiveConnectionState {
unsafe {
from_glib(ffi::nm_active_connection_get_state(self.as_ref().to_glib_none().0))
}
}
#[cfg(feature = "v1_10")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
#[doc(alias = "nm_active_connection_get_state_flags")]
#[doc(alias = "get_state_flags")]
#[doc(alias = "state-flags")]
fn state_flags(&self) -> ActivationStateFlags {
unsafe {
from_glib(ffi::nm_active_connection_get_state_flags(self.as_ref().to_glib_none().0))
}
}
#[cfg(feature = "v1_8")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_8")))]
#[doc(alias = "nm_active_connection_get_state_reason")]
#[doc(alias = "get_state_reason")]
fn state_reason(&self) -> ActiveConnectionStateReason {
unsafe {
from_glib(ffi::nm_active_connection_get_state_reason(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_uuid")]
#[doc(alias = "get_uuid")]
fn uuid(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_active_connection_get_uuid(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "nm_active_connection_get_vpn")]
#[doc(alias = "get_vpn")]
#[doc(alias = "vpn")]
fn is_vpn(&self) -> bool {
unsafe {
from_glib(ffi::nm_active_connection_get_vpn(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "type")]
fn type_(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "type")
}
#[doc(alias = "state-changed")]
fn connect_state_changed<F: Fn(&Self, u32, u32) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn state_changed_trampoline<P: IsA<ActiveConnection>, F: Fn(&P, u32, u32) + 'static>(this: *mut ffi::NMActiveConnection, state: std::ffi::c_uint, reason: std::ffi::c_uint, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref(), state, reason)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"state-changed".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(state_changed_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "connection")]
fn connect_connection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_connection_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::connection".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_connection_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[cfg(feature = "v1_44")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
#[doc(alias = "controller")]
fn connect_controller_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_controller_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::controller".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_controller_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "default")]
fn connect_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_default_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::default".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_default_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "default6")]
fn connect_default6_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_default6_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::default6".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_default6_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "devices")]
fn connect_devices_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_devices_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::devices".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_devices_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "dhcp4-config")]
fn connect_dhcp4_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_dhcp4_config_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::dhcp4-config".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_dhcp4_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "dhcp6-config")]
fn connect_dhcp6_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_dhcp6_config_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::dhcp6-config".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_dhcp6_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "id")]
fn connect_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_id_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::id".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_id_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "ip4-config")]
fn connect_ip4_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_ip4_config_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::ip4-config".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip4_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "ip6-config")]
fn connect_ip6_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_ip6_config_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::ip6-config".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip6_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[cfg_attr(feature = "v1_44", deprecated = "Since 1.44")]
#[doc(alias = "master")]
fn connect_master_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_master_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::master".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_master_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "specific-object-path")]
fn connect_specific_object_path_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_specific_object_path_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::specific-object-path".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_specific_object_path_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "state")]
fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_state_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::state".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_state_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[cfg(feature = "v1_10")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
#[doc(alias = "state-flags")]
fn connect_state_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_state_flags_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::state-flags".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_state_flags_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "type")]
fn connect_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_type_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::type".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_type_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "uuid")]
fn connect_uuid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_uuid_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::uuid".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_uuid_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "vpn")]
fn connect_vpn_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_vpn_trampoline<P: IsA<ActiveConnection>, F: Fn(&P) + 'static>(this: *mut ffi::NMActiveConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(ActiveConnection::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::vpn".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vpn_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
}
impl<O: IsA<ActiveConnection>> ActiveConnectionExt for O {}