feat: Add bluetooth changed event

This commit is contained in:
Fabio Lenherr / DashieTM 2023-11-30 17:36:37 +01:00
parent ba49da2317
commit f8c27fd498
6 changed files with 91 additions and 57 deletions

View file

@ -1,3 +1,4 @@
use adw::ActionRow;
use dbus::Path;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
@ -5,12 +6,15 @@ use gtk::{glib, CompositeTemplate, ListBox, Switch};
use std::cell::RefCell;
use std::collections::HashMap;
use std::sync::Arc;
use adw::ActionRow;
use ReSet_Lib::bluetooth::bluetooth::BluetoothDevice;
use crate::components::base::listEntry::ListEntry;
use crate::components::bluetooth::bluetoothBox;
use crate::components::bluetooth::bluetoothEntry::BluetoothEntry;
type BluetoothMap =
RefCell<HashMap<Path<'static>, (Arc<BluetoothEntry>, Arc<ListEntry>, BluetoothDevice)>>;
#[allow(non_snake_case)]
#[derive(Default, CompositeTemplate)]
#[template(resource = "/org/Xetibo/ReSet/resetBluetooth.ui")]
@ -25,8 +29,8 @@ pub struct BluetoothBox {
pub resetVisibility: TemplateChild<ActionRow>,
#[template_child]
pub resetBluetoothMainTab: TemplateChild<ListEntry>,
pub availableDevices: RefCell<HashMap<Path<'static>, (Arc<BluetoothEntry>, Arc<ListEntry>)>>,
pub connectedDevices: RefCell<HashMap<Path<'static>, (Arc<BluetoothEntry>, Arc<ListEntry>)>>,
pub availableDevices: BluetoothMap,
pub connectedDevices: BluetoothMap,
}
#[glib::object_subclass]