Move lower to load_icon phase
This commit is contained in:
parent
8e6cbc1021
commit
43500a9983
|
@ -77,6 +77,7 @@ static bool image_load_icon(Gtk::Image& image, Glib::RefPtr<Gtk::IconTheme> icon
|
||||||
const std::string &app_id_list, int size)
|
const std::string &app_id_list, int size)
|
||||||
{
|
{
|
||||||
std::string app_id;
|
std::string app_id;
|
||||||
|
std::string lower_app_id;
|
||||||
std::istringstream stream(app_id_list);
|
std::istringstream stream(app_id_list);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
@ -85,10 +86,18 @@ static bool image_load_icon(Gtk::Image& image, Glib::RefPtr<Gtk::IconTheme> icon
|
||||||
* send a single app-id, but in any case this works fine */
|
* send a single app-id, but in any case this works fine */
|
||||||
while (stream >> app_id)
|
while (stream >> app_id)
|
||||||
{
|
{
|
||||||
|
std::transform(app_id.begin(), app_id.end(), lower_app_id.begin(),
|
||||||
|
[](char c){ return std::tolower(c); });
|
||||||
std::string icon_name = get_from_icon_theme(icon_theme, app_id);
|
std::string icon_name = get_from_icon_theme(icon_theme, app_id);
|
||||||
|
if (icon_name.empty())
|
||||||
|
icon_name = get_from_icon_theme(icon_theme, lower_app_id);
|
||||||
|
|
||||||
if (icon_name.empty())
|
if (icon_name.empty())
|
||||||
icon_name = get_from_desktop_app_info(app_id);
|
icon_name = get_from_desktop_app_info(app_id);
|
||||||
|
|
||||||
|
if (icon_name.empty())
|
||||||
|
icon_name = get_from_desktop_app_info(lower_app_id);
|
||||||
|
|
||||||
if (icon_name.empty())
|
if (icon_name.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -271,8 +280,6 @@ void Task::handle_title(const char *title)
|
||||||
void Task::handle_app_id(const char *app_id)
|
void Task::handle_app_id(const char *app_id)
|
||||||
{
|
{
|
||||||
app_id_ = app_id;
|
app_id_ = app_id;
|
||||||
std::transform(app_id_.begin(), app_id_.end(), app_id_.begin(),
|
|
||||||
[](char c){ return std::tolower(c); });
|
|
||||||
if (!image_load_icon(icon_, tbar_->icon_theme(), app_id_,
|
if (!image_load_icon(icon_, tbar_->icon_theme(), app_id_,
|
||||||
config_["icon-size"].isInt() ? config_["icon-size"].asInt() : 16))
|
config_["icon-size"].isInt() ? config_["icon-size"].asInt() : 16))
|
||||||
spdlog::warn("Failed to load icon for {}", app_id);
|
spdlog::warn("Failed to load icon for {}", app_id);
|
||||||
|
|
Loading…
Reference in New Issue