From f2f6c67383c908e910d63454d419ae44e9bee8b8 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Mon, 4 Nov 2024 12:37:46 +0100 Subject: [PATCH] playlist remove --- src/ui/play_queue/song.rs | 5 +---- src/ui/window.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ui/play_queue/song.rs b/src/ui/play_queue/song.rs index 91fbd33..ad1e9a5 100644 --- a/src/ui/play_queue/song.rs +++ b/src/ui/play_queue/song.rs @@ -60,13 +60,10 @@ mod imp { #[weak(rename_to = self_)] self, move |_, _, _| { - /* self_ .obj() .window() - .playbin() - .remove_entry(self_.obj().displayed_position() as usize - 1)*/ - todo!() + .playlist_remove(self_.obj().position() as i64) } )) .build(); diff --git a/src/ui/window.rs b/src/ui/window.rs index 1670bc8..a037363 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -396,4 +396,12 @@ impl Window { .command(["playlist-play-index", &index.to_string()]) .unwrap(); } + + pub fn playlist_remove(&self, index: i64) { + self.imp() + .mpv + .command(["playlist-remove", &index.to_string()]) + .unwrap(); + self.playlist_model().remove(index as u32); + } }