Compare commits

...

2 commits

2 changed files with 8 additions and 15 deletions

View file

@ -26,9 +26,9 @@ fn main() {
let output = command.output().unwrap(); let output = command.output().unwrap();
assert!( assert!(
output.status.success(), output.status.success(),
"blueprint-compiler failed with exit status {} and stderr:\n{}", "blueprint-compiler failed with exit status {} and stdout:\n{}",
output.status, output.status,
String::from_utf8_lossy(&output.stderr) String::from_utf8_lossy(&output.stdout)
); );
println!("cargo::rerun-if-changed=resources"); println!("cargo::rerun-if-changed=resources");

View file

@ -64,6 +64,7 @@ mod imp {
mpv.observe_property(2, "pause").unwrap(); mpv.observe_property(2, "pause").unwrap();
mpv.observe_property(3, "playlist-pos").unwrap(); mpv.observe_property(3, "playlist-pos").unwrap();
mpv.observe_property(4, "idle-active").unwrap(); mpv.observe_property(4, "idle-active").unwrap();
mpv.observe_property(5, "time-pos").unwrap();
// "Useful to drain property changes before a new file is loaded." // "Useful to drain property changes before a new file is loaded."
mpv.add_hook(0, "on_before_start_file", 0).unwrap(); mpv.add_hook(0, "on_before_start_file", 0).unwrap();
@ -147,6 +148,11 @@ mod imp {
window.notify("idle-active"); window.notify("idle-active");
} }
5 => {
assert_eq!(event.name, "time-pos");
window.notify("time-pos");
}
_ => unreachable!(), _ => unreachable!(),
}, },
@ -245,19 +251,6 @@ mod imp {
.await .await
.expect("could not register name in session bus"); .expect("could not register name in session bus");
}); });
// notify of new time-pos every 100 ms
glib::source::timeout_add_local(std::time::Duration::from_millis(100), {
let window = self.obj().downgrade();
move || {
let window = match window.upgrade() {
None => return glib::ControlFlow::Break,
Some(window) => window,
};
window.notify("time-pos");
glib::ControlFlow::Continue
}
});
} }
} }