nm_rs/auto/
dhcp_config.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,Object};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11    ///
12    ///
13    /// This is an Abstract Base Class, you cannot instantiate it.
14    ///
15    /// ## Properties
16    ///
17    ///
18    /// #### `family`
19    ///  The IP address family of the configuration; either
20    /// <literal>AF_INET</literal> or <literal>AF_INET6</literal>.
21    ///
22    /// Readable
23    ///
24    ///
25    /// #### `options`
26    ///  The #GHashTable containing options of the configuration.
27    ///
28    /// Readable
29    /// <details><summary><h4>Object</h4></summary>
30    ///
31    ///
32    /// #### `client`
33    ///  The NMClient instance as returned by nm_object_get_client().
34    ///
35    /// When an NMObject gets removed from the NMClient cache,
36    /// the NMObject:path property stays unchanged, but this client
37    /// instance gets reset to [`None`]. You can use this property to
38    /// track removal of the object from the cache.
39    ///
40    /// Readable
41    ///
42    ///
43    /// #### `path`
44    ///  The D-Bus object path.
45    ///
46    /// The D-Bus path of an object instance never changes, even if the object
47    /// gets removed from the cache. To see whether the object is still in the
48    /// cache, check NMObject:client.
49    ///
50    /// Readable
51    /// </details>
52    ///
53    /// # Implements
54    ///
55    /// [`ObjectExt`][trait@crate::prelude::ObjectExt]
56    #[doc(alias = "NMDhcpConfig")]
57    pub struct DhcpConfig(Object<ffi::NMDhcpConfig, ffi::NMDhcpConfigClass>) @extends Object;
58
59    match fn {
60        type_ => || ffi::nm_dhcp_config_get_type(),
61    }
62}
63
64impl DhcpConfig {
65    /// Gets the IP address family of the configuration
66    ///
67    /// # Returns
68    ///
69    /// the IP address family; either <literal>AF_INET</literal> or
70    ///   <literal>AF_INET6</literal>
71    #[doc(alias = "nm_dhcp_config_get_family")]
72    #[doc(alias = "get_family")]
73    pub fn family(&self) -> i32 {
74        unsafe {
75            ffi::nm_dhcp_config_get_family(self.to_glib_none().0)
76        }
77    }
78
79    /// Gets one option by option name.
80    /// ## `option`
81    /// the option to retrieve
82    ///
83    /// # Returns
84    ///
85    /// the configuration option's value. This is the internal string used by the
86    /// configuration, and must not be modified.
87    #[doc(alias = "nm_dhcp_config_get_one_option")]
88    #[doc(alias = "get_one_option")]
89    pub fn one_option(&self, option: &str) -> glib::GString {
90        unsafe {
91            from_glib_none(ffi::nm_dhcp_config_get_one_option(self.to_glib_none().0, option.to_glib_none().0))
92        }
93    }
94
95    //#[doc(alias = "nm_dhcp_config_get_options")]
96    //#[doc(alias = "get_options")]
97    //pub fn options(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } {
98    //    unsafe { TODO: call ffi:nm_dhcp_config_get_options() }
99    //}
100
101    #[doc(alias = "family")]
102    pub fn connect_family_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
103        unsafe extern "C" fn notify_family_trampoline<F: Fn(&DhcpConfig) + 'static>(this: *mut ffi::NMDhcpConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
104            let f: &F = &*(f as *const F);
105            f(&from_glib_borrow(this))
106        }
107        unsafe {
108            let f: Box_<F> = Box_::new(f);
109            connect_raw(self.as_ptr() as *mut _, c"notify::family".as_ptr() as *const _,
110                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_family_trampoline::<F> as *const ())), Box_::into_raw(f))
111        }
112    }
113
114    #[doc(alias = "options")]
115    pub fn connect_options_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
116        unsafe extern "C" fn notify_options_trampoline<F: Fn(&DhcpConfig) + 'static>(this: *mut ffi::NMDhcpConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
117            let f: &F = &*(f as *const F);
118            f(&from_glib_borrow(this))
119        }
120        unsafe {
121            let f: Box_<F> = Box_::new(f);
122            connect_raw(self.as_ptr() as *mut _, c"notify::options".as_ptr() as *const _,
123                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_options_trampoline::<F> as *const ())), Box_::into_raw(f))
124        }
125    }
126}