mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2026-01-11 13:36:43 +01: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::SinkInputInfo;
|
||||
|
|
@ -49,7 +50,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);
|
||||
|
|
@ -118,7 +119,7 @@ pub fn add(
|
|||
trace!("adding {info:?}");
|
||||
|
||||
lock!(inputs).push(info.into());
|
||||
send!(tx, Event::AddInput(info.into()));
|
||||
tx.send_expect(Event::AddInput(info.into()));
|
||||
}
|
||||
|
||||
fn update(
|
||||
|
|
@ -142,7 +143,7 @@ fn update(
|
|||
inputs[pos] = info.into();
|
||||
}
|
||||
|
||||
send!(tx, Event::UpdateInput(info.into()));
|
||||
tx.send_expect(Event::UpdateInput(info.into()));
|
||||
}
|
||||
|
||||
fn remove(index: u32, inputs: &ArcMutVec<SinkInput>, tx: &broadcast::Sender<Event>) {
|
||||
|
|
@ -152,6 +153,6 @@ fn remove(index: u32, inputs: &ArcMutVec<SinkInput>, tx: &broadcast::Sender<Even
|
|||
|
||||
if let Some(pos) = inputs.iter().position(|s| s.index == index) {
|
||||
let info = inputs.remove(pos);
|
||||
send!(tx, Event::RemoveInput(info.index));
|
||||
tx.send_expect(Event::RemoveInput(info.index));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue