1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 23:01:04 +02:00

refactor: replace channel macros with ext trait methods

This commit is contained in:
Jake Stanger 2025-05-18 15:17:09 +01:00
parent d5744f597c
commit f929aef2d9
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
50 changed files with 658 additions and 476 deletions

View file

@ -1,6 +1,7 @@
use super::{MusicClient, PlayerState, PlayerUpdate, Status, TICK_INTERVAL_MS, Track};
use crate::channels::SyncSenderExt;
use crate::clients::music::ProgressTick;
use crate::{arc_mut, lock, send, spawn_blocking};
use crate::{arc_mut, lock, spawn_blocking};
use color_eyre::Result;
use mpris::{DBusError, Event, Metadata, PlaybackStatus, Player, PlayerFinder};
use std::cmp;
@ -137,7 +138,7 @@ impl Client {
let mut players_locked = lock!(players);
players_locked.remove(identity);
if players_locked.is_empty() {
send!(tx, PlayerUpdate::Update(Box::new(None), Status::default()));
tx.send_expect(PlayerUpdate::Update(Box::new(None), Status::default()));
}
};
@ -212,7 +213,7 @@ impl Client {
let track = Track::from(metadata);
let player_update = PlayerUpdate::Update(Box::new(Some(track)), status);
send!(tx, player_update);
tx.send_expect(player_update);
Ok(())
}
@ -242,7 +243,7 @@ impl Client {
duration: metadata.length(),
});
send!(tx, update);
tx.send_expect(update);
}
}
}
@ -327,7 +328,9 @@ impl MusicClient for Client {
state: PlayerState::Stopped,
volume_percent: None,
};
send!(self.tx, PlayerUpdate::Update(Box::new(None), status));
self.tx
.send_expect(PlayerUpdate::Update(Box::new(None), status));
}
rx