Merge pull request #121 from OldMan2525/main

Use bundled icons when theme icons are too small
This commit is contained in:
Alexander Shaduri
2026-07-08 20:57:37 +02:00
committed by GitHub
+9 -1
View File
@@ -554,10 +554,18 @@ Glib::RefPtr<Gdk::Pixbuf> GscMainWindowIconView::load_icon_pixbuf(Glib::RefPtr<G
{
Glib::RefPtr<Gdk::Pixbuf> icon;
// Try XDG version first
// Try the icon theme first; fall back to the bundled icon if needed.
try {
if (default_icon_theme && !xdg_icon_name.empty()) {
icon = default_icon_theme->load_icon(xdg_icon_name, icon_size_, get_scale_factor(), Gtk::IconLookupFlags(0));
// Some icon themes may return an icon smaller than requested.
// In that case, fall back to the bundled icon.
if (icon &&
(icon->get_width() < icon_size_ ||
icon->get_height() < icon_size_)) {
icon.reset();
}
}
} catch (...) { } // ignore exceptions