nm_rs/auto/
setting_bluetooth.rs1use crate::{ffi,Setting};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11 #[doc(alias = "NMSettingBluetooth")]
42 pub struct SettingBluetooth(Object<ffi::NMSettingBluetooth, ffi::NMSettingBluetoothClass>) @extends Setting;
43
44 match fn {
45 type_ => || ffi::nm_setting_bluetooth_get_type(),
46 }
47}
48
49impl SettingBluetooth {
50 #[doc(alias = "nm_setting_bluetooth_new")]
56 pub fn new() -> SettingBluetooth {
57 assert_initialized_main_thread!();
58 unsafe {
59 Setting::from_glib_full(ffi::nm_setting_bluetooth_new()).unsafe_cast()
60 }
61 }
62
63 pub fn builder() -> SettingBluetoothBuilder {
68 SettingBluetoothBuilder::new()
69 }
70
71
72 #[doc(alias = "nm_setting_bluetooth_get_bdaddr")]
79 #[doc(alias = "get_bdaddr")]
80 pub fn bdaddr(&self) -> glib::GString {
81 unsafe {
82 from_glib_none(ffi::nm_setting_bluetooth_get_bdaddr(self.to_glib_none().0))
83 }
84 }
85
86 #[doc(alias = "nm_setting_bluetooth_get_connection_type")]
94 #[doc(alias = "get_connection_type")]
95 pub fn connection_type(&self) -> glib::GString {
96 unsafe {
97 from_glib_none(ffi::nm_setting_bluetooth_get_connection_type(self.to_glib_none().0))
98 }
99 }
100
101 pub fn set_bdaddr(&self, bdaddr: Option<&str>) {
103 ObjectExt::set_property(self,"bdaddr", bdaddr)
104 }
105
106 #[doc(alias = "type")]
109 pub fn type_(&self) -> Option<glib::GString> {
110 ObjectExt::property(self, "type")
111 }
112
113 #[doc(alias = "type")]
116 pub fn set_type(&self, type_: Option<&str>) {
117 ObjectExt::set_property(self,"type", type_)
118 }
119
120 #[doc(alias = "bdaddr")]
121 pub fn connect_bdaddr_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
122 unsafe extern "C" fn notify_bdaddr_trampoline<F: Fn(&SettingBluetooth) + 'static>(this: *mut ffi::NMSettingBluetooth, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
123 let f: &F = &*(f as *const F);
124 f(&from_glib_borrow(this))
125 }
126 unsafe {
127 let f: Box_<F> = Box_::new(f);
128 connect_raw(self.as_ptr() as *mut _, c"notify::bdaddr".as_ptr() as *const _,
129 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_bdaddr_trampoline::<F> as *const ())), Box_::into_raw(f))
130 }
131 }
132
133 #[doc(alias = "type")]
134 pub fn connect_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
135 unsafe extern "C" fn notify_type_trampoline<F: Fn(&SettingBluetooth) + 'static>(this: *mut ffi::NMSettingBluetooth, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
136 let f: &F = &*(f as *const F);
137 f(&from_glib_borrow(this))
138 }
139 unsafe {
140 let f: Box_<F> = Box_::new(f);
141 connect_raw(self.as_ptr() as *mut _, c"notify::type".as_ptr() as *const _,
142 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_type_trampoline::<F> as *const ())), Box_::into_raw(f))
143 }
144 }
145}
146
147impl Default for SettingBluetooth {
148 fn default() -> Self {
149 Self::new()
150 }
151 }
152
153#[must_use = "The builder must be built to be used"]
158pub struct SettingBluetoothBuilder {
159 builder: glib::object::ObjectBuilder<'static, SettingBluetooth>,
160 }
161
162 impl SettingBluetoothBuilder {
163 fn new() -> Self {
164 Self { builder: glib::object::Object::builder() }
165 }
166
167 pub fn bdaddr(self, bdaddr: impl Into<glib::GString>) -> Self {
169 Self { builder: self.builder.property("bdaddr", bdaddr.into()), }
170 }
171
172 pub fn type_(self, type_: impl Into<glib::GString>) -> Self {
173 Self { builder: self.builder.property("type", type_.into()), }
174 }
175
176 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
179 pub fn build(self) -> SettingBluetooth {
180assert_initialized_main_thread!();
181 self.builder.build() }
182}