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

use crate::{Connectivity, DeviceState, Internet, Network, Primary, State, ffi, nm};
use glib::{prelude::*, translate::*};

#[doc(alias = "astal_network_primary_from_connection_type")]
pub fn primary_from_connection_type(type_: &str) -> Primary {
    assert_initialized_main_thread!();
    unsafe {
        from_glib(ffi::astal_network_primary_from_connection_type(
            type_.to_glib_none().0,
        ))
    }
}

#[doc(alias = "astal_network_internet_from_device")]
pub fn internet_from_device(device: &impl IsA<nm::Device>) -> Internet {
    assert_initialized_main_thread!();
    unsafe {
        from_glib(ffi::astal_network_internet_from_device(
            device.as_ref().to_glib_none().0,
        ))
    }
}

#[doc(alias = "astal_network_get_default")]
#[doc(alias = "get_default")]
#[allow(clippy::should_implement_trait)]
pub fn default() -> Network {
    assert_initialized_main_thread!();
    unsafe { from_glib_full(ffi::astal_network_get_default()) }
}
