mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-09-24 21:05:38 +00:00
Merge pull request #121 from OldMan2525/main
Use bundled icons when theme icons are too small
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user