Skip to content

Commit

Permalink
Update HeaderBar.vala
Browse files Browse the repository at this point in the history
Refresh cached favicon, otherwise use the cahced ico
  • Loading branch information
technosf authored Oct 14, 2024
1 parent f6cb437 commit 64208ce
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Widgets/HeaderBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,26 @@ public class Tuner.HeaderBar : Gtk.HeaderBar {
*
* This method asynchronously loads the favicon anew for
* the given station and updates the favicon image.
* If the favicon is not available, it will load cached
* favicon or use the default icon.
*
* @param station The station whose favicon should be loaded.
*/
private void load_favicon(Model.Station station)
{
this.favicon.clear ();

Favicon.load_async.begin (station, true, (favicon, res) => {
var pxbuf = Favicon.load_async.end (res);
if (pxbuf != null) {
this.favicon.set_from_pixbuf (pxbuf);
this.favicon.set_size_request (48, 48);
return;
}
});

// If favicon is not available, use cached favicon or default icon
Favicon.load_async.begin (station, false, (favicon, res) => {
var pxbuf = Favicon.load_async.end (res);
if (pxbuf != null) {
this.favicon.set_from_pixbuf (pxbuf);
Expand All @@ -280,4 +293,4 @@ public class Tuner.HeaderBar : Gtk.HeaderBar {
this.favicon.set_size_request (48, 48);
});
}
}
}

0 comments on commit 64208ce

Please sign in to comment.