From 03c042f51888c4b0235bb226643794120231b673 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Sun, 13 Oct 2024 08:03:05 +0000 Subject: [PATCH] better song labels in play bar --- src/window.blp | 20 +++----------------- src/window.vala | 4 ++++ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/window.blp b/src/window.blp index b3f83b2..e004fb2 100644 --- a/src/window.blp +++ b/src/window.blp @@ -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 ; + ellipsize: end; } } } diff --git a/src/window.vala b/src/window.vala index 3d8254d..c7f60f1 100644 --- a/src/window.vala +++ b/src/window.vala @@ -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)"; + } }