better song labels in play bar

This commit is contained in:
Erica Z 2024-10-13 08:03:05 +00:00
parent 8f0da45a63
commit 03c042f518
2 changed files with 7 additions and 17 deletions

View file

@ -101,29 +101,15 @@ paintable: bind template.playing_cover_art;
styles [ "heading" ]
halign: start;
label: bind template.song as <$Song>.title;
ellipsize: end;
}
Box {
halign: start;
Label {
styles [ "caption" ]
label: bind template.song as <$Song>.artist;
}
Label {
styles [ "caption" ]
label: " - ";
}
Label {
styles [ "caption" ]
label: bind template.song as <$Song>.album;
}
Label {
styles [ "caption" ]
label: " - ";
}
Label {
styles [ "caption" ]
label: bind template.song as <$Song>.year;
label: bind $format_song_below_title (template.song) as <string>;
ellipsize: end;
}
}
}

View file

@ -200,4 +200,8 @@ class Window : Adw.ApplicationWindow {
[GtkCallback] private void show_setup_dialog () {
this.setup.present (this);
}
[GtkCallback] private string format_song_below_title (Song? song) {
return song == null ? "" : @"$(song.artist) - $(song.album) - $(song.year)";
}
}