diff --git a/src/ui/window.rs b/src/ui/window.rs index a63e478..e89e8f7 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -64,6 +64,7 @@ mod imp { mpv.observe_property(2, "pause").unwrap(); mpv.observe_property(3, "playlist-pos").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." mpv.add_hook(0, "on_before_start_file", 0).unwrap(); @@ -147,6 +148,11 @@ mod imp { window.notify("idle-active"); } + 5 => { + assert_eq!(event.name, "time-pos"); + window.notify("time-pos"); + } + _ => unreachable!(), }, @@ -245,19 +251,6 @@ mod imp { .await .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 - } - }); } }