nm_rs/auto/
setting_pppoe.rs1use crate::{ffi,Setting,SettingSecretFlags};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11 #[doc(alias = "NMSettingPppoe")]
65 pub struct SettingPppoe(Object<ffi::NMSettingPppoe, ffi::NMSettingPppoeClass>) @extends Setting;
66
67 match fn {
68 type_ => || ffi::nm_setting_pppoe_get_type(),
69 }
70}
71
72impl SettingPppoe {
73 #[doc(alias = "nm_setting_pppoe_new")]
79 pub fn new() -> SettingPppoe {
80 assert_initialized_main_thread!();
81 unsafe {
82 Setting::from_glib_full(ffi::nm_setting_pppoe_new()).unsafe_cast()
83 }
84 }
85
86 pub fn builder() -> SettingPppoeBuilder {
91 SettingPppoeBuilder::new()
92 }
93
94
95 #[cfg(feature = "v1_10")]
100 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
101 #[doc(alias = "nm_setting_pppoe_get_parent")]
102 #[doc(alias = "get_parent")]
103 pub fn parent(&self) -> glib::GString {
104 unsafe {
105 from_glib_none(ffi::nm_setting_pppoe_get_parent(self.to_glib_none().0))
106 }
107 }
108
109 #[doc(alias = "nm_setting_pppoe_get_password")]
114 #[doc(alias = "get_password")]
115 pub fn password(&self) -> glib::GString {
116 unsafe {
117 from_glib_none(ffi::nm_setting_pppoe_get_password(self.to_glib_none().0))
118 }
119 }
120
121 #[doc(alias = "nm_setting_pppoe_get_password_flags")]
126 #[doc(alias = "get_password_flags")]
127 #[doc(alias = "password-flags")]
128 pub fn password_flags(&self) -> SettingSecretFlags {
129 unsafe {
130 from_glib(ffi::nm_setting_pppoe_get_password_flags(self.to_glib_none().0))
131 }
132 }
133
134 #[doc(alias = "nm_setting_pppoe_get_service")]
139 #[doc(alias = "get_service")]
140 pub fn service(&self) -> glib::GString {
141 unsafe {
142 from_glib_none(ffi::nm_setting_pppoe_get_service(self.to_glib_none().0))
143 }
144 }
145
146 #[doc(alias = "nm_setting_pppoe_get_username")]
151 #[doc(alias = "get_username")]
152 pub fn username(&self) -> glib::GString {
153 unsafe {
154 from_glib_none(ffi::nm_setting_pppoe_get_username(self.to_glib_none().0))
155 }
156 }
157
158 #[cfg(feature = "v1_10")]
163 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
164 pub fn set_parent(&self, parent: Option<&str>) {
165 ObjectExt::set_property(self,"parent", parent)
166 }
167
168 pub fn set_password(&self, password: Option<&str>) {
170 ObjectExt::set_property(self,"password", password)
171 }
172
173 #[doc(alias = "password-flags")]
175 pub fn set_password_flags(&self, password_flags: SettingSecretFlags) {
176 ObjectExt::set_property(self,"password-flags", password_flags)
177 }
178
179 pub fn set_service(&self, service: Option<&str>) {
184 ObjectExt::set_property(self,"service", service)
185 }
186
187 pub fn set_username(&self, username: Option<&str>) {
189 ObjectExt::set_property(self,"username", username)
190 }
191
192 #[cfg(feature = "v1_10")]
193 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
194 #[doc(alias = "parent")]
195 pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
196 unsafe extern "C" fn notify_parent_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
197 let f: &F = &*(f as *const F);
198 f(&from_glib_borrow(this))
199 }
200 unsafe {
201 let f: Box_<F> = Box_::new(f);
202 connect_raw(self.as_ptr() as *mut _, c"notify::parent".as_ptr() as *const _,
203 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
204 }
205 }
206
207 #[doc(alias = "password")]
208 pub fn connect_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
209 unsafe extern "C" fn notify_password_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
210 let f: &F = &*(f as *const F);
211 f(&from_glib_borrow(this))
212 }
213 unsafe {
214 let f: Box_<F> = Box_::new(f);
215 connect_raw(self.as_ptr() as *mut _, c"notify::password".as_ptr() as *const _,
216 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_trampoline::<F> as *const ())), Box_::into_raw(f))
217 }
218 }
219
220 #[doc(alias = "password-flags")]
221 pub fn connect_password_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
222 unsafe extern "C" fn notify_password_flags_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
223 let f: &F = &*(f as *const F);
224 f(&from_glib_borrow(this))
225 }
226 unsafe {
227 let f: Box_<F> = Box_::new(f);
228 connect_raw(self.as_ptr() as *mut _, c"notify::password-flags".as_ptr() as *const _,
229 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_password_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
230 }
231 }
232
233 #[doc(alias = "service")]
234 pub fn connect_service_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
235 unsafe extern "C" fn notify_service_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
236 let f: &F = &*(f as *const F);
237 f(&from_glib_borrow(this))
238 }
239 unsafe {
240 let f: Box_<F> = Box_::new(f);
241 connect_raw(self.as_ptr() as *mut _, c"notify::service".as_ptr() as *const _,
242 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_service_trampoline::<F> as *const ())), Box_::into_raw(f))
243 }
244 }
245
246 #[doc(alias = "username")]
247 pub fn connect_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
248 unsafe extern "C" fn notify_username_trampoline<F: Fn(&SettingPppoe) + 'static>(this: *mut ffi::NMSettingPppoe, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
249 let f: &F = &*(f as *const F);
250 f(&from_glib_borrow(this))
251 }
252 unsafe {
253 let f: Box_<F> = Box_::new(f);
254 connect_raw(self.as_ptr() as *mut _, c"notify::username".as_ptr() as *const _,
255 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_username_trampoline::<F> as *const ())), Box_::into_raw(f))
256 }
257 }
258}
259
260impl Default for SettingPppoe {
261 fn default() -> Self {
262 Self::new()
263 }
264 }
265
266#[must_use = "The builder must be built to be used"]
271pub struct SettingPppoeBuilder {
272 builder: glib::object::ObjectBuilder<'static, SettingPppoe>,
273 }
274
275 impl SettingPppoeBuilder {
276 fn new() -> Self {
277 Self { builder: glib::object::Object::builder() }
278 }
279
280 #[cfg(feature = "v1_10")]
285 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
286 pub fn parent(self, parent: impl Into<glib::GString>) -> Self {
287 Self { builder: self.builder.property("parent", parent.into()), }
288 }
289
290 pub fn password(self, password: impl Into<glib::GString>) -> Self {
292 Self { builder: self.builder.property("password", password.into()), }
293 }
294
295 pub fn password_flags(self, password_flags: SettingSecretFlags) -> Self {
297 Self { builder: self.builder.property("password-flags", password_flags), }
298 }
299
300 pub fn service(self, service: impl Into<glib::GString>) -> Self {
305 Self { builder: self.builder.property("service", service.into()), }
306 }
307
308 pub fn username(self, username: impl Into<glib::GString>) -> Self {
310 Self { builder: self.builder.property("username", username.into()), }
311 }
312
313 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
316 pub fn build(self) -> SettingPppoe {
317assert_initialized_main_thread!();
318 self.builder.build() }
319}