// This file was generated by gir (https://github.com/gtk-rs/gir)
// from ../../girs
// from ../../gtk-girs
// DO NOT EDIT

use crate::{AccessPoint, DeviceState, Internet, ffi, nm};
use glib::{
    object::ObjectType as _,
    prelude::*,
    signal::{SignalHandlerId, connect_raw},
    translate::*,
};
use std::{boxed::Box as Box_, os::raw::c_void};

glib::wrapper! {
    ///
    ///
    /// ## Properties
    ///
    ///
    /// #### `device`
    ///  Readable | Writeable | Construct
    ///
    ///
    /// #### `active-connection`
    ///  Readable | Writeable
    ///
    ///
    /// #### `active-access-point`
    ///  Readable | Writeable
    ///
    ///
    /// #### `access-points`
    ///  Readable
    ///
    ///
    /// #### `enabled`
    ///  Readable | Writeable
    ///
    ///
    /// #### `internet`
    ///  Readable | Writeable
    ///
    ///
    /// #### `bandwidth`
    ///  Readable | Writeable
    ///
    ///
    /// #### `ssid`
    ///  Readable | Writeable
    ///
    ///
    /// #### `strength`
    ///  Readable | Writeable
    ///
    ///
    /// #### `frequency`
    ///  Readable | Writeable
    ///
    ///
    /// #### `state`
    ///  Readable | Writeable
    ///
    ///
    /// #### `icon-name`
    ///  Readable | Writeable
    ///
    ///
    /// #### `is-hotspot`
    ///  Readable | Writeable
    ///
    ///
    /// #### `scanning`
    ///  Readable | Writeable
    ///
    /// ## Signals
    ///
    ///
    /// #### `access-point-added`
    ///
    ///
    ///
    /// #### `access-point-removed`
    ///
    ///
    ///
    /// #### `state-changed`
    ///
    ///
    /// # Implements
    ///
    /// [`WifiExt`][trait@crate::prelude::WifiExt]
    #[doc(alias = "AstalNetworkWifi")]
    pub struct Wifi(Object<ffi::AstalNetworkWifi, ffi::AstalNetworkWifiClass>);

    match fn {
        type_ => || ffi::astal_network_wifi_get_type(),
    }
}

impl Wifi {
    pub const NONE: Option<&'static Wifi> = None;

    // rustdoc-stripper-ignore-next
    /// Creates a new builder-pattern struct instance to construct [`Wifi`] objects.
    ///
    /// This method returns an instance of [`WifiBuilder`](crate::builders::WifiBuilder) which can be used to create [`Wifi`] objects.
    pub fn builder() -> WifiBuilder {
        WifiBuilder::new()
    }
}

// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`Wifi`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct WifiBuilder {
    builder: glib::object::ObjectBuilder<'static, Wifi>,
}

impl WifiBuilder {
    fn new() -> Self {
        Self {
            builder: glib::object::Object::builder(),
        }
    }

    pub fn device(self, device: &nm::DeviceWifi) -> Self {
        Self {
            builder: self.builder.property("device", device.clone()),
        }
    }

    pub fn active_connection(self, active_connection: &impl IsA<nm::ActiveConnection>) -> Self {
        Self {
            builder: self
                .builder
                .property("active-connection", active_connection.clone().upcast()),
        }
    }

    pub fn active_access_point(self, active_access_point: &impl IsA<AccessPoint>) -> Self {
        Self {
            builder: self
                .builder
                .property("active-access-point", active_access_point.clone().upcast()),
        }
    }

    pub fn enabled(self, enabled: bool) -> Self {
        Self {
            builder: self.builder.property("enabled", enabled),
        }
    }

    pub fn internet(self, internet: Internet) -> Self {
        Self {
            builder: self.builder.property("internet", internet),
        }
    }

    pub fn bandwidth(self, bandwidth: u32) -> Self {
        Self {
            builder: self.builder.property("bandwidth", bandwidth),
        }
    }

    pub fn ssid(self, ssid: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("ssid", ssid.into()),
        }
    }

    pub fn strength(self, strength: u8) -> Self {
        Self {
            builder: self.builder.property("strength", strength),
        }
    }

    pub fn frequency(self, frequency: u32) -> Self {
        Self {
            builder: self.builder.property("frequency", frequency),
        }
    }

    pub fn state(self, state: DeviceState) -> Self {
        Self {
            builder: self.builder.property("state", state),
        }
    }

    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("icon-name", icon_name.into()),
        }
    }

    pub fn is_hotspot(self, is_hotspot: bool) -> Self {
        Self {
            builder: self.builder.property("is-hotspot", is_hotspot),
        }
    }

    pub fn scanning(self, scanning: bool) -> Self {
        Self {
            builder: self.builder.property("scanning", scanning),
        }
    }

    // rustdoc-stripper-ignore-next
    /// Build the [`Wifi`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> Wifi {
        assert_initialized_main_thread!();
        self.builder.build()
    }
}

