Compare commits
2 commits
f15019f49d
...
2f84c3932b
Author | SHA1 | Date | |
---|---|---|---|
2f84c3932b | |||
3f1d899f0b |
5 changed files with 4 additions and 34 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -217,7 +217,6 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||
name = "audrey"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-broadcast",
|
||||
"async-channel",
|
||||
"base16ct",
|
||||
"bindgen",
|
||||
|
|
|
@ -5,7 +5,6 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
adw = { version = "0.7.0", package = "libadwaita", features = ["v1_6"] }
|
||||
async-broadcast = "0.7.1"
|
||||
async-channel = "2.3.1"
|
||||
base16ct = { version = "0.2.0", features = ["std"] }
|
||||
chrono = { version = "0.4.38", features = ["serde"] }
|
||||
|
|
29
src/event.rs
29
src/event.rs
|
@ -1,29 +0,0 @@
|
|||
#[derive(Clone, Debug)]
|
||||
pub enum Event {
|
||||
PlaybinVolumeChanged,
|
||||
PlaybinMutedChanged,
|
||||
PlaybinPausedChanged,
|
||||
PlaybinCurrentEntryChanged,
|
||||
|
||||
PlaybinEntryInserted(usize),
|
||||
PlaybinStopped,
|
||||
PlaybinEntryRemoved(usize),
|
||||
|
||||
PlaybinFileStarted,
|
||||
}
|
||||
|
||||
use adw::prelude::*;
|
||||
use gtk::glib;
|
||||
|
||||
pub fn spawn_object_listener<O: IsA<glib::Object>>(
|
||||
mut receiver: async_broadcast::Receiver<Event>,
|
||||
obj: &O,
|
||||
mut f: impl FnMut(O, Event) + 'static,
|
||||
) {
|
||||
let weak = obj.downgrade();
|
||||
glib::spawn_future_local(async move {
|
||||
while let Some(obj) = weak.upgrade() {
|
||||
f(obj, receiver.recv_direct().await.unwrap());
|
||||
}
|
||||
});
|
||||
}
|
|
@ -16,9 +16,6 @@ pub use playbin_song::Song as PlaybinSong;
|
|||
|
||||
pub mod subsonic;
|
||||
|
||||
pub mod event;
|
||||
pub use event::Event;
|
||||
|
||||
use gettextrs::{bind_textdomain_codeset, bindtextdomain, setlocale, textdomain, LocaleCategory};
|
||||
use gtk::prelude::*;
|
||||
use gtk::{gio, glib};
|
||||
|
|
|
@ -196,6 +196,10 @@ mod imp {
|
|||
};
|
||||
}
|
||||
|
||||
Event::Unknown(_) => {
|
||||
// either deprecated or future, ignore
|
||||
}
|
||||
|
||||
_ => event!(Level::DEBUG, "unhandled {event:?}"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue