sanity check
This commit is contained in:
parent
b7f42bce44
commit
224a7ff3dc
1 changed files with 25 additions and 10 deletions
|
@ -25,8 +25,8 @@ mod imp {
|
||||||
#[property(get, set, nullable)]
|
#[property(get, set, nullable)]
|
||||||
playing_cover_art: RefCell<Option<gdk::Paintable>>,
|
playing_cover_art: RefCell<Option<gdk::Paintable>>,
|
||||||
|
|
||||||
#[property(get, set, nullable)]
|
#[property(type = Option<PlaybinSong>, get = Self::song, nullable)]
|
||||||
song: RefCell<Option<PlaybinSong>>,
|
_song: (),
|
||||||
|
|
||||||
pub(super) setup: crate::ui::Setup,
|
pub(super) setup: crate::ui::Setup,
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ mod imp {
|
||||||
play_queue: Default::default(),
|
play_queue: Default::default(),
|
||||||
can_click_shuffle_all: Cell::new(false),
|
can_click_shuffle_all: Cell::new(false),
|
||||||
playing_cover_art: Default::default(),
|
playing_cover_art: Default::default(),
|
||||||
song: Default::default(),
|
_song: (),
|
||||||
setup: Default::default(),
|
setup: Default::default(),
|
||||||
api: Default::default(),
|
api: Default::default(),
|
||||||
mpv,
|
mpv,
|
||||||
|
@ -139,14 +139,14 @@ mod imp {
|
||||||
},
|
},
|
||||||
|
|
||||||
Event::StartFile(_) => {
|
Event::StartFile(_) => {
|
||||||
let song: PlaybinSong = window
|
window.notify("song");
|
||||||
.playlist_model()
|
|
||||||
.item(window.playlist_pos() as u32)
|
|
||||||
.unwrap()
|
|
||||||
.dynamic_cast()
|
|
||||||
.unwrap();
|
|
||||||
window.set_song(Some(&song));
|
|
||||||
// TODO: load cover art
|
// TODO: load cover art
|
||||||
|
|
||||||
|
// sanity check
|
||||||
|
assert_eq!(
|
||||||
|
window.song().unwrap().stream_url(),
|
||||||
|
window.imp().mpv.get_property::<String>("path").unwrap()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::Hook(event) => match event.reply_userdata {
|
Event::Hook(event) => match event.reply_userdata {
|
||||||
|
@ -298,6 +298,21 @@ mod imp {
|
||||||
}
|
}
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn song(&self) -> Option<PlaybinSong> {
|
||||||
|
if self.obj().playlist_pos() < 0 {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(
|
||||||
|
self.obj()
|
||||||
|
.playlist_model()
|
||||||
|
.item(self.obj().playlist_pos() as u32)
|
||||||
|
.unwrap()
|
||||||
|
.dynamic_cast()
|
||||||
|
.unwrap(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Window {
|
impl Drop for Window {
|
||||||
|
|
Loading…
Reference in a new issue