chore: Code cleanup

This commit is contained in:
Fabio Lenherr 2023-12-01 14:31:14 +01:00
parent f8c27fd498
commit 921d5e7fe6
27 changed files with 304 additions and 234 deletions

View file

@ -122,13 +122,12 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
let device_changed_box = bluetooth_box.clone();
let loop_box = bluetooth_box.clone();
// TODO handle device changed
let res = conn.add_match(device_added, move |ir: BluetoothDeviceAdded, _, _| {
let bluetooth_box = device_added_box.clone();
println!("added");
glib::spawn_future(async move {
glib::idle_add_once(move || {
println!("{}",ir.bluetooth_device.icon);
println!("{}", ir.bluetooth_device.icon);
let imp = bluetooth_box.imp();
let path = ir.bluetooth_device.path.clone();
let connected = ir.bluetooth_device.connected;

View file

@ -17,13 +17,19 @@ glib::wrapper! {
@implements gtk::Accessible, gtk::Buildable, gtk::Actionable, gtk::ConstraintTarget;
}
unsafe impl Send for BluetoothEntry {}
unsafe impl Sync for BluetoothEntry {}
impl BluetoothEntry {
pub fn new(device: &BluetoothDevice) -> Self {
let entry: BluetoothEntry = Object::builder().build();
let entryImp = entry.imp();
entryImp.resetBluetoothLabel.get().set_text(&device.alias);
entryImp.resetBluetoothAddress.get().set_text(&device.address);
if device.icon == "" {
entryImp
.resetBluetoothAddress
.get()
.set_text(&device.address);
if device.icon.is_empty() {
entryImp
.resetBluetoothDeviceType
.set_icon_name(Some("dialog-question-symbolic"));

View file

@ -3,4 +3,3 @@ pub mod bluetoothBox;
pub mod bluetoothBoxImpl;
pub mod bluetoothEntry;
pub mod bluetoothEntryImpl;