/// Trait containing all [`struct@Wifi`] methods.
///
/// # Implementors
///
/// [`Wifi`][struct@crate::Wifi]
pub trait WifiExt: IsA<Wifi> + 'static {
    #[doc(alias = "astal_network_wifi_scan")]
    fn scan(&self) {
        unsafe {
            ffi::astal_network_wifi_scan(self.as_ref().to_glib_none().0);
        }
    }

    #[doc(alias = "astal_network_wifi_get_device")]
    #[doc(alias = "get_device")]
    fn device(&self) -> nm::DeviceWifi {
        unsafe {
            from_glib_none(ffi::astal_network_wifi_get_device(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_set_device")]
    fn set_device(&self, value: &nm::DeviceWifi) {
        unsafe {
            ffi::astal_network_wifi_set_device(
                self.as_ref().to_glib_none().0,
                value.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "astal_network_wifi_get_active_connection")]
    #[doc(alias = "get_active_connection")]
    fn active_connection(&self) -> Option<nm::ActiveConnection> {
        unsafe {
            from_glib_none(ffi::astal_network_wifi_get_active_connection(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_get_active_access_point")]
    #[doc(alias = "get_active_access_point")]
    fn active_access_point(&self) -> Option<AccessPoint> {
        unsafe {
            from_glib_none(ffi::astal_network_wifi_get_active_access_point(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_get_access_points")]
    #[doc(alias = "get_access_points")]
    fn access_points(&self) -> Vec<AccessPoint> {
        unsafe {
            FromGlibPtrContainer::from_glib_container(ffi::astal_network_wifi_get_access_points(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_get_enabled")]
    #[doc(alias = "get_enabled")]
    fn is_enabled(&self) -> bool {
        unsafe {
            from_glib(ffi::astal_network_wifi_get_enabled(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_set_enabled")]
    fn set_enabled(&self, value: bool) {
        unsafe {
            ffi::astal_network_wifi_set_enabled(self.as_ref().to_glib_none().0, value.into_glib());
        }
    }

    #[doc(alias = "astal_network_wifi_get_internet")]
    #[doc(alias = "get_internet")]
    fn internet(&self) -> Internet {
        unsafe {
            from_glib(ffi::astal_network_wifi_get_internet(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_get_bandwidth")]
    #[doc(alias = "get_bandwidth")]
    fn bandwidth(&self) -> u32 {
        unsafe { ffi::astal_network_wifi_get_bandwidth(self.as_ref().to_glib_none().0) }
    }

    #[doc(alias = "astal_network_wifi_get_ssid")]
    #[doc(alias = "get_ssid")]
    fn ssid(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::astal_network_wifi_get_ssid(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_get_strength")]
    #[doc(alias = "get_strength")]
    fn strength(&self) -> u8 {
        unsafe { ffi::astal_network_wifi_get_strength(self.as_ref().to_glib_none().0) }
    }

    #[doc(alias = "astal_network_wifi_get_frequency")]
    #[doc(alias = "get_frequency")]
    fn frequency(&self) -> u32 {
        unsafe { ffi::astal_network_wifi_get_frequency(self.as_ref().to_glib_none().0) }
    }

    #[doc(alias = "astal_network_wifi_get_state")]
    #[doc(alias = "get_state")]
    fn state(&self) -> DeviceState {
        unsafe {
            from_glib(ffi::astal_network_wifi_get_state(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_get_icon_name")]
    #[doc(alias = "get_icon_name")]
    fn icon_name(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::astal_network_wifi_get_icon_name(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_get_is_hotspot")]
    #[doc(alias = "get_is_hotspot")]
    fn is_hotspot(&self) -> bool {
        unsafe {
            from_glib(ffi::astal_network_wifi_get_is_hotspot(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "astal_network_wifi_get_scanning")]
    #[doc(alias = "get_scanning")]
    fn is_scanning(&self) -> bool {
        unsafe {
            from_glib(ffi::astal_network_wifi_get_scanning(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "active-connection")]
    fn set_active_connection<P: IsA<nm::ActiveConnection>>(&self, active_connection: Option<&P>) {
        ObjectExt::set_property(self.as_ref(), "active-connection", active_connection)
    }

    #[doc(alias = "active-access-point")]
    fn set_active_access_point<P: IsA<AccessPoint>>(&self, active_access_point: Option<&P>) {
        ObjectExt::set_property(self.as_ref(), "active-access-point", active_access_point)
    }

    fn set_internet(&self, internet: Internet) {
        ObjectExt::set_property(self.as_ref(), "internet", internet)
    }

    fn set_bandwidth(&self, bandwidth: u32) {
        ObjectExt::set_property(self.as_ref(), "bandwidth", bandwidth)
    }

    fn set_ssid(&self, ssid: Option<&str>) {
        ObjectExt::set_property(self.as_ref(), "ssid", ssid)
    }

    fn set_strength(&self, strength: u8) {
        ObjectExt::set_property(self.as_ref(), "strength", strength)
    }

    fn set_frequency(&self, frequency: u32) {
        ObjectExt::set_property(self.as_ref(), "frequency", frequency)
    }

    fn set_state(&self, state: DeviceState) {
        ObjectExt::set_property(self.as_ref(), "state", state)
    }

    #[doc(alias = "icon-name")]
    fn set_icon_name(&self, icon_name: Option<&str>) {
        ObjectExt::set_property(self.as_ref(), "icon-name", icon_name)
    }

    #[doc(alias = "is-hotspot")]
    fn set_is_hotspot(&self, is_hotspot: bool) {
        ObjectExt::set_property(self.as_ref(), "is-hotspot", is_hotspot)
    }

    fn set_scanning(&self, scanning: bool) {
        ObjectExt::set_property(self.as_ref(), "scanning", scanning)
    }

    #[doc(alias = "access-point-added")]
    fn connect_access_point_added<F: Fn(&Self, &AccessPoint) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn access_point_added_trampoline<
            P: IsA<Wifi>,
            F: Fn(&P, &AccessPoint) + 'static,
        >(
            this: *mut ffi::AstalNetworkWifi,
            ap: *mut ffi::AstalNetworkAccessPoint,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                Wifi::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(ap),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"access-point-added".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    access_point_added_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "access-point-removed")]
    fn connect_access_point_removed<F: Fn(&Self, &AccessPoint) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn access_point_removed_trampoline<
            P: IsA<Wifi>,
            F: Fn(&P, &AccessPoint) + 'static,
        >(
            this: *mut ffi::AstalNetworkWifi,
            ap: *mut ffi::AstalNetworkAccessPoint,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                Wifi::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(ap),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"access-point-removed".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    access_point_removed_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    //#[doc(alias = "state-changed")]
    //fn connect_state_changed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
    //    Ignored reaseon: NM.DeviceStateReason
    //}

    #[doc(alias = "device")]
    fn connect_device_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_device_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::device".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_device_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "active-connection")]
    fn connect_active_connection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_active_connection_trampoline<
            P: IsA<Wifi>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::active-connection".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_active_connection_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "active-access-point")]
    fn connect_active_access_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_active_access_point_trampoline<
            P: IsA<Wifi>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::active-access-point".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_active_access_point_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "access-points")]
    fn connect_access_points_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_access_points_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::access-points".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_access_points_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "enabled")]
    fn connect_enabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_enabled_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::enabled".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_enabled_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "internet")]
    fn connect_internet_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_internet_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::internet".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_internet_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "bandwidth")]
    fn connect_bandwidth_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_bandwidth_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::bandwidth".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_bandwidth_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "ssid")]
    fn connect_ssid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_ssid_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::ssid".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_ssid_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "strength")]
    fn connect_strength_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_strength_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::strength".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_strength_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "frequency")]
    fn connect_frequency_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_frequency_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::frequency".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_frequency_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<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::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),
            )
        }
    }

    #[doc(alias = "icon-name")]
    fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_icon_name_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::icon-name".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_icon_name_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "is-hotspot")]
    fn connect_is_hotspot_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_is_hotspot_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::is-hotspot".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_is_hotspot_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "scanning")]
    fn connect_scanning_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_scanning_trampoline<P: IsA<Wifi>, F: Fn(&P) + 'static>(
            this: *mut ffi::AstalNetworkWifi,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Wifi::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::scanning".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_scanning_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<Wifi>> WifiExt for O {}
