refactor: remove dead code and unused imports
This commit is contained in:
parent
0f4667fc47
commit
a046692241
4 changed files with 4 additions and 39 deletions
|
|
@ -11,14 +11,12 @@ use cosmic::{
|
|||
token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate},
|
||||
},
|
||||
cctk::sctk::reexports::calloop,
|
||||
cosmic_theme::Spacing,
|
||||
iced::{
|
||||
platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup},
|
||||
window, Length, Subscription,
|
||||
},
|
||||
iced_runtime::core::layout::Limits,
|
||||
theme,
|
||||
widget::{container, text},
|
||||
widget::container,
|
||||
Element, Task,
|
||||
};
|
||||
use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline};
|
||||
|
|
@ -185,10 +183,6 @@ impl cosmic::Application for CosmicA11yApplet {
|
|||
}
|
||||
|
||||
fn view_window(&self, _id: window::Id) -> Element<Message> {
|
||||
let Spacing {
|
||||
space_xxs, space_s, ..
|
||||
} = theme::active().cosmic().spacing;
|
||||
|
||||
let toggle = padded_control(
|
||||
anim!(
|
||||
//toggler
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ use cosmic::{
|
|||
iced_futures::stream,
|
||||
};
|
||||
use cosmic_dbus_a11y::*;
|
||||
use std::{fmt::Debug, hash::Hash};
|
||||
use std::fmt::Debug;
|
||||
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
|
||||
use zbus::{Connection, Result};
|
||||
use zbus::Connection;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Update {
|
||||
|
|
|
|||
|
|
@ -158,8 +158,6 @@ async fn start_listening(
|
|||
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
|
||||
pub enum BluerRequest {
|
||||
SetBluetoothEnabled(bool),
|
||||
SetPairable(bool),
|
||||
SetDiscoverable(bool),
|
||||
PairDevice(Address),
|
||||
ConnectDevice(Address),
|
||||
DisconnectDevice(Address),
|
||||
|
|
@ -189,8 +187,6 @@ pub enum BluerEvent {
|
|||
pub struct BluerState {
|
||||
pub devices: Vec<BluerDevice>,
|
||||
pub bluetooth_enabled: bool,
|
||||
pub discoverable: bool,
|
||||
pub pairable: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
|
|
@ -335,7 +331,6 @@ pub struct BluerSessionState {
|
|||
_session: Session,
|
||||
_agent_handle: AgentHandle,
|
||||
pub adapter: Adapter,
|
||||
pub devices: Arc<Mutex<Vec<BluerDevice>>>,
|
||||
pub rx: Option<Receiver<BluerSessionEvent>>,
|
||||
pub req_tx: Sender<BluerRequest>,
|
||||
tx: Sender<BluerSessionEvent>,
|
||||
|
|
@ -527,7 +522,6 @@ impl BluerSessionState {
|
|||
_agent_handle,
|
||||
_session: session,
|
||||
adapter,
|
||||
devices: Arc::new(Mutex::new(devices)),
|
||||
rx: Some(rx),
|
||||
req_tx,
|
||||
tx,
|
||||
|
|
@ -554,8 +548,6 @@ impl BluerSessionState {
|
|||
let state = BluerState {
|
||||
devices: build_device_list(&adapter_clone).await,
|
||||
bluetooth_enabled: status,
|
||||
discoverable: adapter_clone.is_discoverable().await.unwrap_or_default(),
|
||||
pairable: adapter_clone.is_pairable().await.unwrap_or_default(),
|
||||
};
|
||||
if state.bluetooth_enabled {
|
||||
for d in &state.devices {
|
||||
|
|
@ -609,11 +601,6 @@ impl BluerSessionState {
|
|||
.is_powered()
|
||||
.await
|
||||
.unwrap_or_default(),
|
||||
discoverable: adapter_clone
|
||||
.is_discoverable()
|
||||
.await
|
||||
.unwrap_or_default(),
|
||||
pairable: adapter_clone.is_pairable().await.unwrap_or_default(),
|
||||
}))
|
||||
.await;
|
||||
// reset timeout
|
||||
|
|
@ -701,25 +688,11 @@ impl BluerSessionState {
|
|||
}
|
||||
}
|
||||
BluerRequest::StateUpdate => {}
|
||||
BluerRequest::SetPairable(enabled) => {
|
||||
let res = adapter_clone.set_pairable(*enabled).await;
|
||||
if let Err(e) = res {
|
||||
err_msg = Some(e.to_string());
|
||||
}
|
||||
}
|
||||
BluerRequest::SetDiscoverable(enabled) => {
|
||||
let res = adapter_clone.set_discoverable(*enabled).await;
|
||||
if let Err(e) = res {
|
||||
err_msg = Some(e.to_string());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let state = BluerState {
|
||||
devices: build_device_list(&adapter_clone).await,
|
||||
bluetooth_enabled: adapter_clone.is_powered().await.unwrap_or_default(),
|
||||
discoverable: adapter_clone.is_discoverable().await.unwrap_or_default(),
|
||||
pairable: adapter_clone.is_pairable().await.unwrap_or_default(),
|
||||
};
|
||||
|
||||
let _ = tx_clone
|
||||
|
|
@ -746,8 +719,6 @@ impl BluerSessionState {
|
|||
devices: build_device_list(&self.adapter).await,
|
||||
// TODO is this a proper way of checking if bluetooth is enabled?
|
||||
bluetooth_enabled: self.adapter.is_powered().await.unwrap_or_default(),
|
||||
discoverable: self.adapter.is_discoverable().await.unwrap_or_default(),
|
||||
pairable: self.adapter.is_pairable().await.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use cosmic::{
|
|||
widget::{
|
||||
container, divider,
|
||||
segmented_button::{self, Entity, SingleSelectModel},
|
||||
segmented_control, spin_button, text,
|
||||
segmented_control, text,
|
||||
},
|
||||
Element,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue