sni: Use the given pixmap even if there is a name given

pull/1627/head
Marvin Dostal 2022-07-17 13:34:01 +02:00
parent 1116ff0d67
commit fc9a390977
1 changed files with 3 additions and 2 deletions

View File

@ -319,14 +319,15 @@ void Item::updateImage() {
Glib::RefPtr<Gdk::Pixbuf> Item::getIconPixbuf() { Glib::RefPtr<Gdk::Pixbuf> Item::getIconPixbuf() {
try { try {
if (icon_pixmap) {
return icon_pixmap;
}
if (!icon_name.empty()) { if (!icon_name.empty()) {
std::ifstream temp(icon_name); std::ifstream temp(icon_name);
if (temp.is_open()) { if (temp.is_open()) {
return Gdk::Pixbuf::create_from_file(icon_name); return Gdk::Pixbuf::create_from_file(icon_name);
} }
return getIconByName(icon_name, getScaledIconSize()); return getIconByName(icon_name, getScaledIconSize());
} else if (icon_pixmap) {
return icon_pixmap;
} }
} catch (Glib::Error& e) { } catch (Glib::Error& e) {
spdlog::error("Item '{}': {}", id, static_cast<std::string>(e.what())); spdlog::error("Item '{}': {}", id, static_cast<std::string>(e.what()));