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