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" ] styles [ "heading" ]
halign: start; halign: start;
label: bind template.song as <$Song>.title; label: bind template.song as <$Song>.title;
ellipsize: end;
} }
Box { Box {
halign: start; halign: start;
Label { Label {
styles [ "caption" ] styles [ "caption" ]
label: bind template.song as <$Song>.artist; label: bind $format_song_below_title (template.song) as <string>;
} ellipsize: end;
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;
} }
} }
} }

View file

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