mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-17 06:41:03 +02:00
refactor: replace channel macros with ext trait methods
This commit is contained in:
parent
d5744f597c
commit
f929aef2d9
50 changed files with 658 additions and 476 deletions
|
@ -1,5 +1,6 @@
|
|||
use super::{ArcMutVec, Client, ConnectionState, Event, percent_to_volume, volume_to_percent};
|
||||
use crate::{lock, send};
|
||||
use crate::channels::SyncSenderExt;
|
||||
use crate::lock;
|
||||
use libpulse_binding::callbacks::ListResult;
|
||||
use libpulse_binding::context::Context;
|
||||
use libpulse_binding::context::introspect::SinkInfo;
|
||||
|
@ -62,7 +63,7 @@ impl Client {
|
|||
let ListResult::Item(info) = info else {
|
||||
return;
|
||||
};
|
||||
send!(tx, info.volume);
|
||||
tx.send_expect(info.volume);
|
||||
});
|
||||
|
||||
let new_volume = percent_to_volume(volume_percent);
|
||||
|
@ -129,7 +130,7 @@ pub fn add(info: ListResult<&SinkInfo>, sinks: &ArcMutVec<Sink>, tx: &broadcast:
|
|||
trace!("adding {info:?}");
|
||||
|
||||
lock!(sinks).push(info.into());
|
||||
send!(tx, Event::AddSink(info.into()));
|
||||
tx.send_expect(Event::AddSink(info.into()));
|
||||
}
|
||||
|
||||
fn update(
|
||||
|
@ -170,7 +171,7 @@ fn update(
|
|||
}
|
||||
}
|
||||
|
||||
send!(tx, Event::UpdateSink(sink));
|
||||
tx.send_expect(Event::UpdateSink(sink));
|
||||
}
|
||||
|
||||
fn remove(index: u32, sinks: &ArcMutVec<Sink>, tx: &broadcast::Sender<Event>) {
|
||||
|
@ -180,6 +181,6 @@ fn remove(index: u32, sinks: &ArcMutVec<Sink>, tx: &broadcast::Sender<Event>) {
|
|||
|
||||
if let Some(pos) = sinks.iter().position(|s| s.index == index) {
|
||||
let info = sinks.remove(pos);
|
||||
send!(tx, Event::RemoveSink(info.name));
|
||||
tx.send_expect(Event::RemoveSink(info.name));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue