INNER CODE UNIT · Rust

preview_video

abenz1267/walker · src/preview/mod.rs:451

    fn preview_video(&self, file_path: &str) -> Result<(), Box<dyn std::error::Error>> {
        // Cancel previous load
        if let Some(c) = self.current_video_cancellable.borrow_mut().take() {
            c.cancel();
        }

        let cancellable = Cancellable::new();
        *self.current_video_cancellable.borrow_mut() = Some(cancellable.clone());

        let scrolled = self.get_or_create_scrolled();
        scrolled.set_size_request(128, 72);

        // Properly cleanup existing child
        if let Some(existing_child) = scrolled.child() {
            if let Some(video) = existing_child.downcast_ref::<Video>() {
                video.set_file(None::<&gio::File>);
            }
            scrolled.set_child(None::<gtk4::Widget>.as_ref());

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…