Compare commits

...

2 commits

Author SHA1 Message Date
2f84c3932b remove that 2024-11-05 06:29:51 +01:00
3f1d899f0b explicitly ignore unknown events 2024-11-05 06:28:48 +01:00
5 changed files with 4 additions and 34 deletions

1
Cargo.lock generated
View file

@ -217,7 +217,6 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
name = "audrey"
version = "0.1.0"
dependencies = [
"async-broadcast",
"async-channel",
"base16ct",
"bindgen",

View file

@ -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"] }

View file

@ -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());
}
});
}

View file

@ -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};

View file

@ -196,6 +196,10 @@ mod imp {
};
}
Event::Unknown(_) => {
// either deprecated or future, ignore
}
_ => event!(Level::DEBUG, "unhandled {event:?}"),
}
}