From ed1b721a151038ec2756bd95e067bbf356b384b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ab=C3=ADlio=20Costa?= Date: Sat, 9 Mar 2024 18:13:03 +0000 Subject: [PATCH] Fix default mpris icon size (#370) * Fix default mpris icon size The widget was was using the .ui size instead of the user config size in the following situations: - there was no media player app - the media player app icon was used - the audio-x-generic-symbolic icon was used This fix sets the default size for the album art icon according to the user's config. set_from_gicon and set_from_icon_name receive a Gtk.IconSize enum value, not an int, so we need to call set_pixel_size to set the proper size. * Use INVALID for IconSize * Fix lint --- src/controlCenter/widgets/mpris/mpris_player.vala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controlCenter/widgets/mpris/mpris_player.vala b/src/controlCenter/widgets/mpris/mpris_player.vala index 51ed301..50f5cdb 100644 --- a/src/controlCenter/widgets/mpris/mpris_player.vala +++ b/src/controlCenter/widgets/mpris/mpris_player.vala @@ -96,6 +96,7 @@ namespace SwayNotificationCenter.Widgets.Mpris { update_buttons (source.media_player.metadata); }); }); + album_art.set_pixel_size (mpris_config.image_size); } public void before_destroy () { @@ -380,11 +381,11 @@ namespace SwayNotificationCenter.Widgets.Mpris { icon = desktop_entry.get_icon (); } if (icon != null) { - album_art.set_from_gicon (icon, mpris_config.image_size); + album_art.set_from_gicon (icon, Gtk.IconSize.INVALID); } else { // Default icon album_art.set_from_icon_name ("audio-x-generic-symbolic", - mpris_config.image_size); + Gtk.IconSize.INVALID); } }