nm_rs/auto/setting_vpn.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
6use crate::{ffi,Setting};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11 /// VPN Settings
12 ///
13 /// ## Properties
14 ///
15 ///
16 /// #### `data`
17 /// Dictionary of key/value pairs of VPN plugin specific data. Both keys and
18 /// values must be strings.
19 ///
20 /// Readable | Writeable
21 ///
22 ///
23 /// #### `persistent`
24 /// If the VPN service supports persistence, and this property is [`true`],
25 /// the VPN will attempt to stay connected across link changes and outages,
26 /// until explicitly disconnected.
27 ///
28 /// Readable | Writeable
29 ///
30 ///
31 /// #### `secrets`
32 /// Dictionary of key/value pairs of VPN plugin specific secrets like
33 /// passwords or private keys. Both keys and values must be strings.
34 ///
35 /// Readable | Writeable
36 ///
37 ///
38 /// #### `service-type`
39 /// D-Bus service name of the VPN plugin that this setting uses to connect to
40 /// its network. i.e. org.freedesktop.NetworkManager.vpnc for the vpnc
41 /// plugin.
42 ///
43 /// Readable | Writeable
44 ///
45 ///
46 /// #### `timeout`
47 /// Timeout for the VPN service to establish the connection. Some services
48 /// may take quite a long time to connect.
49 /// Value of 0 means a default timeout, which is 60 seconds (unless overridden
50 /// by vpn.timeout in configuration file). Values greater than zero mean
51 /// timeout in seconds.
52 ///
53 /// Readable | Writeable
54 ///
55 ///
56 /// #### `user-name`
57 /// If the VPN connection requires a user name for authentication, that name
58 /// should be provided here. If the connection is available to more than one
59 /// user, and the VPN requires each user to supply a different name, then
60 /// leave this property empty. If this property is empty, NetworkManager
61 /// will automatically supply the username of the user which requested the
62 /// VPN connection.
63 ///
64 /// Readable | Writeable
65 /// <details><summary><h4>Setting</h4></summary>
66 ///
67 ///
68 /// #### `name`
69 /// The setting's name, which uniquely identifies the setting within the
70 /// connection. Each setting type has a name unique to that type, for
71 /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
72 ///
73 /// Readable
74 /// </details>
75 ///
76 /// # Implements
77 ///
78 /// [`SettingExt`][trait@crate::prelude::SettingExt]
79 #[doc(alias = "NMSettingVpn")]
80 pub struct SettingVpn(Object<ffi::NMSettingVpn, ffi::NMSettingVpnClass>) @extends Setting;
81
82 match fn {
83 type_ => || ffi::nm_setting_vpn_get_type(),
84 }
85}
86
87impl SettingVpn {
88 /// Creates a new #NMSettingVpn object with default values.
89 ///
90 /// # Returns
91 ///
92 /// the new empty #NMSettingVpn object
93 #[doc(alias = "nm_setting_vpn_new")]
94 pub fn new() -> SettingVpn {
95 assert_initialized_main_thread!();
96 unsafe {
97 Setting::from_glib_full(ffi::nm_setting_vpn_new()).unsafe_cast()
98 }
99 }
100
101 // rustdoc-stripper-ignore-next
102 /// Creates a new builder-pattern struct instance to construct [`SettingVpn`] objects.
103 ///
104 /// This method returns an instance of [`SettingVpnBuilder`](crate::builders::SettingVpnBuilder) which can be used to create [`SettingVpn`] objects.
105 pub fn builder() -> SettingVpnBuilder {
106 SettingVpnBuilder::new()
107 }
108
109
110 /// Establishes a relationship between @key and @item internally in the
111 /// setting which may be retrieved later. Should not be used to store passwords
112 /// or other secrets, which is what nm_setting_vpn_add_secret() is for.
113 ///
114 /// Before 1.24, @item must not be [`None`] and not an empty string. Since 1.24,
115 /// @item can be set to an empty string. It can also be set to [`None`] to unset
116 /// the key. In that case, the behavior is as if calling nm_setting_vpn_remove_data_item().
117 /// ## `key`
118 /// a name that uniquely identifies the given value @item
119 /// ## `item`
120 /// the value to be referenced by @key
121 #[doc(alias = "nm_setting_vpn_add_data_item")]
122 pub fn add_data_item(&self, key: &str, item: Option<&str>) {
123 unsafe {
124 ffi::nm_setting_vpn_add_data_item(self.to_glib_none().0, key.to_glib_none().0, item.to_glib_none().0);
125 }
126 }
127
128 /// Establishes a relationship between @key and @secret internally in the
129 /// setting which may be retrieved later.
130 ///
131 /// Before 1.24, @secret must not be [`None`] and not an empty string. Since 1.24,
132 /// @secret can be set to an empty string. It can also be set to [`None`] to unset
133 /// the key. In that case, the behavior is as if calling nm_setting_vpn_remove_secret().
134 /// ## `key`
135 /// a name that uniquely identifies the given secret @secret
136 /// ## `secret`
137 /// the secret to be referenced by @key
138 #[doc(alias = "nm_setting_vpn_add_secret")]
139 pub fn add_secret(&self, key: &str, secret: Option<&str>) {
140 unsafe {
141 ffi::nm_setting_vpn_add_secret(self.to_glib_none().0, key.to_glib_none().0, secret.to_glib_none().0);
142 }
143 }
144
145 /// Iterates all data items stored in this setting. It is safe to add, remove,
146 /// and modify data items inside @func, though any additions or removals made
147 /// during iteration will not be part of the iteration.
148 /// ## `func`
149 /// an user provided function
150 #[doc(alias = "nm_setting_vpn_foreach_data_item")]
151 pub fn foreach_data_item<P: FnMut(&str, &str)>(&self, func: P) {
152 let mut func_data: P = func;
153 unsafe extern "C" fn func_func<P: FnMut(&str, &str)>(key: *const std::ffi::c_char, value: *const std::ffi::c_char, user_data: glib::ffi::gpointer) {
154 let key: Borrowed<glib::GString> = from_glib_borrow(key);
155 let value: Borrowed<glib::GString> = from_glib_borrow(value);
156 let callback = user_data as *mut P;
157 (*callback)(key.as_str(), value.as_str())
158 }
159 let func = Some(func_func::<P> as _);
160 let super_callback0: &mut P = &mut func_data;
161 unsafe {
162 ffi::nm_setting_vpn_foreach_data_item(self.to_glib_none().0, func, super_callback0 as *mut _ as *mut _);
163 }
164 }
165
166 /// Iterates all secrets stored in this setting. It is safe to add, remove,
167 /// and modify secrets inside @func, though any additions or removals made during
168 /// iteration will not be part of the iteration.
169 /// ## `func`
170 /// an user provided function
171 #[doc(alias = "nm_setting_vpn_foreach_secret")]
172 pub fn foreach_secret<P: FnMut(&str, &str)>(&self, func: P) {
173 let mut func_data: P = func;
174 unsafe extern "C" fn func_func<P: FnMut(&str, &str)>(key: *const std::ffi::c_char, value: *const std::ffi::c_char, user_data: glib::ffi::gpointer) {
175 let key: Borrowed<glib::GString> = from_glib_borrow(key);
176 let value: Borrowed<glib::GString> = from_glib_borrow(value);
177 let callback = user_data as *mut P;
178 (*callback)(key.as_str(), value.as_str())
179 }
180 let func = Some(func_func::<P> as _);
181 let super_callback0: &mut P = &mut func_data;
182 unsafe {
183 ffi::nm_setting_vpn_foreach_secret(self.to_glib_none().0, func, super_callback0 as *mut _ as *mut _);
184 }
185 }
186
187 /// Retrieves the data item of a key/value relationship previously established
188 /// by nm_setting_vpn_add_data_item().
189 /// ## `key`
190 /// the name of the data item to retrieve
191 ///
192 /// # Returns
193 ///
194 /// the data item, if any
195 #[doc(alias = "nm_setting_vpn_get_data_item")]
196 #[doc(alias = "get_data_item")]
197 pub fn data_item(&self, key: &str) -> glib::GString {
198 unsafe {
199 from_glib_none(ffi::nm_setting_vpn_get_data_item(self.to_glib_none().0, key.to_glib_none().0))
200 }
201 }
202
203 /// Retrieves every data key inside @self, as an array.
204 ///
205 /// # Returns
206 ///
207 /// a
208 /// [`None`]-terminated array containing each data key or [`None`] if
209 /// there are no data items.
210 #[cfg(feature = "v1_12")]
211 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
212 #[doc(alias = "nm_setting_vpn_get_data_keys")]
213 #[doc(alias = "get_data_keys")]
214 pub fn data_keys(&self) -> Vec<glib::GString> {
215 unsafe {
216 let mut out_length = std::mem::MaybeUninit::uninit();
217 let ret = FromGlibContainer::from_glib_container_num(ffi::nm_setting_vpn_get_data_keys(self.to_glib_none().0, out_length.as_mut_ptr()), out_length.assume_init() as _);
218 ret
219 }
220 }
221
222 /// Gets number of key/value pairs of VPN configuration data.
223 ///
224 /// # Returns
225 ///
226 /// the number of VPN plugin specific configuration data items
227 #[doc(alias = "nm_setting_vpn_get_num_data_items")]
228 #[doc(alias = "get_num_data_items")]
229 pub fn num_data_items(&self) -> u32 {
230 unsafe {
231 ffi::nm_setting_vpn_get_num_data_items(self.to_glib_none().0)
232 }
233 }
234
235 /// Gets number of VPN plugin specific secrets in the setting.
236 ///
237 /// # Returns
238 ///
239 /// the number of VPN plugin specific secrets
240 #[doc(alias = "nm_setting_vpn_get_num_secrets")]
241 #[doc(alias = "get_num_secrets")]
242 pub fn num_secrets(&self) -> u32 {
243 unsafe {
244 ffi::nm_setting_vpn_get_num_secrets(self.to_glib_none().0)
245 }
246 }
247
248 ///
249 /// # Returns
250 ///
251 /// the #NMSettingVpn:persistent property of the setting
252 #[cfg(feature = "v1_42")]
253 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
254 #[doc(alias = "nm_setting_vpn_get_persistent")]
255 #[doc(alias = "get_persistent")]
256 #[doc(alias = "persistent")]
257 pub fn is_persistent(&self) -> bool {
258 unsafe {
259 from_glib(ffi::nm_setting_vpn_get_persistent(self.to_glib_none().0))
260 }
261 }
262
263 /// Retrieves the secret of a key/value relationship previously established
264 /// by nm_setting_vpn_add_secret().
265 /// ## `key`
266 /// the name of the secret to retrieve
267 ///
268 /// # Returns
269 ///
270 /// the secret, if any
271 #[doc(alias = "nm_setting_vpn_get_secret")]
272 #[doc(alias = "get_secret")]
273 pub fn secret(&self, key: &str) -> glib::GString {
274 unsafe {
275 from_glib_none(ffi::nm_setting_vpn_get_secret(self.to_glib_none().0, key.to_glib_none().0))
276 }
277 }
278
279 /// Retrieves every secret key inside @self, as an array.
280 ///
281 /// # Returns
282 ///
283 /// a
284 /// [`None`]-terminated array containing each secret key or [`None`] if
285 /// there are no secrets.
286 #[cfg(feature = "v1_12")]
287 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
288 #[doc(alias = "nm_setting_vpn_get_secret_keys")]
289 #[doc(alias = "get_secret_keys")]
290 pub fn secret_keys(&self) -> Vec<glib::GString> {
291 unsafe {
292 let mut out_length = std::mem::MaybeUninit::uninit();
293 let ret = FromGlibContainer::from_glib_container_num(ffi::nm_setting_vpn_get_secret_keys(self.to_glib_none().0, out_length.as_mut_ptr()), out_length.assume_init() as _);
294 ret
295 }
296 }
297
298 /// Returns the service name of the VPN, which identifies the specific VPN
299 /// plugin that should be used to connect to this VPN.
300 ///
301 /// # Returns
302 ///
303 /// the VPN plugin's service name
304 #[doc(alias = "nm_setting_vpn_get_service_type")]
305 #[doc(alias = "get_service_type")]
306 #[doc(alias = "service-type")]
307 pub fn service_type(&self) -> glib::GString {
308 unsafe {
309 from_glib_none(ffi::nm_setting_vpn_get_service_type(self.to_glib_none().0))
310 }
311 }
312
313 ///
314 /// # Returns
315 ///
316 /// the #NMSettingVpn:timeout property of the setting
317 #[cfg(feature = "v1_2")]
318 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
319 #[doc(alias = "nm_setting_vpn_get_timeout")]
320 #[doc(alias = "get_timeout")]
321 pub fn timeout(&self) -> u32 {
322 unsafe {
323 ffi::nm_setting_vpn_get_timeout(self.to_glib_none().0)
324 }
325 }
326
327 ///
328 /// # Returns
329 ///
330 /// the #NMSettingVpn:user-name property of the setting
331 #[doc(alias = "nm_setting_vpn_get_user_name")]
332 #[doc(alias = "get_user_name")]
333 #[doc(alias = "user-name")]
334 pub fn user_name(&self) -> glib::GString {
335 unsafe {
336 from_glib_none(ffi::nm_setting_vpn_get_user_name(self.to_glib_none().0))
337 }
338 }
339
340 /// Deletes a key/value relationship previously established by
341 /// nm_setting_vpn_add_data_item().
342 /// ## `key`
343 /// the name of the data item to remove
344 ///
345 /// # Returns
346 ///
347 /// [`true`] if the data item was found and removed from the internal list,
348 /// [`false`] if it was not.
349 #[doc(alias = "nm_setting_vpn_remove_data_item")]
350 pub fn remove_data_item(&self, key: &str) -> bool {
351 unsafe {
352 from_glib(ffi::nm_setting_vpn_remove_data_item(self.to_glib_none().0, key.to_glib_none().0))
353 }
354 }
355
356 /// Deletes a key/value relationship previously established by
357 /// nm_setting_vpn_add_secret().
358 /// ## `key`
359 /// the name of the secret to remove
360 ///
361 /// # Returns
362 ///
363 /// [`true`] if the secret was found and removed from the internal list,
364 /// [`false`] if it was not.
365 #[doc(alias = "nm_setting_vpn_remove_secret")]
366 pub fn remove_secret(&self, key: &str) -> bool {
367 unsafe {
368 from_glib(ffi::nm_setting_vpn_remove_secret(self.to_glib_none().0, key.to_glib_none().0))
369 }
370 }
371
372 //pub fn data(&self) -> /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } {
373 // ObjectExt::property(self, "data")
374 //}
375
376 //pub fn set_data(&self, data: /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) {
377 // ObjectExt::set_property(self,"data", data)
378 //}
379
380 #[cfg(not(feature = "v1_42"))]
381 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_42"))))]
382 pub fn is_persistent(&self) -> bool {
383 ObjectExt::property(self, "persistent")
384 }
385
386 /// If the VPN service supports persistence, and this property is [`true`],
387 /// the VPN will attempt to stay connected across link changes and outages,
388 /// until explicitly disconnected.
389 pub fn set_persistent(&self, persistent: bool) {
390 ObjectExt::set_property(self,"persistent", persistent)
391 }
392
393 //pub fn secrets(&self) -> /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } {
394 // ObjectExt::property(self, "secrets")
395 //}
396
397 //pub fn set_secrets(&self, secrets: /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) {
398 // ObjectExt::set_property(self,"secrets", secrets)
399 //}
400
401 /// D-Bus service name of the VPN plugin that this setting uses to connect to
402 /// its network. i.e. org.freedesktop.NetworkManager.vpnc for the vpnc
403 /// plugin.
404 #[doc(alias = "service-type")]
405 pub fn set_service_type(&self, service_type: Option<&str>) {
406 ObjectExt::set_property(self,"service-type", service_type)
407 }
408
409 /// Timeout for the VPN service to establish the connection. Some services
410 /// may take quite a long time to connect.
411 /// Value of 0 means a default timeout, which is 60 seconds (unless overridden
412 /// by vpn.timeout in configuration file). Values greater than zero mean
413 /// timeout in seconds.
414 #[cfg(feature = "v1_2")]
415 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
416 pub fn set_timeout(&self, timeout: u32) {
417 ObjectExt::set_property(self,"timeout", timeout)
418 }
419
420 /// If the VPN connection requires a user name for authentication, that name
421 /// should be provided here. If the connection is available to more than one
422 /// user, and the VPN requires each user to supply a different name, then
423 /// leave this property empty. If this property is empty, NetworkManager
424 /// will automatically supply the username of the user which requested the
425 /// VPN connection.
426 #[doc(alias = "user-name")]
427 pub fn set_user_name(&self, user_name: Option<&str>) {
428 ObjectExt::set_property(self,"user-name", user_name)
429 }
430
431 #[doc(alias = "data")]
432 pub fn connect_data_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
433 unsafe extern "C" fn notify_data_trampoline<F: Fn(&SettingVpn) + 'static>(this: *mut ffi::NMSettingVpn, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
434 let f: &F = &*(f as *const F);
435 f(&from_glib_borrow(this))
436 }
437 unsafe {
438 let f: Box_<F> = Box_::new(f);
439 connect_raw(self.as_ptr() as *mut _, c"notify::data".as_ptr() as *const _,
440 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_data_trampoline::<F> as *const ())), Box_::into_raw(f))
441 }
442 }
443
444 #[doc(alias = "persistent")]
445 pub fn connect_persistent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
446 unsafe extern "C" fn notify_persistent_trampoline<F: Fn(&SettingVpn) + 'static>(this: *mut ffi::NMSettingVpn, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
447 let f: &F = &*(f as *const F);
448 f(&from_glib_borrow(this))
449 }
450 unsafe {
451 let f: Box_<F> = Box_::new(f);
452 connect_raw(self.as_ptr() as *mut _, c"notify::persistent".as_ptr() as *const _,
453 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_persistent_trampoline::<F> as *const ())), Box_::into_raw(f))
454 }
455 }
456
457 #[doc(alias = "secrets")]
458 pub fn connect_secrets_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
459 unsafe extern "C" fn notify_secrets_trampoline<F: Fn(&SettingVpn) + 'static>(this: *mut ffi::NMSettingVpn, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
460 let f: &F = &*(f as *const F);
461 f(&from_glib_borrow(this))
462 }
463 unsafe {
464 let f: Box_<F> = Box_::new(f);
465 connect_raw(self.as_ptr() as *mut _, c"notify::secrets".as_ptr() as *const _,
466 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_secrets_trampoline::<F> as *const ())), Box_::into_raw(f))
467 }
468 }
469
470 #[doc(alias = "service-type")]
471 pub fn connect_service_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
472 unsafe extern "C" fn notify_service_type_trampoline<F: Fn(&SettingVpn) + 'static>(this: *mut ffi::NMSettingVpn, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
473 let f: &F = &*(f as *const F);
474 f(&from_glib_borrow(this))
475 }
476 unsafe {
477 let f: Box_<F> = Box_::new(f);
478 connect_raw(self.as_ptr() as *mut _, c"notify::service-type".as_ptr() as *const _,
479 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_service_type_trampoline::<F> as *const ())), Box_::into_raw(f))
480 }
481 }
482
483 #[cfg(feature = "v1_2")]
484 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
485 #[doc(alias = "timeout")]
486 pub fn connect_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
487 unsafe extern "C" fn notify_timeout_trampoline<F: Fn(&SettingVpn) + 'static>(this: *mut ffi::NMSettingVpn, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
488 let f: &F = &*(f as *const F);
489 f(&from_glib_borrow(this))
490 }
491 unsafe {
492 let f: Box_<F> = Box_::new(f);
493 connect_raw(self.as_ptr() as *mut _, c"notify::timeout".as_ptr() as *const _,
494 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_timeout_trampoline::<F> as *const ())), Box_::into_raw(f))
495 }
496 }
497
498 #[doc(alias = "user-name")]
499 pub fn connect_user_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
500 unsafe extern "C" fn notify_user_name_trampoline<F: Fn(&SettingVpn) + 'static>(this: *mut ffi::NMSettingVpn, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
501 let f: &F = &*(f as *const F);
502 f(&from_glib_borrow(this))
503 }
504 unsafe {
505 let f: Box_<F> = Box_::new(f);
506 connect_raw(self.as_ptr() as *mut _, c"notify::user-name".as_ptr() as *const _,
507 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_user_name_trampoline::<F> as *const ())), Box_::into_raw(f))
508 }
509 }
510}
511
512impl Default for SettingVpn {
513 fn default() -> Self {
514 Self::new()
515 }
516 }
517
518// rustdoc-stripper-ignore-next
519 /// A [builder-pattern] type to construct [`SettingVpn`] objects.
520 ///
521 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
522#[must_use = "The builder must be built to be used"]
523pub struct SettingVpnBuilder {
524 builder: glib::object::ObjectBuilder<'static, SettingVpn>,
525 }
526
527 impl SettingVpnBuilder {
528 fn new() -> Self {
529 Self { builder: glib::object::Object::builder() }
530 }
531
532 //pub fn data(self, data: /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) -> Self {
533 // Self { builder: self.builder.property("data", data), }
534 //}
535
536 /// If the VPN service supports persistence, and this property is [`true`],
537 /// the VPN will attempt to stay connected across link changes and outages,
538 /// until explicitly disconnected.
539 pub fn persistent(self, persistent: bool) -> Self {
540 Self { builder: self.builder.property("persistent", persistent), }
541 }
542
543 //pub fn secrets(self, secrets: /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) -> Self {
544 // Self { builder: self.builder.property("secrets", secrets), }
545 //}
546
547 /// D-Bus service name of the VPN plugin that this setting uses to connect to
548 /// its network. i.e. org.freedesktop.NetworkManager.vpnc for the vpnc
549 /// plugin.
550 pub fn service_type(self, service_type: impl Into<glib::GString>) -> Self {
551 Self { builder: self.builder.property("service-type", service_type.into()), }
552 }
553
554 /// Timeout for the VPN service to establish the connection. Some services
555 /// may take quite a long time to connect.
556 /// Value of 0 means a default timeout, which is 60 seconds (unless overridden
557 /// by vpn.timeout in configuration file). Values greater than zero mean
558 /// timeout in seconds.
559 #[cfg(feature = "v1_2")]
560 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
561 pub fn timeout(self, timeout: u32) -> Self {
562 Self { builder: self.builder.property("timeout", timeout), }
563 }
564
565 /// If the VPN connection requires a user name for authentication, that name
566 /// should be provided here. If the connection is available to more than one
567 /// user, and the VPN requires each user to supply a different name, then
568 /// leave this property empty. If this property is empty, NetworkManager
569 /// will automatically supply the username of the user which requested the
570 /// VPN connection.
571 pub fn user_name(self, user_name: impl Into<glib::GString>) -> Self {
572 Self { builder: self.builder.property("user-name", user_name.into()), }
573 }
574
575 // rustdoc-stripper-ignore-next
576 /// Build the [`SettingVpn`].
577 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
578 pub fn build(self) -> SettingVpn {
579assert_initialized_main_thread!();
580 self.builder.build() }
581}