1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir
// from gtk-girs (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use crate::{ffi,ActiveConnection,Object,VpnConnectionState};
use glib::{object::ObjectType as _,prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
use std::{boxed::Box as Box_};
glib::wrapper! {
///
///
/// ## Properties
///
///
/// #### `banner`
/// The VPN login banner of the active VPN connection.
///
/// Readable
///
///
/// #### `vpn-state`
/// The VPN state of the active VPN connection.
///
/// Readable
/// <details><summary><h4>ActiveConnection</h4></summary>
///
///
/// #### `connection`
/// The connection that this is an active instance of.
///
/// Readable
///
///
/// #### `controller`
/// The controller device if one exists. This replaces the deprecated
/// "master" property.
///
/// Readable
///
///
/// #### `default`
/// Whether the active connection is the default IPv4 one.
///
/// Readable
///
///
/// #### `default6`
/// Whether the active connection is the default IPv6 one.
///
/// Readable
///
///
/// #### `devices`
/// The devices of the active connection.
///
/// Readable
///
///
/// #### `dhcp4-config`
/// The IPv4 #NMDhcpConfig of the connection.
///
/// Readable
///
///
/// #### `dhcp6-config`
/// The IPv6 #NMDhcpConfig of the connection.
///
/// Readable
///
///
/// #### `id`
/// The active connection's ID
///
/// Readable
///
///
/// #### `ip4-config`
/// The IPv4 #NMIPConfig of the connection.
///
/// Readable
///
///
/// #### `ip6-config`
/// The IPv6 #NMIPConfig of the connection.
///
/// Readable
///
///
/// #### `master`
/// The controller device if one exists. Replaced by the "controller" property.
///
/// Readable
///
///
/// #### `specific-object-path`
/// The path to the "specific object" of the active connection; see
/// nm_active_connection_get_specific_object_path() for more details.
///
/// Readable
///
///
/// #### `state`
/// The state of the active connection.
///
/// Readable
///
///
/// #### `state-flags`
/// The state flags of the active connection.
///
/// Readable
///
///
/// #### `type`
/// The active connection's type
///
/// Readable
///
///
/// #### `uuid`
/// The active connection's UUID
///
/// Readable
///
///
/// #### `vpn`
/// Whether the active connection is a VPN connection.
///
/// Readable
/// </details>
/// <details><summary><h4>Object</h4></summary>
///
///
/// #### `client`
/// The NMClient instance as returned by nm_object_get_client().
///
/// When an NMObject gets removed from the NMClient cache,
/// the NMObject:path property stays unchanged, but this client
/// instance gets reset to [`None`]. You can use this property to
/// track removal of the object from the cache.
///
/// Readable
///
///
/// #### `path`
/// The D-Bus object path.
///
/// The D-Bus path of an object instance never changes, even if the object
/// gets removed from the cache. To see whether the object is still in the
/// cache, check NMObject:client.
///
/// Readable
/// </details>
///
/// ## Signals
///
///
/// #### `vpn-state-changed`
///
/// <details><summary><h4>ActiveConnection</h4></summary>
///
///
/// #### `state-changed`
///
/// </details>
///
/// # Implements
///
/// [`ActiveConnectionExt`][trait@crate::prelude::ActiveConnectionExt], [`ObjectExt`][trait@crate::prelude::ObjectExt]
#[doc(alias = "NMVpnConnection")]
pub struct VpnConnection(Object<ffi::NMVpnConnection, ffi::NMVpnConnectionClass>) @extends ActiveConnection, Object;
match fn {
type_ => || ffi::nm_vpn_connection_get_type(),
}
}
impl VpnConnection {
/// Gets the VPN login banner of the active #NMVpnConnection.
///
/// # Returns
///
/// the VPN login banner of the VPN connection. This is the internal
/// string used by the connection, and must not be modified.
#[doc(alias = "nm_vpn_connection_get_banner")]
#[doc(alias = "get_banner")]
pub fn banner(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_vpn_connection_get_banner(self.to_glib_none().0))
}
}
/// Gets the current #NMVpnConnection state.
///
/// # Returns
///
/// the VPN state of the active VPN connection.
#[doc(alias = "nm_vpn_connection_get_vpn_state")]
#[doc(alias = "get_vpn_state")]
#[doc(alias = "vpn-state")]
pub fn vpn_state(&self) -> VpnConnectionState {
unsafe {
from_glib(ffi::nm_vpn_connection_get_vpn_state(self.to_glib_none().0))
}
}
#[doc(alias = "vpn-state-changed")]
pub fn connect_vpn_state_changed<F: Fn(&Self, u32, u32) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn vpn_state_changed_trampoline<F: Fn(&VpnConnection, u32, u32) + 'static>(this: *mut ffi::NMVpnConnection, object: std::ffi::c_uint, p0: std::ffi::c_uint, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this), object, p0)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"vpn-state-changed".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(vpn_state_changed_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "banner")]
pub fn connect_banner_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_banner_trampoline<F: Fn(&VpnConnection) + 'static>(this: *mut ffi::NMVpnConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::banner".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_banner_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "vpn-state")]
pub fn connect_vpn_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_vpn_state_trampoline<F: Fn(&VpnConnection) + 'static>(this: *mut ffi::NMVpnConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::vpn-state".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vpn_state_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
}