nm_rs/auto/
setting_proxy.rs1use crate::{ffi,Setting};
7#[cfg(feature = "v1_6")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
9use crate::{SettingProxyMethod};
10use glib::{prelude::*};
11#[cfg(feature = "v1_6")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
13use glib::{signal::{connect_raw, SignalHandlerId},translate::*};
14#[cfg(feature = "v1_6")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
16use std::{boxed::Box as Box_};
17
18glib::wrapper! {
19 #[doc(alias = "NMSettingProxy")]
62 pub struct SettingProxy(Object<ffi::NMSettingProxy, ffi::NMSettingProxyClass>) @extends Setting;
63
64 match fn {
65 type_ => || ffi::nm_setting_proxy_get_type(),
66 }
67}
68
69impl SettingProxy {
70 #[cfg(feature = "v1_6")]
76 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
77 #[doc(alias = "nm_setting_proxy_new")]
78 pub fn new() -> SettingProxy {
79 assert_initialized_main_thread!();
80 unsafe {
81 Setting::from_glib_full(ffi::nm_setting_proxy_new()).unsafe_cast()
82 }
83 }
84
85 pub fn builder() -> SettingProxyBuilder {
90 SettingProxyBuilder::new()
91 }
92
93
94 #[cfg(feature = "v1_6")]
100 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
101 #[doc(alias = "nm_setting_proxy_get_browser_only")]
102 #[doc(alias = "get_browser_only")]
103 #[doc(alias = "browser-only")]
104 pub fn is_browser_only(&self) -> bool {
105 unsafe {
106 from_glib(ffi::nm_setting_proxy_get_browser_only(self.to_glib_none().0))
107 }
108 }
109
110 #[cfg(feature = "v1_6")]
118 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
119 #[doc(alias = "nm_setting_proxy_get_method")]
120 #[doc(alias = "get_method")]
121 pub fn method(&self) -> SettingProxyMethod {
122 unsafe {
123 from_glib(ffi::nm_setting_proxy_get_method(self.to_glib_none().0))
124 }
125 }
126
127 #[cfg(feature = "v1_6")]
132 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
133 #[doc(alias = "nm_setting_proxy_get_pac_script")]
134 #[doc(alias = "get_pac_script")]
135 #[doc(alias = "pac-script")]
136 pub fn pac_script(&self) -> glib::GString {
137 unsafe {
138 from_glib_none(ffi::nm_setting_proxy_get_pac_script(self.to_glib_none().0))
139 }
140 }
141
142 #[cfg(feature = "v1_6")]
147 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
148 #[doc(alias = "nm_setting_proxy_get_pac_url")]
149 #[doc(alias = "get_pac_url")]
150 #[doc(alias = "pac-url")]
151 pub fn pac_url(&self) -> glib::GString {
152 unsafe {
153 from_glib_none(ffi::nm_setting_proxy_get_pac_url(self.to_glib_none().0))
154 }
155 }
156
157 #[cfg(feature = "v1_6")]
159 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
160 #[doc(alias = "browser-only")]
161 pub fn set_browser_only(&self, browser_only: bool) {
162 ObjectExt::set_property(self,"browser-only", browser_only)
163 }
164
165 #[cfg(feature = "v1_6")]
167 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
168 pub fn set_method(&self, method: i32) {
169 ObjectExt::set_property(self,"method", method)
170 }
171
172 #[cfg(feature = "v1_6")]
175 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
176 #[doc(alias = "pac-script")]
177 pub fn set_pac_script(&self, pac_script: Option<&str>) {
178 ObjectExt::set_property(self,"pac-script", pac_script)
179 }
180
181 #[cfg(feature = "v1_6")]
183 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
184 #[doc(alias = "pac-url")]
185 pub fn set_pac_url(&self, pac_url: Option<&str>) {
186 ObjectExt::set_property(self,"pac-url", pac_url)
187 }
188
189 #[cfg(feature = "v1_6")]
190 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
191 #[doc(alias = "browser-only")]
192 pub fn connect_browser_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
193 unsafe extern "C" fn notify_browser_only_trampoline<F: Fn(&SettingProxy) + 'static>(this: *mut ffi::NMSettingProxy, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
194 let f: &F = &*(f as *const F);
195 f(&from_glib_borrow(this))
196 }
197 unsafe {
198 let f: Box_<F> = Box_::new(f);
199 connect_raw(self.as_ptr() as *mut _, c"notify::browser-only".as_ptr() as *const _,
200 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_browser_only_trampoline::<F> as *const ())), Box_::into_raw(f))
201 }
202 }
203
204 #[cfg(feature = "v1_6")]
205 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
206 #[doc(alias = "method")]
207 pub fn connect_method_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
208 unsafe extern "C" fn notify_method_trampoline<F: Fn(&SettingProxy) + 'static>(this: *mut ffi::NMSettingProxy, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
209 let f: &F = &*(f as *const F);
210 f(&from_glib_borrow(this))
211 }
212 unsafe {
213 let f: Box_<F> = Box_::new(f);
214 connect_raw(self.as_ptr() as *mut _, c"notify::method".as_ptr() as *const _,
215 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_method_trampoline::<F> as *const ())), Box_::into_raw(f))
216 }
217 }
218
219 #[cfg(feature = "v1_6")]
220 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
221 #[doc(alias = "pac-script")]
222 pub fn connect_pac_script_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
223 unsafe extern "C" fn notify_pac_script_trampoline<F: Fn(&SettingProxy) + 'static>(this: *mut ffi::NMSettingProxy, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
224 let f: &F = &*(f as *const F);
225 f(&from_glib_borrow(this))
226 }
227 unsafe {
228 let f: Box_<F> = Box_::new(f);
229 connect_raw(self.as_ptr() as *mut _, c"notify::pac-script".as_ptr() as *const _,
230 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_pac_script_trampoline::<F> as *const ())), Box_::into_raw(f))
231 }
232 }
233
234 #[cfg(feature = "v1_6")]
235 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
236 #[doc(alias = "pac-url")]
237 pub fn connect_pac_url_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
238 unsafe extern "C" fn notify_pac_url_trampoline<F: Fn(&SettingProxy) + 'static>(this: *mut ffi::NMSettingProxy, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
239 let f: &F = &*(f as *const F);
240 f(&from_glib_borrow(this))
241 }
242 unsafe {
243 let f: Box_<F> = Box_::new(f);
244 connect_raw(self.as_ptr() as *mut _, c"notify::pac-url".as_ptr() as *const _,
245 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_pac_url_trampoline::<F> as *const ())), Box_::into_raw(f))
246 }
247 }
248}
249
250#[cfg(feature = "v1_6")]
251#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
252impl Default for SettingProxy {
253 fn default() -> Self {
254 Self::new()
255 }
256 }
257
258#[must_use = "The builder must be built to be used"]
263pub struct SettingProxyBuilder {
264 builder: glib::object::ObjectBuilder<'static, SettingProxy>,
265 }
266
267 impl SettingProxyBuilder {
268 fn new() -> Self {
269 Self { builder: glib::object::Object::builder() }
270 }
271
272 #[cfg(feature = "v1_6")]
274 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
275 pub fn browser_only(self, browser_only: bool) -> Self {
276 Self { builder: self.builder.property("browser-only", browser_only), }
277 }
278
279 #[cfg(feature = "v1_6")]
281 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
282 pub fn method(self, method: i32) -> Self {
283 Self { builder: self.builder.property("method", method), }
284 }
285
286 #[cfg(feature = "v1_6")]
289 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
290 pub fn pac_script(self, pac_script: impl Into<glib::GString>) -> Self {
291 Self { builder: self.builder.property("pac-script", pac_script.into()), }
292 }
293
294 #[cfg(feature = "v1_6")]
296 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
297 pub fn pac_url(self, pac_url: impl Into<glib::GString>) -> Self {
298 Self { builder: self.builder.property("pac-url", pac_url.into()), }
299 }
300
301 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
304 pub fn build(self) -> SettingProxy {
305assert_initialized_main_thread!();
306 self.builder.build() }
307}