Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh icons of playing stations #131

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Services/Favicon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public class Tuner.Favicon : GLib.Object {
* @brief Asynchronously load the favicon for a given station
*
* This method attempts to load the favicon from the cache first. If not found in the cache
* or if forceReload is true, it will fetch the favicon from the internet asynchronously.
* or if forceReload is true, it will fetch the favicon from the internet asynchronously
* scale it to 48x48 pixels, and save it to a cache file.
*
* @param station The station for which to load the favicon
* @param forceReload If true, bypass the cache and fetch the favicon from the internet
Expand Down
6 changes: 4 additions & 2 deletions src/Widgets/HeaderBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,19 @@ public class Tuner.HeaderBar : Gtk.HeaderBar {
/**
* @brief Load and display the favicon for a station.
*
* This method asynchronously loads the favicon for the given station and updates the favicon image.
* This method asynchronously loads the favicon anew for
* the given station and updates the favicon image.
*
* @param station The station whose favicon should be loaded.
*/
private void load_favicon(Model.Station station)
{
Favicon.load_async.begin (station, false, (favicon, res) => {
Favicon.load_async.begin (station, true, (favicon, res) => {
var pxbuf = Favicon.load_async.end (res);
if (pxbuf != null) {
this.favicon.set_from_pixbuf (pxbuf);
} else {
// If favicon is not available, use default icon
this.favicon.set_from_icon_name (DEFAULT_ICON_NAME, Gtk.IconSize.DIALOG);
}
this.favicon.set_size_request (48, 48);
Expand Down