nm_rs/auto/
vpn_plugin_info.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
6#[cfg(feature = "v1_2")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
8use crate::VpnEditorPlugin;
9use crate::ffi;
10use glib::prelude::*;
11#[cfg(feature = "v1_2")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
13use glib::{
14    signal::{SignalHandlerId, connect_raw},
15    translate::*,
16};
17#[cfg(feature = "v1_2")]
18#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
19use std::boxed::Box as Box_;
20
21#[cfg(feature = "gio_v2_22")]
22#[cfg_attr(docsrs, doc(cfg(feature = "gio_v2_22")))]
23glib::wrapper! {
24    ///
25    ///
26    /// ## Properties
27    ///
28    ///
29    /// #### `filename`
30    ///  The filename from which the info was loaded.
31    /// Can be [`None`] if the instance was not loaded from
32    /// a file (i.e. the keyfile instance was passed to the
33    /// constructor).
34    ///
35    /// Readable | Writeable | Construct Only
36    ///
37    ///
38    /// #### `keyfile`
39    ///  Initialize the instance with a different keyfile instance.
40    /// When passing a keyfile instance, the constructor will not
41    /// try to read from filename.
42    ///
43    /// Writeable | Construct Only
44    ///
45    ///
46    /// #### `name`
47    ///  The name of the VPN plugin.
48    ///
49    /// Readable
50    ///
51    /// # Implements
52    ///
53    /// [`trait@gio::prelude::InitableExt`]
54    #[doc(alias = "NMVpnPluginInfo")]
55    pub struct VpnPluginInfo(Object<ffi::NMVpnPluginInfo, ffi::NMVpnPluginInfoClass>) @implements gio::Initable;
56
57    match fn {
58        type_ => || ffi::nm_vpn_plugin_info_get_type(),
59    }
60}
61
62#[cfg(not(any(feature = "gio_v2_22")))]
63glib::wrapper! {
64    #[doc(alias = "NMVpnPluginInfo")]
65    pub struct VpnPluginInfo(Object<ffi::NMVpnPluginInfo, ffi::NMVpnPluginInfoClass>);
66
67    match fn {
68        type_ => || ffi::nm_vpn_plugin_info_get_type(),
69    }
70}
71
72impl VpnPluginInfo {
73    /// Read the plugin info from file @filename. Does not do
74    /// any further verification on the file. You might want to check
75    /// file permissions and ownership of the file.
76    /// ## `filename`
77    /// filename to read.
78    ///
79    /// # Returns
80    ///
81    /// [`None`] if there is any error or a newly created
82    /// #NMVpnPluginInfo instance.
83    #[cfg(feature = "v1_2")]
84    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
85    #[doc(alias = "nm_vpn_plugin_info_new_from_file")]
86    #[doc(alias = "new_from_file")]
87    pub fn from_file(filename: &str) -> Result<VpnPluginInfo, glib::Error> {
88        assert_initialized_main_thread!();
89        unsafe {
90            let mut error = std::ptr::null_mut();
91            let ret = ffi::nm_vpn_plugin_info_new_from_file(filename.to_glib_none().0, &mut error);
92            if error.is_null() {
93                Ok(from_glib_full(ret))
94            } else {
95                Err(from_glib_full(error))
96            }
97        }
98    }
99
100    /// This has the same effect as doing a full nm_vpn_plugin_info_list_load()
101    /// followed by a search for the first matching VPN plugin info that has the
102    /// given @name and/or @service.
103    /// ## `name`
104    /// the name to search for. Either @name or @service
105    ///   must be present.
106    /// ## `service`
107    /// the service to search for. Either @name  or
108    ///   @service must be present.
109    ///
110    /// # Returns
111    ///
112    /// a newly created instance of plugin info
113    ///   or [`None`] if no matching value was found.
114    #[cfg(feature = "v1_4")]
115    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
116    #[doc(alias = "nm_vpn_plugin_info_new_search_file")]
117    pub fn new_search_file(name: Option<&str>, service: Option<&str>) -> Option<VpnPluginInfo> {
118        assert_initialized_main_thread!();
119        unsafe {
120            from_glib_full(ffi::nm_vpn_plugin_info_new_search_file(
121                name.to_glib_none().0,
122                service.to_glib_none().0,
123            ))
124        }
125    }
126
127    //#[cfg(feature = "v1_2")]
128    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
129    //#[doc(alias = "nm_vpn_plugin_info_new_with_data")]
130    //#[doc(alias = "new_with_data")]
131    //pub fn with_data(filename: &str, keyfile: /*Ignored*/&glib::KeyFile) -> Result<VpnPluginInfo, glib::Error> {
132    //    unsafe { TODO: call ffi:nm_vpn_plugin_info_new_with_data() }
133    //}
134
135    // rustdoc-stripper-ignore-next
136    /// Creates a new builder-pattern struct instance to construct [`VpnPluginInfo`] objects.
137    ///
138    /// This method returns an instance of [`VpnPluginInfoBuilder`](crate::builders::VpnPluginInfoBuilder) which can be used to create [`VpnPluginInfo`] objects.
139    pub fn builder() -> VpnPluginInfoBuilder {
140        VpnPluginInfoBuilder::new()
141    }
142
143    ///
144    /// # Returns
145    ///
146    ///
147    ///   the aliases from the name-file.
148    #[cfg(feature = "v1_4")]
149    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
150    #[doc(alias = "nm_vpn_plugin_info_get_aliases")]
151    #[doc(alias = "get_aliases")]
152    pub fn aliases(&self) -> Vec<glib::GString> {
153        unsafe {
154            FromGlibPtrContainer::from_glib_none(ffi::nm_vpn_plugin_info_get_aliases(
155                self.to_glib_none().0,
156            ))
157        }
158    }
159
160    ///
161    /// # Returns
162    ///
163    /// the absolute path to the auth-dialog helper or [`None`].
164    #[cfg(feature = "v1_4")]
165    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
166    #[doc(alias = "nm_vpn_plugin_info_get_auth_dialog")]
167    #[doc(alias = "get_auth_dialog")]
168    pub fn auth_dialog(&self) -> glib::GString {
169        unsafe {
170            from_glib_none(ffi::nm_vpn_plugin_info_get_auth_dialog(
171                self.to_glib_none().0,
172            ))
173        }
174    }
175
176    ///
177    /// # Returns
178    ///
179    /// the cached #NMVpnEditorPlugin instance.
180    #[cfg(feature = "v1_2")]
181    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
182    #[doc(alias = "nm_vpn_plugin_info_get_editor_plugin")]
183    #[doc(alias = "get_editor_plugin")]
184    pub fn editor_plugin(&self) -> VpnEditorPlugin {
185        unsafe {
186            from_glib_none(ffi::nm_vpn_plugin_info_get_editor_plugin(
187                self.to_glib_none().0,
188            ))
189        }
190    }
191
192    ///
193    /// # Returns
194    ///
195    /// the filename. Can be [`None`].
196    #[cfg(feature = "v1_2")]
197    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
198    #[doc(alias = "nm_vpn_plugin_info_get_filename")]
199    #[doc(alias = "get_filename")]
200    pub fn filename(&self) -> glib::GString {
201        unsafe { from_glib_none(ffi::nm_vpn_plugin_info_get_filename(self.to_glib_none().0)) }
202    }
203
204    ///
205    /// # Returns
206    ///
207    /// the name. Cannot be [`None`].
208    #[cfg(feature = "v1_2")]
209    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
210    #[doc(alias = "nm_vpn_plugin_info_get_name")]
211    #[doc(alias = "get_name")]
212    pub fn name(&self) -> glib::GString {
213        unsafe { from_glib_none(ffi::nm_vpn_plugin_info_get_name(self.to_glib_none().0)) }
214    }
215
216    ///
217    /// # Returns
218    ///
219    /// the plugin. Can be [`None`].
220    #[cfg(feature = "v1_2")]
221    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
222    #[doc(alias = "nm_vpn_plugin_info_get_plugin")]
223    #[doc(alias = "get_plugin")]
224    pub fn plugin(&self) -> glib::GString {
225        unsafe { from_glib_none(ffi::nm_vpn_plugin_info_get_plugin(self.to_glib_none().0)) }
226    }
227
228    ///
229    /// # Returns
230    ///
231    /// the program. Can be [`None`].
232    #[cfg(feature = "v1_2")]
233    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
234    #[doc(alias = "nm_vpn_plugin_info_get_program")]
235    #[doc(alias = "get_program")]
236    pub fn program(&self) -> glib::GString {
237        unsafe { from_glib_none(ffi::nm_vpn_plugin_info_get_program(self.to_glib_none().0)) }
238    }
239
240    ///
241    /// # Returns
242    ///
243    /// the service. Cannot be [`None`].
244    #[cfg(feature = "v1_4")]
245    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
246    #[doc(alias = "nm_vpn_plugin_info_get_service")]
247    #[doc(alias = "get_service")]
248    pub fn service(&self) -> glib::GString {
249        unsafe { from_glib_none(ffi::nm_vpn_plugin_info_get_service(self.to_glib_none().0)) }
250    }
251
252    ///
253    /// # Returns
254    ///
255    /// loads the plugin and returns the newly created
256    ///   instance. The plugin is owned by @self and can be later retrieved again
257    ///   via nm_vpn_plugin_info_get_editor_plugin(). You can load the
258    ///   plugin only once, unless you reset the state via
259    ///   nm_vpn_plugin_info_set_editor_plugin().
260    #[cfg(feature = "v1_2")]
261    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
262    #[doc(alias = "nm_vpn_plugin_info_load_editor_plugin")]
263    pub fn load_editor_plugin(&self) -> Result<VpnEditorPlugin, glib::Error> {
264        unsafe {
265            let mut error = std::ptr::null_mut();
266            let ret = ffi::nm_vpn_plugin_info_load_editor_plugin(self.to_glib_none().0, &mut error);
267            if error.is_null() {
268                Ok(from_glib_none(ret))
269            } else {
270                Err(from_glib_full(error))
271            }
272        }
273    }
274
275    /// ## `group`
276    /// group name
277    /// ## `key`
278    /// name of the property
279    ///
280    /// # Returns
281    ///
282    /// #NMVpnPluginInfo is internally a #GKeyFile. Returns the matching
283    /// property.
284    #[cfg(feature = "v1_2")]
285    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
286    #[doc(alias = "nm_vpn_plugin_info_lookup_property")]
287    pub fn lookup_property(&self, group: &str, key: &str) -> glib::GString {
288        unsafe {
289            from_glib_none(ffi::nm_vpn_plugin_info_lookup_property(
290                self.to_glib_none().0,
291                group.to_glib_none().0,
292                key.to_glib_none().0,
293            ))
294        }
295    }
296
297    /// Set the internal plugin instance. If [`None`], only clear the previous instance.
298    /// ## `plugin`
299    /// plugin instance
300    #[cfg(feature = "v1_2")]
301    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
302    #[doc(alias = "nm_vpn_plugin_info_set_editor_plugin")]
303    pub fn set_editor_plugin(&self, plugin: Option<&impl IsA<VpnEditorPlugin>>) {
304        unsafe {
305            ffi::nm_vpn_plugin_info_set_editor_plugin(
306                self.to_glib_none().0,
307                plugin.map(|p| p.as_ref()).to_glib_none().0,
308            );
309        }
310    }
311
312    ///
313    /// # Returns
314    ///
315    /// [`true`] if the supports hints for secret requests, otherwise [`false`]
316    #[cfg(feature = "v1_4")]
317    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
318    #[doc(alias = "nm_vpn_plugin_info_supports_hints")]
319    pub fn supports_hints(&self) -> bool {
320        unsafe {
321            from_glib(ffi::nm_vpn_plugin_info_supports_hints(
322                self.to_glib_none().0,
323            ))
324        }
325    }
326
327    ///
328    /// # Returns
329    ///
330    /// [`true`] if the service supports multiple instances with different bus names, otherwise [`false`]
331    #[cfg(feature = "v1_42")]
332    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
333    #[doc(alias = "nm_vpn_plugin_info_supports_multiple")]
334    pub fn supports_multiple(&self) -> bool {
335        unsafe {
336            from_glib(ffi::nm_vpn_plugin_info_supports_multiple(
337                self.to_glib_none().0,
338            ))
339        }
340    }
341
342    /// ## `list`
343    /// list of plugins
344    /// ## `plugin_info`
345    /// instance to add
346    ///
347    /// # Returns
348    ///
349    /// [`true`] if the plugin was added to @list. This will fail
350    /// to add duplicate plugins.
351    #[cfg(feature = "v1_2")]
352    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
353    #[doc(alias = "nm_vpn_plugin_info_list_add")]
354    pub fn list_add(
355        list: &[VpnPluginInfo],
356        plugin_info: &VpnPluginInfo,
357    ) -> Result<(), glib::Error> {
358        skip_assert_initialized!();
359        unsafe {
360            let mut error = std::ptr::null_mut();
361            let is_ok = ffi::nm_vpn_plugin_info_list_add(
362                &mut list
363                    .into_iter()
364                    .cloned()
365                    .collect::<glib::SList<VpnPluginInfo>>()
366                    .to_glib_none()
367                    .0,
368                plugin_info.to_glib_none().0,
369                &mut error,
370            );
371            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
372            if error.is_null() {
373                Ok(())
374            } else {
375                Err(from_glib_full(error))
376            }
377        }
378    }
379
380    /// ## `list`
381    /// list of plugins
382    /// ## `filename`
383    /// filename to search
384    ///
385    /// # Returns
386    ///
387    /// the first plugin with a matching @filename (or [`None`]).
388    #[cfg(feature = "v1_2")]
389    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
390    #[doc(alias = "nm_vpn_plugin_info_list_find_by_filename")]
391    pub fn list_find_by_filename(list: &[VpnPluginInfo], filename: &str) -> VpnPluginInfo {
392        assert_initialized_main_thread!();
393        unsafe {
394            from_glib_none(ffi::nm_vpn_plugin_info_list_find_by_filename(
395                list.into_iter()
396                    .cloned()
397                    .collect::<glib::SList<_>>()
398                    .to_glib_none()
399                    .0,
400                filename.to_glib_none().0,
401            ))
402        }
403    }
404
405    /// ## `list`
406    /// list of plugins
407    /// ## `name`
408    /// name to search
409    ///
410    /// # Returns
411    ///
412    /// the first plugin with a matching @name (or [`None`]).
413    #[cfg(feature = "v1_2")]
414    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
415    #[doc(alias = "nm_vpn_plugin_info_list_find_by_name")]
416    pub fn list_find_by_name(list: &[VpnPluginInfo], name: &str) -> VpnPluginInfo {
417        assert_initialized_main_thread!();
418        unsafe {
419            from_glib_none(ffi::nm_vpn_plugin_info_list_find_by_name(
420                list.into_iter()
421                    .cloned()
422                    .collect::<glib::SList<_>>()
423                    .to_glib_none()
424                    .0,
425                name.to_glib_none().0,
426            ))
427        }
428    }
429
430    /// ## `list`
431    /// list of plugins
432    /// ## `service`
433    /// service to search. This can be the main service-type
434    ///   or one of the provided aliases.
435    ///
436    /// # Returns
437    ///
438    /// the first plugin with a matching @service (or [`None`]).
439    #[cfg(feature = "v1_2")]
440    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
441    #[doc(alias = "nm_vpn_plugin_info_list_find_by_service")]
442    pub fn list_find_by_service(list: &[VpnPluginInfo], service: &str) -> VpnPluginInfo {
443        assert_initialized_main_thread!();
444        unsafe {
445            from_glib_none(ffi::nm_vpn_plugin_info_list_find_by_service(
446                list.into_iter()
447                    .cloned()
448                    .collect::<glib::SList<_>>()
449                    .to_glib_none()
450                    .0,
451                service.to_glib_none().0,
452            ))
453        }
454    }
455
456    /// A VPN plugin provides one or several service-types, like org.freedesktop.NetworkManager.libreswan
457    /// Certain plugins provide more then one service type, via aliases (org.freedesktop.NetworkManager.openswan).
458    /// This function looks up a service-type (or an alias) based on a name.
459    ///
460    /// Preferably, the name can be a full service-type/alias of an installed
461    /// plugin. Otherwise, it can be the name of a VPN plugin (in which case, the
462    /// primary, non-aliased service-type is returned). Otherwise, it can be
463    /// one of several well known short-names (which is a hard-coded list of
464    /// types in libnm). On success, this returns a full qualified service-type
465    /// (or an alias). It doesn't say, that such an plugin is actually available,
466    /// but it could be retrieved via nm_vpn_plugin_info_list_find_by_service().
467    /// ## `list`
468    /// a possibly empty #GSList of #NMVpnPluginInfo instances
469    /// ## `name`
470    /// a name to lookup the service-type.
471    ///
472    /// # Returns
473    ///
474    /// the resolved service-type or [`None`] on failure.
475    #[cfg(feature = "v1_4")]
476    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
477    #[doc(alias = "nm_vpn_plugin_info_list_find_service_type")]
478    pub fn list_find_service_type(list: &[VpnPluginInfo], name: &str) -> glib::GString {
479        assert_initialized_main_thread!();
480        unsafe {
481            from_glib_full(ffi::nm_vpn_plugin_info_list_find_service_type(
482                list.into_iter()
483                    .cloned()
484                    .collect::<glib::SList<_>>()
485                    .to_glib_none()
486                    .0,
487                name.to_glib_none().0,
488            ))
489        }
490    }
491
492    /// ## `list`
493    /// a possibly empty #GSList of #NMVpnPluginInfo
494    /// ## `only_existing`
495    /// only include results that are actually in @list.
496    ///   Otherwise, the result is extended with a hard-code list or
497    ///   well-known plugins
498    /// ## `with_abbreviations`
499    /// if [`false`], only full service types are returned.
500    ///   Otherwise, this also includes abbreviated names that can be used
501    ///   with nm_vpn_plugin_info_list_find_service_type().
502    ///
503    /// # Returns
504    ///
505    /// a [`None`] terminated strv list of strings.
506    ///   The list itself and the values must be freed with g_strfreev().
507    #[cfg(feature = "v1_4")]
508    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
509    #[doc(alias = "nm_vpn_plugin_info_list_get_service_types")]
510    pub fn list_get_service_types(
511        list: &[VpnPluginInfo],
512        only_existing: bool,
513        with_abbreviations: bool,
514    ) -> Vec<glib::GString> {
515        assert_initialized_main_thread!();
516        unsafe {
517            FromGlibPtrContainer::from_glib_full(ffi::nm_vpn_plugin_info_list_get_service_types(
518                list.into_iter()
519                    .cloned()
520                    .collect::<glib::SList<_>>()
521                    .to_glib_none()
522                    .0,
523                only_existing.into_glib(),
524                with_abbreviations.into_glib(),
525            ))
526        }
527    }
528
529    ///
530    /// # Returns
531    ///
532    /// list of plugins
533    /// loaded from the default directories rejecting duplicates.
534    #[cfg(feature = "v1_2")]
535    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
536    #[doc(alias = "nm_vpn_plugin_info_list_load")]
537    pub fn list_load() -> Vec<VpnPluginInfo> {
538        assert_initialized_main_thread!();
539        unsafe { FromGlibPtrContainer::from_glib_full(ffi::nm_vpn_plugin_info_list_load()) }
540    }
541
542    /// Remove @plugin_info from @list.
543    /// ## `list`
544    /// list of plugins
545    /// ## `plugin_info`
546    /// instance
547    ///
548    /// # Returns
549    ///
550    /// [`true`] if @plugin_info was in @list and successfully removed.
551    #[cfg(feature = "v1_2")]
552    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
553    #[doc(alias = "nm_vpn_plugin_info_list_remove")]
554    pub fn list_remove(list: &[VpnPluginInfo], plugin_info: &VpnPluginInfo) -> bool {
555        skip_assert_initialized!();
556        unsafe {
557            from_glib(ffi::nm_vpn_plugin_info_list_remove(
558                &mut list
559                    .into_iter()
560                    .cloned()
561                    .collect::<glib::SList<_>>()
562                    .to_glib_none()
563                    .0,
564                plugin_info.to_glib_none().0,
565            ))
566        }
567    }
568
569    /// Regular name files have a certain pattern. That basically means
570    /// they have the file extension "name". Check if @filename
571    /// is valid according to that pattern.
572    /// ## `filename`
573    /// the filename to check
574    #[cfg(feature = "v1_2")]
575    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
576    #[doc(alias = "nm_vpn_plugin_info_validate_filename")]
577    pub fn validate_filename(filename: &str) -> bool {
578        assert_initialized_main_thread!();
579        unsafe {
580            from_glib(ffi::nm_vpn_plugin_info_validate_filename(
581                filename.to_glib_none().0,
582            ))
583        }
584    }
585
586    #[cfg(feature = "v1_2")]
587    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
588    #[doc(alias = "name")]
589    pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
590        unsafe extern "C" fn notify_name_trampoline<F: Fn(&VpnPluginInfo) + 'static>(
591            this: *mut ffi::NMVpnPluginInfo,
592            _param_spec: glib::ffi::gpointer,
593            f: glib::ffi::gpointer,
594        ) {
595            let f: &F = &*(f as *const F);
596            f(&from_glib_borrow(this))
597        }
598        unsafe {
599            let f: Box_<F> = Box_::new(f);
600            connect_raw(
601                self.as_ptr() as *mut _,
602                c"notify::name".as_ptr() as *const _,
603                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
604                    notify_name_trampoline::<F> as *const (),
605                )),
606                Box_::into_raw(f),
607            )
608        }
609    }
610}
611
612#[cfg(feature = "v1_2")]
613#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
614impl std::fmt::Display for VpnPluginInfo {
615    #[inline]
616    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
617        f.write_str(&self.name())
618    }
619}
620
621// rustdoc-stripper-ignore-next
622/// A [builder-pattern] type to construct [`VpnPluginInfo`] objects.
623///
624/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
625#[must_use = "The builder must be built to be used"]
626pub struct VpnPluginInfoBuilder {
627    builder: glib::object::ObjectBuilder<'static, VpnPluginInfo>,
628}
629
630impl VpnPluginInfoBuilder {
631    fn new() -> Self {
632        Self {
633            builder: glib::object::Object::builder(),
634        }
635    }
636
637    /// The filename from which the info was loaded.
638    /// Can be [`None`] if the instance was not loaded from
639    /// a file (i.e. the keyfile instance was passed to the
640    /// constructor).
641    #[cfg(feature = "v1_2")]
642    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
643    pub fn filename(self, filename: impl Into<glib::GString>) -> Self {
644        Self {
645            builder: self.builder.property("filename", filename.into()),
646        }
647    }
648
649    /// Initialize the instance with a different keyfile instance.
650    /// When passing a keyfile instance, the constructor will not
651    /// try to read from filename.
652    #[cfg(feature = "v1_2")]
653    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
654    pub fn keyfile(self, keyfile: /*Ignored*/ &glib::KeyFile) -> Self {
655        Self {
656            builder: self.builder.property("keyfile", keyfile),
657        }
658    }
659
660    // rustdoc-stripper-ignore-next
661    /// Build the [`VpnPluginInfo`].
662    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
663    pub fn build(self) -> VpnPluginInfo {
664        assert_initialized_main_thread!();
665        self.builder.build()
666    }
667}