nm_rs/auto/
setting_olpc_mesh.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    /// OLPC Wireless Mesh Settings
12    ///
13    /// ## Properties
14    ///
15    ///
16    /// #### `channel`
17    ///  Channel on which the mesh network to join is located.
18    ///
19    /// Readable | Writeable
20    ///
21    ///
22    /// #### `dhcp-anycast-address`
23    ///  Anycast DHCP MAC address used when requesting an IP address via DHCP.
24    /// The specific anycast address used determines which DHCP server class
25    /// answers the request.
26    ///
27    /// This is currently only implemented by dhclient DHCP plugin.
28    ///
29    /// Readable | Writeable
30    ///
31    ///
32    /// #### `ssid`
33    ///  SSID of the mesh network to join.
34    ///
35    /// Readable | Writeable
36    /// <details><summary><h4>Setting</h4></summary>
37    ///
38    ///
39    /// #### `name`
40    ///  The setting's name, which uniquely identifies the setting within the
41    /// connection.  Each setting type has a name unique to that type, for
42    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
43    ///
44    /// Readable
45    /// </details>
46    ///
47    /// # Implements
48    ///
49    /// [`SettingExt`][trait@crate::prelude::SettingExt]
50    #[doc(alias = "NMSettingOlpcMesh")]
51    pub struct SettingOlpcMesh(Object<ffi::NMSettingOlpcMesh, ffi::NMSettingOlpcMeshClass>) @extends Setting;
52
53    match fn {
54        type_ => || ffi::nm_setting_olpc_mesh_get_type(),
55    }
56}
57
58impl SettingOlpcMesh {
59    /// Creates a new #NMSettingOlpcMesh object with default values.
60    ///
61    /// # Returns
62    ///
63    /// the new empty #NMSettingOlpcMesh object
64    #[doc(alias = "nm_setting_olpc_mesh_new")]
65    pub fn new() -> SettingOlpcMesh {
66        assert_initialized_main_thread!();
67        unsafe {
68            Setting::from_glib_full(ffi::nm_setting_olpc_mesh_new()).unsafe_cast()
69        }
70    }
71
72            // rustdoc-stripper-ignore-next
73            /// Creates a new builder-pattern struct instance to construct [`SettingOlpcMesh`] objects.
74            ///
75            /// This method returns an instance of [`SettingOlpcMeshBuilder`](crate::builders::SettingOlpcMeshBuilder) which can be used to create [`SettingOlpcMesh`] objects.
76            pub fn builder() -> SettingOlpcMeshBuilder {
77                SettingOlpcMeshBuilder::new()
78            }
79        
80
81    #[doc(alias = "nm_setting_olpc_mesh_get_channel")]
82    #[doc(alias = "get_channel")]
83    pub fn channel(&self) -> u32 {
84        unsafe {
85            ffi::nm_setting_olpc_mesh_get_channel(self.to_glib_none().0)
86        }
87    }
88
89    #[doc(alias = "nm_setting_olpc_mesh_get_dhcp_anycast_address")]
90    #[doc(alias = "get_dhcp_anycast_address")]
91    #[doc(alias = "dhcp-anycast-address")]
92    pub fn dhcp_anycast_address(&self) -> glib::GString {
93        unsafe {
94            from_glib_none(ffi::nm_setting_olpc_mesh_get_dhcp_anycast_address(self.to_glib_none().0))
95        }
96    }
97
98    //#[doc(alias = "nm_setting_olpc_mesh_get_ssid")]
99    //#[doc(alias = "get_ssid")]
100    //pub fn ssid(&self) -> /*Ignored*/glib::Bytes {
101    //    unsafe { TODO: call ffi:nm_setting_olpc_mesh_get_ssid() }
102    //}
103
104    /// Channel on which the mesh network to join is located.
105    pub fn set_channel(&self, channel: u32) {
106        ObjectExt::set_property(self,"channel", channel)
107    }
108
109    /// Anycast DHCP MAC address used when requesting an IP address via DHCP.
110    /// The specific anycast address used determines which DHCP server class
111    /// answers the request.
112    ///
113    /// This is currently only implemented by dhclient DHCP plugin.
114    #[doc(alias = "dhcp-anycast-address")]
115    pub fn set_dhcp_anycast_address(&self, dhcp_anycast_address: Option<&str>) {
116        ObjectExt::set_property(self,"dhcp-anycast-address", dhcp_anycast_address)
117    }
118
119    //pub fn set_ssid(&self, ssid: /*Ignored*/Option<&glib::Bytes>) {
120    //    ObjectExt::set_property(self,"ssid", ssid)
121    //}
122
123    #[doc(alias = "channel")]
124    pub fn connect_channel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
125        unsafe extern "C" fn notify_channel_trampoline<F: Fn(&SettingOlpcMesh) + 'static>(this: *mut ffi::NMSettingOlpcMesh, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
126            let f: &F = &*(f as *const F);
127            f(&from_glib_borrow(this))
128        }
129        unsafe {
130            let f: Box_<F> = Box_::new(f);
131            connect_raw(self.as_ptr() as *mut _, c"notify::channel".as_ptr() as *const _,
132                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_channel_trampoline::<F> as *const ())), Box_::into_raw(f))
133        }
134    }
135
136    #[doc(alias = "dhcp-anycast-address")]
137    pub fn connect_dhcp_anycast_address_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
138        unsafe extern "C" fn notify_dhcp_anycast_address_trampoline<F: Fn(&SettingOlpcMesh) + 'static>(this: *mut ffi::NMSettingOlpcMesh, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
139            let f: &F = &*(f as *const F);
140            f(&from_glib_borrow(this))
141        }
142        unsafe {
143            let f: Box_<F> = Box_::new(f);
144            connect_raw(self.as_ptr() as *mut _, c"notify::dhcp-anycast-address".as_ptr() as *const _,
145                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_dhcp_anycast_address_trampoline::<F> as *const ())), Box_::into_raw(f))
146        }
147    }
148
149    #[doc(alias = "ssid")]
150    pub fn connect_ssid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
151        unsafe extern "C" fn notify_ssid_trampoline<F: Fn(&SettingOlpcMesh) + 'static>(this: *mut ffi::NMSettingOlpcMesh, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
152            let f: &F = &*(f as *const F);
153            f(&from_glib_borrow(this))
154        }
155        unsafe {
156            let f: Box_<F> = Box_::new(f);
157            connect_raw(self.as_ptr() as *mut _, c"notify::ssid".as_ptr() as *const _,
158                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ssid_trampoline::<F> as *const ())), Box_::into_raw(f))
159        }
160    }
161}
162
163impl Default for SettingOlpcMesh {
164                     fn default() -> Self {
165                         Self::new()
166                     }
167                 }
168
169// rustdoc-stripper-ignore-next
170        /// A [builder-pattern] type to construct [`SettingOlpcMesh`] objects.
171        ///
172        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
173#[must_use = "The builder must be built to be used"]
174pub struct SettingOlpcMeshBuilder {
175            builder: glib::object::ObjectBuilder<'static, SettingOlpcMesh>,
176        }
177
178        impl SettingOlpcMeshBuilder {
179        fn new() -> Self {
180            Self { builder: glib::object::Object::builder() }
181        }
182
183                            /// Channel on which the mesh network to join is located.
184                            pub fn channel(self, channel: u32) -> Self {
185                            Self { builder: self.builder.property("channel", channel), }
186                        }
187
188                            /// Anycast DHCP MAC address used when requesting an IP address via DHCP.
189                            /// The specific anycast address used determines which DHCP server class
190                            /// answers the request.
191                            ///
192                            /// This is currently only implemented by dhclient DHCP plugin.
193                            pub fn dhcp_anycast_address(self, dhcp_anycast_address: impl Into<glib::GString>) -> Self {
194                            Self { builder: self.builder.property("dhcp-anycast-address", dhcp_anycast_address.into()), }
195                        }
196
197                            //pub fn ssid(self, ssid: /*Ignored*/&glib::Bytes) -> Self {
198                        //    Self { builder: self.builder.property("ssid", ssid), }
199                        //}
200
201    // rustdoc-stripper-ignore-next
202    /// Build the [`SettingOlpcMesh`].
203    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
204    pub fn build(self) -> SettingOlpcMesh {
205assert_initialized_main_thread!();
206    self.builder.build() }
207}