nm_rs/auto/
wimax_nsp.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5#![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    /// WiMAX is no longer supported by NetworkManager since 1.2.0.
13    ///
14    ///
15    /// ## Properties
16    ///
17    ///
18    /// #### `name`
19    ///  The name of the WiMAX NSP.
20    ///
21    /// Readable
22    ///
23    ///
24    /// #### `network-type`
25    ///  The network type of the WiMAX NSP.
26    ///
27    /// Readable
28    ///
29    ///
30    /// #### `signal-quality`
31    ///  The signal quality of the WiMAX NSP.
32    ///
33    /// Readable
34    /// <details><summary><h4>Object</h4></summary>
35    ///
36    ///
37    /// #### `client`
38    ///  The NMClient instance as returned by nm_object_get_client().
39    ///
40    /// When an NMObject gets removed from the NMClient cache,
41    /// the NMObject:path property stays unchanged, but this client
42    /// instance gets reset to [`None`]. You can use this property to
43    /// track removal of the object from the cache.
44    ///
45    /// Readable
46    ///
47    ///
48    /// #### `path`
49    ///  The D-Bus object path.
50    ///
51    /// The D-Bus path of an object instance never changes, even if the object
52    /// gets removed from the cache. To see whether the object is still in the
53    /// cache, check NMObject:client.
54    ///
55    /// Readable
56    /// </details>
57    ///
58    /// # Implements
59    ///
60    /// [`ObjectExt`][trait@crate::prelude::ObjectExt]
61    #[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    /// Validates a given connection against a given WiMAX NSP to ensure that the
71    /// connection may be activated with that NSP.  The connection must match the
72    /// @self's network name and other attributes.
73    ///
74    /// # Deprecated since 1.22
75    ///
76    /// WiMAX is no longer supported by NetworkManager since 1.2.0.
77    /// ## `connection`
78    /// an #NMConnection to validate against @self
79    ///
80    /// # Returns
81    ///
82    /// [`true`] if the connection may be activated with this WiMAX NSP,
83    /// [`false`] if it cannot be.
84    #[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    /// Filters a given array of connections for a given #NMWimaxNsp object and
94    /// return connections which may be activated with the NSP.  Any returned
95    /// connections will match the @self's network name and other attributes.
96    ///
97    /// # Deprecated since 1.22
98    ///
99    /// WiMAX is no longer supported by NetworkManager since 1.2.0.
100    /// ## `connections`
101    /// an array of #NMConnections to
102    /// filter
103    ///
104    /// # Returns
105    ///
106    /// an array of
107    /// #NMConnections that could be activated with the given @self.  The array should
108    /// be freed with g_ptr_array_unref() when it is no longer required.
109    #[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    /// Gets the name of the wimax NSP
119    ///
120    /// # Deprecated since 1.22
121    ///
122    /// WiMAX is no longer supported by NetworkManager since 1.2.0.
123    ///
124    /// # Returns
125    ///
126    /// the name
127    #[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    /// Gets the network type of the wimax NSP.
138    ///
139    /// # Deprecated since 1.22
140    ///
141    /// WiMAX is no longer supported by NetworkManager since 1.2.0.
142    ///
143    /// # Returns
144    ///
145    /// the network type
146    #[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    /// Gets the WPA signal quality of the wimax NSP.
158    ///
159    /// # Deprecated since 1.22
160    ///
161    /// WiMAX is no longer supported by NetworkManager since 1.2.0.
162    ///
163    /// # Returns
164    ///
165    /// the signal quality
166    #[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}