feat: Add wifi and bluetooth device switching

This commit is contained in:
Fabio Lenherr / DashieTM 2023-12-03 19:08:07 +01:00
parent b2b4ae0661
commit 959d1e735f
8 changed files with 281 additions and 101 deletions

View file

@ -1,12 +1,12 @@
use adw::ActionRow;
use adw::{ActionRow, ComboRow};
use dbus::Path;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use gtk::{glib, CompositeTemplate, ListBox, Switch};
use gtk::{prelude::*, StringList};
use std::cell::RefCell;
use std::collections::HashMap;
use std::sync::Arc;
use ReSet_Lib::bluetooth::bluetooth::BluetoothDevice;
use std::sync::{Arc, RwLock};
use ReSet_Lib::bluetooth::bluetooth::{BluetoothAdapter, BluetoothDevice};
use crate::components::base::listEntry::ListEntry;
use crate::components::bluetooth::bluetoothBox;
@ -24,6 +24,8 @@ pub struct BluetoothBox {
#[template_child]
pub resetBluetoothAvailableDevices: TemplateChild<ListBox>,
#[template_child]
pub resetBluetoothAdapter: TemplateChild<ComboRow>,
#[template_child]
pub resetBluetoothConnectedDevices: TemplateChild<ListBox>,
#[template_child]
pub resetVisibility: TemplateChild<ActionRow>,
@ -31,6 +33,10 @@ pub struct BluetoothBox {
pub resetBluetoothMainTab: TemplateChild<ListEntry>,
pub availableDevices: BluetoothMap,
pub connectedDevices: BluetoothMap,
pub resetBluetoothAdapters: Arc<RwLock<HashMap<String, (BluetoothAdapter, u32)>>>,
pub resetCurrentBluetoothAdapter: Arc<RefCell<BluetoothAdapter>>,
pub resetModelList: Arc<RwLock<StringList>>,
pub resetModelIndex: Arc<RwLock<u32>>,
}
#[glib::object_subclass]