From 1b8a59bef59f1283964ba97139dbf30de41b3087 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Sun, 3 Nov 2024 19:27:22 +0100 Subject: [PATCH] im so close --- src/ui/playbar.rs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/ui/playbar.rs b/src/ui/playbar.rs index c3c06f1..c994f05 100644 --- a/src/ui/playbar.rs +++ b/src/ui/playbar.rs @@ -14,8 +14,6 @@ mod imp { song: RefCell>, #[property(get, set)] playing_cover_art: RefCell>, - #[property(get, set)] - playbin: WeakRef, #[property(get, set, default = true)] show_cover_art: Cell, @@ -76,20 +74,21 @@ mod imp { #[template_callback] fn playbin_active(&self, state: crate::playbin::State) -> bool { - state != crate::playbin::State::Stopped + true // TODO } #[template_callback] fn can_press_play(&self, state: crate::playbin::State, n_items: u32) -> bool { - !(state == crate::playbin::State::Stopped && n_items == 0) + true // TODO } #[template_callback] fn play_pause_icon_name(&self, state: crate::playbin::State) -> &'static str { + /* match state { crate::playbin::State::Playing => "media-playback-pause", _ => "media-playback-start", - } + }*/todo!() } #[template_callback] @@ -108,56 +107,62 @@ mod imp { value: f64, range: >k::Range, ) -> bool { + /* let playbin = self.playbin.upgrade().unwrap(); if range.adjustment().lower() < range.adjustment().upper() { playbin.seek(value); } - false + false*/todo!() } #[template_callback] fn on_skip_forward_clicked(&self) { + /* let playbin = self.playbin.upgrade().unwrap(); - playbin.go_to_next_track(); + playbin.go_to_next_track();*/todo!() } #[template_callback] fn on_skip_backward_clicked(&self) { + /* let playbin = self.playbin.upgrade().unwrap(); - playbin.go_to_prev_track(); + playbin.go_to_prev_track();*/todo!() } #[template_callback] fn seek_backward(&self) { + /* let playbin = self.playbin.upgrade().unwrap(); // 10 seconds let mut new_position = playbin.position() - 10.0; if new_position < 0.0 { new_position = 0.0; } - playbin.seek(new_position); + playbin.seek(new_position);*/todo!() } #[template_callback] fn seek_forward(&self) { + /* let playbin = self.playbin.upgrade().unwrap(); // 10 seconds let mut new_position = playbin.position() + 10.0; if new_position > playbin.duration() { new_position = playbin.duration(); } - playbin.seek(new_position); + playbin.seek(new_position);*/todo!() } #[template_callback] fn on_play_pause_clicked(&self, _button: >k::Button) { + /* let playbin = self.playbin.upgrade().unwrap(); if playbin.state() == crate::playbin::State::Playing { playbin.pause(); } else { playbin.play(); - } + }*/todo!() } #[template_callback]