carousel loading sizing

This commit is contained in:
Erica Z 2024-12-04 08:28:37 +01:00
parent 15670baf33
commit fd9e76a75c
2 changed files with 9 additions and 2 deletions

View file

@ -96,6 +96,10 @@ gridview.albums child image {
box-shadow: oklch(0 0 0 / 0.25) 0px 0px 3px;
}
.album-carousel.loading listview {
opacity: 0%;
}
.album-carousel .labels {
border-radius: 3px;
}

View file

@ -116,7 +116,7 @@ mod imp {
pub fn update_model(&self) {
self.scroll_animation().pause();
self.model().remove_all();
self.obj().add_css_class("loading");
let api = self.client.borrow();
let api = match api.as_ref() {
@ -135,7 +135,7 @@ mod imp {
};
let handle = glib::spawn_future_local(async move {
let album_list = match api.album_list(&type_, 50, 0).await {
let album_list = match api.album_list(&type_, 14, 0).await {
Ok(album_list) => album_list,
Err(err) => {
event!(Level::ERROR, "could not fetch albums for carousel: {}", err);
@ -144,12 +144,15 @@ mod imp {
};
let carousel = carousel.upgrade().unwrap();
carousel.imp().model().remove_all();
for album in album_list {
carousel
.imp()
.model()
.append(&crate::model::Album::from_api(&album));
}
carousel.remove_css_class("loading");
});
if let Some(previous_handle) = self.update_handle.replace(Some(handle)) {