nm_rs/auto/
vpn_editor.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,Connection};
7use glib::{object::ObjectType as _,prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11    ///
12    ///
13    /// ## Signals
14    ///
15    ///
16    /// #### `changed`
17    ///
18    ///
19    /// # Implements
20    ///
21    /// [`VpnEditorExt`][trait@crate::prelude::VpnEditorExt]
22    #[doc(alias = "NMVpnEditor")]
23    pub struct VpnEditor(Interface<ffi::NMVpnEditor, ffi::NMVpnEditorInterface>);
24
25    match fn {
26        type_ => || ffi::nm_vpn_editor_get_type(),
27    }
28}
29
30impl VpnEditor {
31        pub const NONE: Option<&'static VpnEditor> = None;
32    
33}
34
35/// Trait containing all [`struct@VpnEditor`] methods.
36///
37/// # Implementors
38///
39/// [`VpnEditor`][struct@crate::VpnEditor]
40pub trait VpnEditorExt: IsA<VpnEditor> + 'static {
41    //#[doc(alias = "nm_vpn_editor_get_widget")]
42    //#[doc(alias = "get_widget")]
43    //fn widget(&self) -> /*Ignored*/glib::Object {
44    //    unsafe { TODO: call ffi:nm_vpn_editor_get_widget() }
45    //}
46
47    #[doc(alias = "nm_vpn_editor_update_connection")]
48    fn update_connection(&self, connection: &impl IsA<Connection>) -> Result<(), glib::Error> {
49        unsafe {
50            let mut error = std::ptr::null_mut();
51            let is_ok = ffi::nm_vpn_editor_update_connection(self.as_ref().to_glib_none().0, connection.as_ref().to_glib_none().0, &mut error);
52            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
53            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
54        }
55    }
56
57    #[doc(alias = "changed")]
58    fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
59        unsafe extern "C" fn changed_trampoline<P: IsA<VpnEditor>, F: Fn(&P) + 'static>(this: *mut ffi::NMVpnEditor, f: glib::ffi::gpointer) {
60            let f: &F = &*(f as *const F);
61            f(VpnEditor::from_glib_borrow(this).unsafe_cast_ref())
62        }
63        unsafe {
64            let f: Box_<F> = Box_::new(f);
65            connect_raw(self.as_ptr() as *mut _, c"changed".as_ptr() as *const _,
66                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(changed_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
67        }
68    }
69}
70
71impl<O: IsA<VpnEditor>> VpnEditorExt for O {}