chore: Code cleanup

This commit is contained in:
Fabio Lenherr / DashieTM 2023-11-19 02:37:11 +01:00
parent 192dacb333
commit cb3dd257f1
22 changed files with 121 additions and 106 deletions

View file

@ -18,7 +18,7 @@ use crate::components::base::listEntry::ListEntry;
use crate::components::base::utils::Listeners;
use crate::components::bluetooth::bluetoothBoxImpl;
use crate::components::bluetooth::bluetoothEntry::BluetoothEntry;
use crate::components::bluetooth::bluetoothEntryImpl::DeviceTypes;
// use crate::components::bluetooth::bluetoothEntryImpl::DeviceTypes;
glib::wrapper! {
pub struct BluetoothBox(ObjectSubclass<bluetoothBoxImpl::BluetoothBox>)
@ -170,7 +170,7 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
loop {
let _ = conn.process(Duration::from_millis(1000));
if !listeners.bluetooth_listener.load(Ordering::SeqCst)
// || time.elapsed().unwrap() > Duration::from_millis(5000)
// || time.elapsed().unwrap() > Duration::from_millis(5000)
{
glib::spawn_future(async move {
glib::idle_add_once(move || {

View file

@ -1,7 +1,7 @@
use std::time::Duration;
use crate::components::bluetooth::bluetoothEntryImpl;
use crate::components::bluetooth::bluetoothEntryImpl::DeviceTypes;
// use crate::components::bluetooth::bluetoothEntryImpl::DeviceTypes;
use adw::glib;
use adw::glib::Object;
use adw::subclass::prelude::ObjectSubclassIsExt;
@ -23,7 +23,10 @@ impl BluetoothEntry {
let entry: BluetoothEntry = Object::builder().build();
let entryImp = entry.imp();
entryImp.resetBluetoothLabel.get().set_text(&device.name);
entryImp.resetBluetoothAddress.get().set_text(&device.address);
entryImp
.resetBluetoothAddress
.get()
.set_text(&device.address);
// entryImp
// .resetBluetoothDeviceType
// .get()

View file

@ -1,8 +1,8 @@
use crate::components::bluetooth::bluetoothEntry;
use gtk::subclass::prelude::*;
use gtk::{glib, Button, CompositeTemplate, Image, Label};
use std::cell::RefCell;
use ReSet_Lib::bluetooth::bluetooth::BluetoothDevice;
use gtk::{Button, CompositeTemplate, glib, Image, Label};
use gtk::subclass::prelude::*;
use crate::components::bluetooth::bluetoothEntry;
#[derive(Default, Copy, Clone)]
pub enum DeviceTypes {
@ -26,7 +26,7 @@ pub struct BluetoothEntry {
#[template_child]
pub resetBluetoothButton: TemplateChild<Button>,
pub deviceName: RefCell<String>,
pub device: RefCell<BluetoothDevice>
pub device: RefCell<BluetoothDevice>,
}
#[glib::object_subclass]

View file

@ -1,5 +1,6 @@
#![allow(non_snake_case)]
pub mod bluetoothBox;
pub mod bluetoothEntry;
pub mod bluetoothBoxImpl;
pub mod bluetoothEntryImpl;
pub mod bluetoothEntry;
pub mod bluetoothEntryImpl;