From 3fcb88c0562725da2cc4874e03c86c563e0e3c16 Mon Sep 17 00:00:00 2001 From: psykose Date: Tue, 19 Nov 2024 14:03:40 +0100 Subject: [PATCH] yeah closes https://git.ddd.rip/zerica/audrey/issues/9 --- src/ui/window.rs | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/src/ui/window.rs b/src/ui/window.rs index 77157ce..97fe106 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -1,8 +1,7 @@ -use crate::model::{Album, Song}; +use crate::model::Song; use crate::{mpris, mpv}; use adw::prelude::*; use adw::subclass::prelude::*; -use futures::TryStreamExt; use glib::subclass::InitializingObject; use glib::JoinHandle; use gtk::{gdk, gio, glib}; @@ -54,9 +53,6 @@ mod imp { #[property(get)] playlist_model: gio::ListStore, - #[property(get)] - albums_model: gio::ListStore, - #[property(type = i64, get = Self::volume, set = Self::set_volume)] _volume: (), #[property(type = bool, get = Self::mute, set = Self::set_mute)] @@ -126,7 +122,6 @@ mod imp { mpv, playlist_model: gio::ListStore::new::(), - albums_model: gio::ListStore::new::(), _volume: (), _mute: (), @@ -798,37 +793,6 @@ mod imp { // cancel queued seek always self.queued_seek.set(None); } - - #[template_callback] - pub(super) async fn on_refresh_albums_clicked(&self) { - self.obj().set_refreshing_albums(true); - self.albums_model.remove_all(); - - let api = Rc::clone(self.api.borrow().as_ref().unwrap()); - let albums_model = self.obj().albums_model().clone(); - let perform = async move { - let mut albums = - std::pin::pin!(api.album_list_full(crate::subsonic::AlbumListType::Newest)); - while let Some(album) = albums.try_next().await? { - albums_model.append( - &glib::Object::builder::() - .property("id", &album.id) - .property("name", &album.name) - .property("artist", &album.artist) - .build(), - ); - } - - Ok::<(), crate::subsonic::Error>(()) - }; - - match perform.await { - Ok(()) => {} - Err(err) => event!(Level::ERROR, "could not refresh album list: {err}"), - } - - self.obj().set_refreshing_albums(false); - } } impl Drop for Window { @@ -904,9 +868,6 @@ impl Window { } self.set_can_click_shuffle_all(true); - - let window = self.clone(); - glib::spawn_future_local(async move { window.imp().on_refresh_albums_clicked().await }); } pub fn playlist_next(&self) {