1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-09-18 12:46:58 +02:00

refactor(networkmanager): rename DeviceStateChanged event to DeviceChanged

Also add a little TODO about icon order.
This commit is contained in:
Reinout Meliesie 2025-09-02 22:44:14 +02:00
commit 4c516a1c2a
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
3 changed files with 15 additions and 15 deletions

View file

@ -2,10 +2,10 @@ use crate::clients::networkmanager::dbus::{DeviceState, DeviceType};
#[derive(Debug, Clone)]
pub enum ClientToModuleEvent {
DeviceStateChanged {
DeviceChanged {
interface: String,
r#type: DeviceType,
state: DeviceState,
new_state: DeviceState,
},
DeviceRemoved {
interface: String,

View file

@ -118,14 +118,13 @@ async fn handle_received_events(
for device_path in devices_snapshot {
let device = DeviceDbusProxy::new(&dbus_connection, device_path).await?;
// TODO: Create DeviceDbusProxy -> DeviceStateChanged function and use it in the watcher as well
let interface = device.interface().await?.to_string();
let r#type = device.device_type().await?;
let state = device.state().await?;
controller_sender.send(ClientToModuleEvent::DeviceStateChanged {
let new_state = device.state().await?;
controller_sender.send(ClientToModuleEvent::DeviceChanged {
interface,
r#type,
state,
new_state,
})?;
}
}
@ -163,20 +162,20 @@ async fn watch_device_state(
let r#type = device.device_type().await?;
// Send an event communicating the initial state
let state = device.state().await?;
controller_sender.send(ClientToModuleEvent::DeviceStateChanged {
let new_state = device.state().await?;
controller_sender.send(ClientToModuleEvent::DeviceChanged {
interface: interface.to_string(),
r#type: r#type.clone(),
state,
new_state,
})?;
let mut state_changes = device.receive_state_changed().await;
while let Some(state_change) = state_changes.next().await {
let state = state_change.get().await?;
controller_sender.send(ClientToModuleEvent::DeviceStateChanged {
let new_state = state_change.get().await?;
controller_sender.send(ClientToModuleEvent::DeviceChanged {
interface: interface.to_string(),
r#type: r#type.clone(),
state,
new_state,
})?;
}