mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-25 20:37:24 +02:00
Fix bug generating multiple playlist items
This commit is contained in:
parent
424c4c57a8
commit
130df0d60e
1 changed files with 1 additions and 20 deletions
|
|
@ -34,7 +34,7 @@ mod imp {
|
|||
pub active: Cell<bool>,
|
||||
#[property(get, set)]
|
||||
pub playing: Cell<bool>,
|
||||
#[property(get, set = Self::set_program)]
|
||||
#[property(get, set)]
|
||||
pub program: RefCell<Option<Program>>,
|
||||
#[property(get, construct_only)]
|
||||
pub playlist: OnceCell<gio::ListStore>,
|
||||
|
|
@ -51,25 +51,6 @@ mod imp {
|
|||
}
|
||||
|
||||
impl Player {
|
||||
pub fn set_program(&self, program: Option<&Program>) {
|
||||
self.program.replace(program.cloned());
|
||||
|
||||
if let Some(program) = program {
|
||||
if !self.obj().active() {
|
||||
match self.obj().generate_items(program) {
|
||||
Ok(index) => {
|
||||
self.obj().set_active(true);
|
||||
self.obj().set_current_index(index);
|
||||
self.obj().pause();
|
||||
}
|
||||
Err(err) => {
|
||||
log::warn!("Failed to play from program: {err:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_current_index(&self, index: u32) {
|
||||
let playlist = self.playlist.get().unwrap();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue