1#![allow(deprecated)]
6
7use crate::{ffi,Connection,Object,WimaxNspNetworkType};
8use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
9use std::{boxed::Box as Box_};
10
11glib::wrapper! {
12 #[doc(alias = "NMWimaxNsp")]
62 pub struct WimaxNsp(Object<ffi::NMWimaxNsp, ffi::NMWimaxNspClass>) @extends Object;
63
64 match fn {
65 type_ => || ffi::nm_wimax_nsp_get_type(),
66 }
67}
68
69impl WimaxNsp {
70 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
85 #[allow(deprecated)]
86 #[doc(alias = "nm_wimax_nsp_connection_valid")]
87 pub fn connection_valid(&self, connection: &impl IsA<Connection>) -> bool {
88 unsafe {
89 from_glib(ffi::nm_wimax_nsp_connection_valid(self.to_glib_none().0, connection.as_ref().to_glib_none().0))
90 }
91 }
92
93 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
110 #[allow(deprecated)]
111 #[doc(alias = "nm_wimax_nsp_filter_connections")]
112 pub fn filter_connections(&self, connections: &[Connection]) -> Vec<Connection> {
113 unsafe {
114 FromGlibPtrContainer::from_glib_full(ffi::nm_wimax_nsp_filter_connections(self.to_glib_none().0, connections.to_glib_none().0))
115 }
116 }
117
118 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
128 #[allow(deprecated)]
129 #[doc(alias = "nm_wimax_nsp_get_name")]
130 #[doc(alias = "get_name")]
131 pub fn name(&self) -> glib::GString {
132 unsafe {
133 from_glib_none(ffi::nm_wimax_nsp_get_name(self.to_glib_none().0))
134 }
135 }
136
137 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
147 #[allow(deprecated)]
148 #[doc(alias = "nm_wimax_nsp_get_network_type")]
149 #[doc(alias = "get_network_type")]
150 #[doc(alias = "network-type")]
151 pub fn network_type(&self) -> WimaxNspNetworkType {
152 unsafe {
153 from_glib(ffi::nm_wimax_nsp_get_network_type(self.to_glib_none().0))
154 }
155 }
156
157 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
167 #[allow(deprecated)]
168 #[doc(alias = "nm_wimax_nsp_get_signal_quality")]
169 #[doc(alias = "get_signal_quality")]
170 #[doc(alias = "signal-quality")]
171 pub fn signal_quality(&self) -> u32 {
172 unsafe {
173 ffi::nm_wimax_nsp_get_signal_quality(self.to_glib_none().0)
174 }
175 }
176
177 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
178 #[doc(alias = "name")]
179 pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
180 unsafe extern "C" fn notify_name_trampoline<F: Fn(&WimaxNsp) + 'static>(this: *mut ffi::NMWimaxNsp, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
181 let f: &F = &*(f as *const F);
182 f(&from_glib_borrow(this))
183 }
184 unsafe {
185 let f: Box_<F> = Box_::new(f);
186 connect_raw(self.as_ptr() as *mut _, c"notify::name".as_ptr() as *const _,
187 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_name_trampoline::<F> as *const ())), Box_::into_raw(f))
188 }
189 }
190
191 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
192 #[doc(alias = "network-type")]
193 pub fn connect_network_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
194 unsafe extern "C" fn notify_network_type_trampoline<F: Fn(&WimaxNsp) + 'static>(this: *mut ffi::NMWimaxNsp, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
195 let f: &F = &*(f as *const F);
196 f(&from_glib_borrow(this))
197 }
198 unsafe {
199 let f: Box_<F> = Box_::new(f);
200 connect_raw(self.as_ptr() as *mut _, c"notify::network-type".as_ptr() as *const _,
201 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_network_type_trampoline::<F> as *const ())), Box_::into_raw(f))
202 }
203 }
204
205 #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
206 #[doc(alias = "signal-quality")]
207 pub fn connect_signal_quality_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
208 unsafe extern "C" fn notify_signal_quality_trampoline<F: Fn(&WimaxNsp) + 'static>(this: *mut ffi::NMWimaxNsp, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
209 let f: &F = &*(f as *const F);
210 f(&from_glib_borrow(this))
211 }
212 unsafe {
213 let f: Box_<F> = Box_::new(f);
214 connect_raw(self.as_ptr() as *mut _, c"notify::signal-quality".as_ptr() as *const _,
215 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_signal_quality_trampoline::<F> as *const ())), Box_::into_raw(f))
216 }
217 }
218}
219
220impl std::fmt::Display for WimaxNsp {
221 #[inline]
222 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
223 f.write_str(&self.name())
224 }
225}