1#![allow(deprecated)]
6
7use crate::{ffi,ActiveConnection,Connection,DeviceCapabilities,DeviceState,DeviceStateReason,DeviceType,DhcpConfig,IPConfig,Object,RemoteConnection};
8#[cfg(feature = "v1_2")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
10use crate::{LldpNeighbor,Metered};
11#[cfg(feature = "v1_16")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
13use crate::{ConnectivityState};
14#[cfg(feature = "v1_22")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
16use crate::{DeviceInterfaceFlags};
17use glib::{object::ObjectType as _,prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
18use std::{boxed::Box as Box_,pin::Pin};
19
20glib::wrapper! {
21 #[doc(alias = "NMDevice")]
278 pub struct Device(Object<ffi::NMDevice, ffi::NMDeviceClass>) @extends Object;
279
280 match fn {
281 type_ => || ffi::nm_device_get_type(),
282 }
283}
284
285impl Device {
286 pub const NONE: Option<&'static Device> = None;
287
288
289 #[doc(alias = "nm_device_disambiguate_names")]
298 pub fn disambiguate_names(devices: &[Device]) -> Vec<glib::GString> {
299 assert_initialized_main_thread!();
300 let num_devices = devices.len() as _;
301 unsafe {
302 FromGlibPtrContainer::from_glib_full(ffi::nm_device_disambiguate_names(devices.to_glib_none().0, num_devices))
303 }
304 }
305}
306
307pub trait DeviceExt: IsA<Device> + 'static {
313 #[doc(alias = "nm_device_connection_compatible")]
332 fn connection_compatible(&self, connection: &impl IsA<Connection>) -> Result<(), glib::Error> {
333 unsafe {
334 let mut error = std::ptr::null_mut();
335 let is_ok = ffi::nm_device_connection_compatible(self.as_ref().to_glib_none().0, connection.as_ref().to_glib_none().0, &mut error);
336 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
337 if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
338 }
339 }
340
341 #[doc(alias = "nm_device_connection_valid")]
356 fn connection_valid(&self, connection: &impl IsA<Connection>) -> bool {
357 unsafe {
358 from_glib(ffi::nm_device_connection_valid(self.as_ref().to_glib_none().0, connection.as_ref().to_glib_none().0))
359 }
360 }
361
362 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
375 #[allow(deprecated)]
376 #[doc(alias = "nm_device_delete")]
377 fn delete(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
378 unsafe {
379 let mut error = std::ptr::null_mut();
380 let is_ok = ffi::nm_device_delete(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
381 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
382 if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
383 }
384 }
385
386 #[doc(alias = "nm_device_delete_async")]
393 fn delete_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
394
395 let main_context = glib::MainContext::ref_thread_default();
396 let is_main_context_owner = main_context.is_owner();
397 let has_acquired_main_context = (!is_main_context_owner)
398 .then(|| main_context.acquire().ok())
399 .flatten();
400 assert!(
401 is_main_context_owner || has_acquired_main_context.is_some(),
402 "Async operations only allowed if the thread is owning the MainContext"
403 );
404
405 let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
406 unsafe extern "C" fn delete_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
407 let mut error = std::ptr::null_mut();
408 ffi::nm_device_delete_finish(_source_object as *mut _, res, &mut error);
409 let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
410 let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
411 let callback: P = callback.into_inner();
412 callback(result);
413 }
414 let callback = delete_async_trampoline::<P>;
415 unsafe {
416 ffi::nm_device_delete_async(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
417 }
418 }
419
420
421 fn delete_future(&self) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
422
423 Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
424 obj.delete_async(
425 Some(cancellable),
426 move |res| {
427 send.resolve(res);
428 },
429 );
430 }))
431 }
432
433 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
447 #[allow(deprecated)]
448 #[doc(alias = "nm_device_disconnect")]
449 fn disconnect(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
450 unsafe {
451 let mut error = std::ptr::null_mut();
452 let is_ok = ffi::nm_device_disconnect(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
453 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
454 if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
455 }
456 }
457
458 #[doc(alias = "nm_device_disconnect_async")]
466 fn disconnect_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
467
468 let main_context = glib::MainContext::ref_thread_default();
469 let is_main_context_owner = main_context.is_owner();
470 let has_acquired_main_context = (!is_main_context_owner)
471 .then(|| main_context.acquire().ok())
472 .flatten();
473 assert!(
474 is_main_context_owner || has_acquired_main_context.is_some(),
475 "Async operations only allowed if the thread is owning the MainContext"
476 );
477
478 let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
479 unsafe extern "C" fn disconnect_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
480 let mut error = std::ptr::null_mut();
481 ffi::nm_device_disconnect_finish(_source_object as *mut _, res, &mut error);
482 let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
483 let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
484 let callback: P = callback.into_inner();
485 callback(result);
486 }
487 let callback = disconnect_async_trampoline::<P>;
488 unsafe {
489 ffi::nm_device_disconnect_async(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
490 }
491 }
492
493
494 fn disconnect_future(&self) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
495
496 Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
497 obj.disconnect_async(
498 Some(cancellable),
499 move |res| {
500 send.resolve(res);
501 },
502 );
503 }))
504 }
505
506 #[doc(alias = "nm_device_filter_connections")]
527 fn filter_connections(&self, connections: &[Connection]) -> Vec<Connection> {
528 unsafe {
529 FromGlibPtrContainer::from_glib_full(ffi::nm_device_filter_connections(self.as_ref().to_glib_none().0, connections.to_glib_none().0))
530 }
531 }
532
533 #[doc(alias = "nm_device_get_active_connection")]
540 #[doc(alias = "get_active_connection")]
541 #[doc(alias = "active-connection")]
542 fn active_connection(&self) -> ActiveConnection {
543 unsafe {
544 from_glib_none(ffi::nm_device_get_active_connection(self.as_ref().to_glib_none().0))
545 }
546 }
547
548 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
570 #[cfg(feature = "v1_2")]
571 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
572 #[allow(deprecated)]
573 #[doc(alias = "nm_device_get_applied_connection")]
574 #[doc(alias = "get_applied_connection")]
575 fn applied_connection(&self, flags: u32, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(Connection, u64), glib::Error> {
576 unsafe {
577 let mut version_id = std::mem::MaybeUninit::uninit();
578 let mut error = std::ptr::null_mut();
579 let ret = ffi::nm_device_get_applied_connection(self.as_ref().to_glib_none().0, flags, version_id.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
580 if error.is_null() { Ok((from_glib_full(ret), version_id.assume_init())) } else { Err(from_glib_full(error)) }
581 }
582 }
583
584 #[cfg(feature = "v1_2")]
592 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
593 #[doc(alias = "nm_device_get_applied_connection_async")]
594 #[doc(alias = "get_applied_connection_async")]
595 fn applied_connection_async<P: FnOnce(Result<(Connection, u64), glib::Error>) + 'static>(&self, flags: u32, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
596
597 let main_context = glib::MainContext::ref_thread_default();
598 let is_main_context_owner = main_context.is_owner();
599 let has_acquired_main_context = (!is_main_context_owner)
600 .then(|| main_context.acquire().ok())
601 .flatten();
602 assert!(
603 is_main_context_owner || has_acquired_main_context.is_some(),
604 "Async operations only allowed if the thread is owning the MainContext"
605 );
606
607 let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
608 unsafe extern "C" fn applied_connection_async_trampoline<P: FnOnce(Result<(Connection, u64), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
609 let mut error = std::ptr::null_mut();
610 let mut version_id = std::mem::MaybeUninit::uninit();
611 let ret = ffi::nm_device_get_applied_connection_finish(_source_object as *mut _, res, version_id.as_mut_ptr(), &mut error);
612 let result = if error.is_null() { Ok((from_glib_full(ret), version_id.assume_init())) } else { Err(from_glib_full(error)) };
613 let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
614 let callback: P = callback.into_inner();
615 callback(result);
616 }
617 let callback = applied_connection_async_trampoline::<P>;
618 unsafe {
619 ffi::nm_device_get_applied_connection_async(self.as_ref().to_glib_none().0, flags, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
620 }
621 }
622
623
624 #[cfg(feature = "v1_2")]
625 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
626 fn applied_connection_future(&self, flags: u32) -> Pin<Box_<dyn std::future::Future<Output = Result<(Connection, u64), glib::Error>> + 'static>> {
627
628 Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
629 obj.applied_connection_async(
630 flags,
631 Some(cancellable),
632 move |res| {
633 send.resolve(res);
634 },
635 );
636 }))
637 }
638
639 #[doc(alias = "nm_device_get_autoconnect")]
645 #[doc(alias = "get_autoconnect")]
646 #[doc(alias = "autoconnect")]
647 fn is_autoconnect(&self) -> bool {
648 unsafe {
649 from_glib(ffi::nm_device_get_autoconnect(self.as_ref().to_glib_none().0))
650 }
651 }
652
653 #[doc(alias = "nm_device_get_available_connections")]
662 #[doc(alias = "get_available_connections")]
663 #[doc(alias = "available-connections")]
664 fn available_connections(&self) -> Vec<RemoteConnection> {
665 unsafe {
666 FromGlibPtrContainer::from_glib_none(ffi::nm_device_get_available_connections(self.as_ref().to_glib_none().0))
667 }
668 }
669
670 #[doc(alias = "nm_device_get_capabilities")]
676 #[doc(alias = "get_capabilities")]
677 fn capabilities(&self) -> DeviceCapabilities {
678 unsafe {
679 from_glib(ffi::nm_device_get_capabilities(self.as_ref().to_glib_none().0))
680 }
681 }
682
683 #[cfg(feature = "v1_16")]
693 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
694 #[doc(alias = "nm_device_get_connectivity")]
695 #[doc(alias = "get_connectivity")]
696 fn connectivity(&self, addr_family: i32) -> ConnectivityState {
697 unsafe {
698 from_glib(ffi::nm_device_get_connectivity(self.as_ref().to_glib_none().0, addr_family))
699 }
700 }
701
702 #[doc(alias = "nm_device_get_description")]
709 #[doc(alias = "get_description")]
710 fn description(&self) -> glib::GString {
711 unsafe {
712 from_glib_none(ffi::nm_device_get_description(self.as_ref().to_glib_none().0))
713 }
714 }
715
716 #[doc(alias = "nm_device_get_device_type")]
722 #[doc(alias = "get_device_type")]
723 #[doc(alias = "device-type")]
724 fn device_type(&self) -> DeviceType {
725 unsafe {
726 from_glib(ffi::nm_device_get_device_type(self.as_ref().to_glib_none().0))
727 }
728 }
729
730 #[doc(alias = "nm_device_get_dhcp4_config")]
740 #[doc(alias = "get_dhcp4_config")]
741 #[doc(alias = "dhcp4-config")]
742 fn dhcp4_config(&self) -> DhcpConfig {
743 unsafe {
744 from_glib_none(ffi::nm_device_get_dhcp4_config(self.as_ref().to_glib_none().0))
745 }
746 }
747
748 #[doc(alias = "nm_device_get_dhcp6_config")]
758 #[doc(alias = "get_dhcp6_config")]
759 #[doc(alias = "dhcp6-config")]
760 fn dhcp6_config(&self) -> DhcpConfig {
761 unsafe {
762 from_glib_none(ffi::nm_device_get_dhcp6_config(self.as_ref().to_glib_none().0))
763 }
764 }
765
766 #[doc(alias = "nm_device_get_driver")]
773 #[doc(alias = "get_driver")]
774 fn driver(&self) -> glib::GString {
775 unsafe {
776 from_glib_none(ffi::nm_device_get_driver(self.as_ref().to_glib_none().0))
777 }
778 }
779
780 #[doc(alias = "nm_device_get_driver_version")]
787 #[doc(alias = "get_driver_version")]
788 #[doc(alias = "driver-version")]
789 fn driver_version(&self) -> glib::GString {
790 unsafe {
791 from_glib_none(ffi::nm_device_get_driver_version(self.as_ref().to_glib_none().0))
792 }
793 }
794
795 #[doc(alias = "nm_device_get_firmware_missing")]
803 #[doc(alias = "get_firmware_missing")]
804 #[doc(alias = "firmware-missing")]
805 fn is_firmware_missing(&self) -> bool {
806 unsafe {
807 from_glib(ffi::nm_device_get_firmware_missing(self.as_ref().to_glib_none().0))
808 }
809 }
810
811 #[doc(alias = "nm_device_get_firmware_version")]
818 #[doc(alias = "get_firmware_version")]
819 #[doc(alias = "firmware-version")]
820 fn firmware_version(&self) -> glib::GString {
821 unsafe {
822 from_glib_none(ffi::nm_device_get_firmware_version(self.as_ref().to_glib_none().0))
823 }
824 }
825
826 #[doc(alias = "nm_device_get_hw_address")]
833 #[doc(alias = "get_hw_address")]
834 #[doc(alias = "hw-address")]
835 fn hw_address(&self) -> glib::GString {
836 unsafe {
837 from_glib_none(ffi::nm_device_get_hw_address(self.as_ref().to_glib_none().0))
838 }
839 }
840
841 #[doc(alias = "nm_device_get_iface")]
848 #[doc(alias = "get_iface")]
849 fn iface(&self) -> glib::GString {
850 unsafe {
851 from_glib_none(ffi::nm_device_get_iface(self.as_ref().to_glib_none().0))
852 }
853 }
854
855 #[cfg(feature = "v1_22")]
861 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
862 #[doc(alias = "nm_device_get_interface_flags")]
863 #[doc(alias = "get_interface_flags")]
864 #[doc(alias = "interface-flags")]
865 fn interface_flags(&self) -> DeviceInterfaceFlags {
866 unsafe {
867 from_glib(ffi::nm_device_get_interface_flags(self.as_ref().to_glib_none().0))
868 }
869 }
870
871 #[doc(alias = "nm_device_get_ip4_config")]
881 #[doc(alias = "get_ip4_config")]
882 #[doc(alias = "ip4-config")]
883 fn ip4_config(&self) -> IPConfig {
884 unsafe {
885 from_glib_none(ffi::nm_device_get_ip4_config(self.as_ref().to_glib_none().0))
886 }
887 }
888
889 #[doc(alias = "nm_device_get_ip6_config")]
898 #[doc(alias = "get_ip6_config")]
899 #[doc(alias = "ip6-config")]
900 fn ip6_config(&self) -> IPConfig {
901 unsafe {
902 from_glib_none(ffi::nm_device_get_ip6_config(self.as_ref().to_glib_none().0))
903 }
904 }
905
906 #[doc(alias = "nm_device_get_ip_iface")]
914 #[doc(alias = "get_ip_iface")]
915 fn ip_iface(&self) -> glib::GString {
916 unsafe {
917 from_glib_none(ffi::nm_device_get_ip_iface(self.as_ref().to_glib_none().0))
918 }
919 }
920
921 #[cfg(feature = "v1_2")]
930 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
931 #[doc(alias = "nm_device_get_lldp_neighbors")]
932 #[doc(alias = "get_lldp_neighbors")]
933 #[doc(alias = "lldp-neighbors")]
934 fn lldp_neighbors(&self) -> Vec<LldpNeighbor> {
935 unsafe {
936 FromGlibPtrContainer::from_glib_none(ffi::nm_device_get_lldp_neighbors(self.as_ref().to_glib_none().0))
937 }
938 }
939
940 #[doc(alias = "nm_device_get_managed")]
946 #[doc(alias = "get_managed")]
947 #[doc(alias = "managed")]
948 fn is_managed(&self) -> bool {
949 unsafe {
950 from_glib(ffi::nm_device_get_managed(self.as_ref().to_glib_none().0))
951 }
952 }
953
954 #[cfg(feature = "v1_2")]
960 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
961 #[doc(alias = "nm_device_get_metered")]
962 #[doc(alias = "get_metered")]
963 fn metered(&self) -> Metered {
964 unsafe {
965 from_glib(ffi::nm_device_get_metered(self.as_ref().to_glib_none().0))
966 }
967 }
968
969 #[doc(alias = "nm_device_get_mtu")]
975 #[doc(alias = "get_mtu")]
976 fn mtu(&self) -> u32 {
977 unsafe {
978 ffi::nm_device_get_mtu(self.as_ref().to_glib_none().0)
979 }
980 }
981
982 #[cfg(feature = "v1_2")]
988 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
989 #[doc(alias = "nm_device_get_nm_plugin_missing")]
990 #[doc(alias = "get_nm_plugin_missing")]
991 #[doc(alias = "nm-plugin-missing")]
992 fn is_nm_plugin_missing(&self) -> bool {
993 unsafe {
994 from_glib(ffi::nm_device_get_nm_plugin_missing(self.as_ref().to_glib_none().0))
995 }
996 }
997
998 #[cfg(feature = "v1_26")]
1007 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
1008 #[doc(alias = "nm_device_get_path")]
1009 #[doc(alias = "get_path")]
1010 fn path(&self) -> glib::GString {
1011 unsafe {
1012 from_glib_none(ffi::nm_device_get_path(self.as_ref().to_glib_none().0))
1013 }
1014 }
1015
1016 #[doc(alias = "nm_device_get_physical_port_id")]
1027 #[doc(alias = "get_physical_port_id")]
1028 #[doc(alias = "physical-port-id")]
1029 fn physical_port_id(&self) -> glib::GString {
1030 unsafe {
1031 from_glib_none(ffi::nm_device_get_physical_port_id(self.as_ref().to_glib_none().0))
1032 }
1033 }
1034
1035 #[cfg(feature = "v1_34")]
1043 #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
1044 #[doc(alias = "nm_device_get_ports")]
1045 #[doc(alias = "get_ports")]
1046 fn ports(&self) -> Vec<Device> {
1047 unsafe {
1048 FromGlibPtrContainer::from_glib_none(ffi::nm_device_get_ports(self.as_ref().to_glib_none().0))
1049 }
1050 }
1051
1052 #[doc(alias = "nm_device_get_product")]
1062 #[doc(alias = "get_product")]
1063 fn product(&self) -> glib::GString {
1064 unsafe {
1065 from_glib_none(ffi::nm_device_get_product(self.as_ref().to_glib_none().0))
1066 }
1067 }
1068
1069 #[doc(alias = "nm_device_get_setting_type")]
1076 #[doc(alias = "get_setting_type")]
1077 fn setting_type(&self) -> glib::types::Type {
1078 unsafe {
1079 from_glib(ffi::nm_device_get_setting_type(self.as_ref().to_glib_none().0))
1080 }
1081 }
1082
1083 #[doc(alias = "nm_device_get_state")]
1089 #[doc(alias = "get_state")]
1090 fn state(&self) -> DeviceState {
1091 unsafe {
1092 from_glib(ffi::nm_device_get_state(self.as_ref().to_glib_none().0))
1093 }
1094 }
1095
1096 #[doc(alias = "nm_device_get_state_reason")]
1102 #[doc(alias = "get_state_reason")]
1103 #[doc(alias = "state-reason")]
1104 fn state_reason(&self) -> DeviceStateReason {
1105 unsafe {
1106 from_glib(ffi::nm_device_get_state_reason(self.as_ref().to_glib_none().0))
1107 }
1108 }
1109
1110 #[doc(alias = "nm_device_get_type_description")]
1118 #[doc(alias = "get_type_description")]
1119 fn type_description(&self) -> glib::GString {
1120 unsafe {
1121 from_glib_none(ffi::nm_device_get_type_description(self.as_ref().to_glib_none().0))
1122 }
1123 }
1124
1125 #[doc(alias = "nm_device_get_udi")]
1133 #[doc(alias = "get_udi")]
1134 fn udi(&self) -> glib::GString {
1135 unsafe {
1136 from_glib_none(ffi::nm_device_get_udi(self.as_ref().to_glib_none().0))
1137 }
1138 }
1139
1140 #[doc(alias = "nm_device_get_vendor")]
1150 #[doc(alias = "get_vendor")]
1151 fn vendor(&self) -> glib::GString {
1152 unsafe {
1153 from_glib_none(ffi::nm_device_get_vendor(self.as_ref().to_glib_none().0))
1154 }
1155 }
1156
1157 #[cfg(feature = "v1_2")]
1164 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1165 #[doc(alias = "nm_device_is_real")]
1166 #[doc(alias = "real")]
1167 fn is_real(&self) -> bool {
1168 unsafe {
1169 from_glib(ffi::nm_device_is_real(self.as_ref().to_glib_none().0))
1170 }
1171 }
1172
1173 #[doc(alias = "nm_device_is_software")]
1179 fn is_software(&self) -> bool {
1180 unsafe {
1181 from_glib(ffi::nm_device_is_software(self.as_ref().to_glib_none().0))
1182 }
1183 }
1184
1185 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
1207 #[cfg(feature = "v1_2")]
1208 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1209 #[allow(deprecated)]
1210 #[doc(alias = "nm_device_reapply")]
1211 fn reapply(&self, connection: Option<&impl IsA<Connection>>, version_id: u64, flags: u32, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
1212 unsafe {
1213 let mut error = std::ptr::null_mut();
1214 let is_ok = ffi::nm_device_reapply(self.as_ref().to_glib_none().0, connection.map(|p| p.as_ref()).to_glib_none().0, version_id, flags, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
1215 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
1216 if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
1217 }
1218 }
1219
1220 #[cfg(feature = "v1_2")]
1237 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1238 #[doc(alias = "nm_device_reapply_async")]
1239 fn reapply_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, connection: Option<&impl IsA<Connection>>, version_id: u64, flags: u32, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
1240
1241 let main_context = glib::MainContext::ref_thread_default();
1242 let is_main_context_owner = main_context.is_owner();
1243 let has_acquired_main_context = (!is_main_context_owner)
1244 .then(|| main_context.acquire().ok())
1245 .flatten();
1246 assert!(
1247 is_main_context_owner || has_acquired_main_context.is_some(),
1248 "Async operations only allowed if the thread is owning the MainContext"
1249 );
1250
1251 let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
1252 unsafe extern "C" fn reapply_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
1253 let mut error = std::ptr::null_mut();
1254 ffi::nm_device_reapply_finish(_source_object as *mut _, res, &mut error);
1255 let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
1256 let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
1257 let callback: P = callback.into_inner();
1258 callback(result);
1259 }
1260 let callback = reapply_async_trampoline::<P>;
1261 unsafe {
1262 ffi::nm_device_reapply_async(self.as_ref().to_glib_none().0, connection.map(|p| p.as_ref()).to_glib_none().0, version_id, flags, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
1263 }
1264 }
1265
1266
1267 #[cfg(feature = "v1_2")]
1268 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1269 fn reapply_future(&self, connection: Option<&(impl IsA<Connection> + Clone + 'static)>, version_id: u64, flags: u32) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
1270
1271 let connection = connection.map(ToOwned::to_owned);
1272 Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
1273 obj.reapply_async(
1274 connection.as_ref().map(::std::borrow::Borrow::borrow),
1275 version_id,
1276 flags,
1277 Some(cancellable),
1278 move |res| {
1279 send.resolve(res);
1280 },
1281 );
1282 }))
1283 }
1284
1285 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
1296 #[allow(deprecated)]
1297 #[doc(alias = "nm_device_set_autoconnect")]
1298 #[doc(alias = "autoconnect")]
1299 fn set_autoconnect(&self, autoconnect: bool) {
1300 unsafe {
1301 ffi::nm_device_set_autoconnect(self.as_ref().to_glib_none().0, autoconnect.into_glib());
1302 }
1303 }
1304
1305 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
1318 #[cfg(feature = "v1_2")]
1319 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1320 #[allow(deprecated)]
1321 #[doc(alias = "nm_device_set_managed")]
1322 fn set_managed(&self, managed: bool) {
1323 unsafe {
1324 ffi::nm_device_set_managed(self.as_ref().to_glib_none().0, managed.into_glib());
1325 }
1326 }
1327
1328 fn interface(&self) -> Option<glib::GString> {
1330 ObjectExt::property(self.as_ref(), "interface")
1331 }
1332
1333 #[doc(alias = "ip-interface")]
1336 fn ip_interface(&self) -> Option<glib::GString> {
1337 ObjectExt::property(self.as_ref(), "ip-interface")
1338 }
1339
1340 #[cfg(feature = "v1_16")]
1342 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1343 #[doc(alias = "ip4-connectivity")]
1344 fn ip4_connectivity(&self) -> ConnectivityState {
1345 ObjectExt::property(self.as_ref(), "ip4-connectivity")
1346 }
1347
1348 #[cfg(feature = "v1_16")]
1350 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1351 #[doc(alias = "ip6-connectivity")]
1352 fn ip6_connectivity(&self) -> ConnectivityState {
1353 ObjectExt::property(self.as_ref(), "ip6-connectivity")
1354 }
1355
1356 #[doc(alias = "state-changed")]
1371 fn connect_state_changed<F: Fn(&Self, u32, u32, u32) + 'static>(&self, f: F) -> SignalHandlerId {
1372 unsafe extern "C" fn state_changed_trampoline<P: IsA<Device>, F: Fn(&P, u32, u32, u32) + 'static>(this: *mut ffi::NMDevice, new_state: std::ffi::c_uint, old_state: std::ffi::c_uint, reason: std::ffi::c_uint, f: glib::ffi::gpointer) {
1373 let f: &F = &*(f as *const F);
1374 f(Device::from_glib_borrow(this).unsafe_cast_ref(), new_state, old_state, reason)
1375 }
1376 unsafe {
1377 let f: Box_<F> = Box_::new(f);
1378 connect_raw(self.as_ptr() as *mut _, c"state-changed".as_ptr() as *const _,
1379 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(state_changed_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1380 }
1381 }
1382
1383 #[doc(alias = "active-connection")]
1384 fn connect_active_connection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1385 unsafe extern "C" fn notify_active_connection_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1386 let f: &F = &*(f as *const F);
1387 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1388 }
1389 unsafe {
1390 let f: Box_<F> = Box_::new(f);
1391 connect_raw(self.as_ptr() as *mut _, c"notify::active-connection".as_ptr() as *const _,
1392 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_active_connection_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1393 }
1394 }
1395
1396 #[doc(alias = "autoconnect")]
1397 fn connect_autoconnect_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1398 unsafe extern "C" fn notify_autoconnect_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1399 let f: &F = &*(f as *const F);
1400 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1401 }
1402 unsafe {
1403 let f: Box_<F> = Box_::new(f);
1404 connect_raw(self.as_ptr() as *mut _, c"notify::autoconnect".as_ptr() as *const _,
1405 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_autoconnect_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1406 }
1407 }
1408
1409 #[doc(alias = "available-connections")]
1410 fn connect_available_connections_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1411 unsafe extern "C" fn notify_available_connections_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1412 let f: &F = &*(f as *const F);
1413 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1414 }
1415 unsafe {
1416 let f: Box_<F> = Box_::new(f);
1417 connect_raw(self.as_ptr() as *mut _, c"notify::available-connections".as_ptr() as *const _,
1418 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_available_connections_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1419 }
1420 }
1421
1422 #[doc(alias = "capabilities")]
1423 fn connect_capabilities_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1424 unsafe extern "C" fn notify_capabilities_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1425 let f: &F = &*(f as *const F);
1426 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1427 }
1428 unsafe {
1429 let f: Box_<F> = Box_::new(f);
1430 connect_raw(self.as_ptr() as *mut _, c"notify::capabilities".as_ptr() as *const _,
1431 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_capabilities_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1432 }
1433 }
1434
1435 #[doc(alias = "device-type")]
1436 fn connect_device_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1437 unsafe extern "C" fn notify_device_type_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1438 let f: &F = &*(f as *const F);
1439 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1440 }
1441 unsafe {
1442 let f: Box_<F> = Box_::new(f);
1443 connect_raw(self.as_ptr() as *mut _, c"notify::device-type".as_ptr() as *const _,
1444 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_device_type_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1445 }
1446 }
1447
1448 #[doc(alias = "dhcp4-config")]
1449 fn connect_dhcp4_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1450 unsafe extern "C" fn notify_dhcp4_config_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1451 let f: &F = &*(f as *const F);
1452 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1453 }
1454 unsafe {
1455 let f: Box_<F> = Box_::new(f);
1456 connect_raw(self.as_ptr() as *mut _, c"notify::dhcp4-config".as_ptr() as *const _,
1457 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_dhcp4_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1458 }
1459 }
1460
1461 #[doc(alias = "dhcp6-config")]
1462 fn connect_dhcp6_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1463 unsafe extern "C" fn notify_dhcp6_config_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1464 let f: &F = &*(f as *const F);
1465 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1466 }
1467 unsafe {
1468 let f: Box_<F> = Box_::new(f);
1469 connect_raw(self.as_ptr() as *mut _, c"notify::dhcp6-config".as_ptr() as *const _,
1470 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_dhcp6_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1471 }
1472 }
1473
1474 #[doc(alias = "driver")]
1475 fn connect_driver_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1476 unsafe extern "C" fn notify_driver_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1477 let f: &F = &*(f as *const F);
1478 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1479 }
1480 unsafe {
1481 let f: Box_<F> = Box_::new(f);
1482 connect_raw(self.as_ptr() as *mut _, c"notify::driver".as_ptr() as *const _,
1483 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_driver_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1484 }
1485 }
1486
1487 #[doc(alias = "driver-version")]
1488 fn connect_driver_version_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1489 unsafe extern "C" fn notify_driver_version_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1490 let f: &F = &*(f as *const F);
1491 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1492 }
1493 unsafe {
1494 let f: Box_<F> = Box_::new(f);
1495 connect_raw(self.as_ptr() as *mut _, c"notify::driver-version".as_ptr() as *const _,
1496 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_driver_version_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1497 }
1498 }
1499
1500 #[doc(alias = "firmware-missing")]
1501 fn connect_firmware_missing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1502 unsafe extern "C" fn notify_firmware_missing_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1503 let f: &F = &*(f as *const F);
1504 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1505 }
1506 unsafe {
1507 let f: Box_<F> = Box_::new(f);
1508 connect_raw(self.as_ptr() as *mut _, c"notify::firmware-missing".as_ptr() as *const _,
1509 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_firmware_missing_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1510 }
1511 }
1512
1513 #[doc(alias = "firmware-version")]
1514 fn connect_firmware_version_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1515 unsafe extern "C" fn notify_firmware_version_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1516 let f: &F = &*(f as *const F);
1517 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1518 }
1519 unsafe {
1520 let f: Box_<F> = Box_::new(f);
1521 connect_raw(self.as_ptr() as *mut _, c"notify::firmware-version".as_ptr() as *const _,
1522 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_firmware_version_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1523 }
1524 }
1525
1526 #[cfg(feature = "v1_24")]
1527 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
1528 #[doc(alias = "hw-address")]
1529 fn connect_hw_address_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1530 unsafe extern "C" fn notify_hw_address_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1531 let f: &F = &*(f as *const F);
1532 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1533 }
1534 unsafe {
1535 let f: Box_<F> = Box_::new(f);
1536 connect_raw(self.as_ptr() as *mut _, c"notify::hw-address".as_ptr() as *const _,
1537 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_hw_address_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1538 }
1539 }
1540
1541 #[doc(alias = "interface")]
1542 fn connect_interface_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1543 unsafe extern "C" fn notify_interface_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1544 let f: &F = &*(f as *const F);
1545 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1546 }
1547 unsafe {
1548 let f: Box_<F> = Box_::new(f);
1549 connect_raw(self.as_ptr() as *mut _, c"notify::interface".as_ptr() as *const _,
1550 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_interface_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1551 }
1552 }
1553
1554 #[cfg(feature = "v1_22")]
1555 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
1556 #[doc(alias = "interface-flags")]
1557 fn connect_interface_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1558 unsafe extern "C" fn notify_interface_flags_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1559 let f: &F = &*(f as *const F);
1560 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1561 }
1562 unsafe {
1563 let f: Box_<F> = Box_::new(f);
1564 connect_raw(self.as_ptr() as *mut _, c"notify::interface-flags".as_ptr() as *const _,
1565 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_interface_flags_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1566 }
1567 }
1568
1569 #[doc(alias = "ip-interface")]
1570 fn connect_ip_interface_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1571 unsafe extern "C" fn notify_ip_interface_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1572 let f: &F = &*(f as *const F);
1573 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1574 }
1575 unsafe {
1576 let f: Box_<F> = Box_::new(f);
1577 connect_raw(self.as_ptr() as *mut _, c"notify::ip-interface".as_ptr() as *const _,
1578 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip_interface_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1579 }
1580 }
1581
1582 #[doc(alias = "ip4-config")]
1583 fn connect_ip4_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1584 unsafe extern "C" fn notify_ip4_config_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1585 let f: &F = &*(f as *const F);
1586 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1587 }
1588 unsafe {
1589 let f: Box_<F> = Box_::new(f);
1590 connect_raw(self.as_ptr() as *mut _, c"notify::ip4-config".as_ptr() as *const _,
1591 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip4_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1592 }
1593 }
1594
1595 #[cfg(feature = "v1_16")]
1596 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1597 #[doc(alias = "ip4-connectivity")]
1598 fn connect_ip4_connectivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1599 unsafe extern "C" fn notify_ip4_connectivity_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1600 let f: &F = &*(f as *const F);
1601 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1602 }
1603 unsafe {
1604 let f: Box_<F> = Box_::new(f);
1605 connect_raw(self.as_ptr() as *mut _, c"notify::ip4-connectivity".as_ptr() as *const _,
1606 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip4_connectivity_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1607 }
1608 }
1609
1610 #[doc(alias = "ip6-config")]
1611 fn connect_ip6_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1612 unsafe extern "C" fn notify_ip6_config_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1613 let f: &F = &*(f as *const F);
1614 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1615 }
1616 unsafe {
1617 let f: Box_<F> = Box_::new(f);
1618 connect_raw(self.as_ptr() as *mut _, c"notify::ip6-config".as_ptr() as *const _,
1619 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip6_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1620 }
1621 }
1622
1623 #[cfg(feature = "v1_16")]
1624 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1625 #[doc(alias = "ip6-connectivity")]
1626 fn connect_ip6_connectivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1627 unsafe extern "C" fn notify_ip6_connectivity_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1628 let f: &F = &*(f as *const F);
1629 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1630 }
1631 unsafe {
1632 let f: Box_<F> = Box_::new(f);
1633 connect_raw(self.as_ptr() as *mut _, c"notify::ip6-connectivity".as_ptr() as *const _,
1634 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip6_connectivity_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1635 }
1636 }
1637
1638 #[doc(alias = "lldp-neighbors")]
1639 fn connect_lldp_neighbors_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1640 unsafe extern "C" fn notify_lldp_neighbors_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1641 let f: &F = &*(f as *const F);
1642 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1643 }
1644 unsafe {
1645 let f: Box_<F> = Box_::new(f);
1646 connect_raw(self.as_ptr() as *mut _, c"notify::lldp-neighbors".as_ptr() as *const _,
1647 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_lldp_neighbors_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1648 }
1649 }
1650
1651 #[doc(alias = "managed")]
1652 fn connect_managed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1653 unsafe extern "C" fn notify_managed_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1654 let f: &F = &*(f as *const F);
1655 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1656 }
1657 unsafe {
1658 let f: Box_<F> = Box_::new(f);
1659 connect_raw(self.as_ptr() as *mut _, c"notify::managed".as_ptr() as *const _,
1660 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_managed_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1661 }
1662 }
1663
1664 #[cfg(feature = "v1_2")]
1665 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1666 #[doc(alias = "metered")]
1667 fn connect_metered_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1668 unsafe extern "C" fn notify_metered_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1669 let f: &F = &*(f as *const F);
1670 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1671 }
1672 unsafe {
1673 let f: Box_<F> = Box_::new(f);
1674 connect_raw(self.as_ptr() as *mut _, c"notify::metered".as_ptr() as *const _,
1675 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_metered_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1676 }
1677 }
1678
1679 #[doc(alias = "mtu")]
1680 fn connect_mtu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1681 unsafe extern "C" fn notify_mtu_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1682 let f: &F = &*(f as *const F);
1683 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1684 }
1685 unsafe {
1686 let f: Box_<F> = Box_::new(f);
1687 connect_raw(self.as_ptr() as *mut _, c"notify::mtu".as_ptr() as *const _,
1688 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mtu_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1689 }
1690 }
1691
1692 #[cfg(feature = "v1_2")]
1693 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1694 #[doc(alias = "nm-plugin-missing")]
1695 fn connect_nm_plugin_missing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1696 unsafe extern "C" fn notify_nm_plugin_missing_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1697 let f: &F = &*(f as *const F);
1698 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1699 }
1700 unsafe {
1701 let f: Box_<F> = Box_::new(f);
1702 connect_raw(self.as_ptr() as *mut _, c"notify::nm-plugin-missing".as_ptr() as *const _,
1703 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_nm_plugin_missing_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1704 }
1705 }
1706
1707 #[doc(alias = "physical-port-id")]
1708 fn connect_physical_port_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1709 unsafe extern "C" fn notify_physical_port_id_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1710 let f: &F = &*(f as *const F);
1711 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1712 }
1713 unsafe {
1714 let f: Box_<F> = Box_::new(f);
1715 connect_raw(self.as_ptr() as *mut _, c"notify::physical-port-id".as_ptr() as *const _,
1716 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_physical_port_id_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1717 }
1718 }
1719
1720 #[cfg(feature = "v1_34")]
1721 #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
1722 #[doc(alias = "ports")]
1723 fn connect_ports_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1724 unsafe extern "C" fn notify_ports_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1725 let f: &F = &*(f as *const F);
1726 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1727 }
1728 unsafe {
1729 let f: Box_<F> = Box_::new(f);
1730 connect_raw(self.as_ptr() as *mut _, c"notify::ports".as_ptr() as *const _,
1731 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ports_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1732 }
1733 }
1734
1735 #[doc(alias = "product")]
1736 fn connect_product_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1737 unsafe extern "C" fn notify_product_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1738 let f: &F = &*(f as *const F);
1739 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1740 }
1741 unsafe {
1742 let f: Box_<F> = Box_::new(f);
1743 connect_raw(self.as_ptr() as *mut _, c"notify::product".as_ptr() as *const _,
1744 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_product_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1745 }
1746 }
1747
1748 #[cfg(feature = "v1_2")]
1749 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1750 #[doc(alias = "real")]
1751 fn connect_real_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1752 unsafe extern "C" fn notify_real_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1753 let f: &F = &*(f as *const F);
1754 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1755 }
1756 unsafe {
1757 let f: Box_<F> = Box_::new(f);
1758 connect_raw(self.as_ptr() as *mut _, c"notify::real".as_ptr() as *const _,
1759 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_real_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1760 }
1761 }
1762
1763 #[doc(alias = "state")]
1764 fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1765 unsafe extern "C" fn notify_state_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1766 let f: &F = &*(f as *const F);
1767 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1768 }
1769 unsafe {
1770 let f: Box_<F> = Box_::new(f);
1771 connect_raw(self.as_ptr() as *mut _, c"notify::state".as_ptr() as *const _,
1772 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_state_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1773 }
1774 }
1775
1776 #[doc(alias = "state-reason")]
1777 fn connect_state_reason_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1778 unsafe extern "C" fn notify_state_reason_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1779 let f: &F = &*(f as *const F);
1780 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1781 }
1782 unsafe {
1783 let f: Box_<F> = Box_::new(f);
1784 connect_raw(self.as_ptr() as *mut _, c"notify::state-reason".as_ptr() as *const _,
1785 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_state_reason_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1786 }
1787 }
1788
1789 #[doc(alias = "udi")]
1790 fn connect_udi_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1791 unsafe extern "C" fn notify_udi_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1792 let f: &F = &*(f as *const F);
1793 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1794 }
1795 unsafe {
1796 let f: Box_<F> = Box_::new(f);
1797 connect_raw(self.as_ptr() as *mut _, c"notify::udi".as_ptr() as *const _,
1798 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_udi_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1799 }
1800 }
1801
1802 #[doc(alias = "vendor")]
1803 fn connect_vendor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1804 unsafe extern "C" fn notify_vendor_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1805 let f: &F = &*(f as *const F);
1806 f(Device::from_glib_borrow(this).unsafe_cast_ref())
1807 }
1808 unsafe {
1809 let f: Box_<F> = Box_::new(f);
1810 connect_raw(self.as_ptr() as *mut _, c"notify::vendor".as_ptr() as *const _,
1811 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vendor_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1812 }
1813 }
1814}
1815
1816impl<O: IsA<Device>> DeviceExt for O {}