Commit 02903f3a authored by Graeme Gott's avatar Graeme Gott

Fix loading incorrect icons for some applications.

parent f074d786
......@@ -49,7 +49,7 @@ Category::Category(GarconMenu* menu) :
{
text = _("All Applications");
}
set_icon(!exo_str_is_empty(icon) ? icon : "applications-other");
set_icon(!exo_str_is_empty(icon) ? icon : "applications-other", true);
set_text(text ? text : "");
set_tooltip(tooltip ? tooltip : "");
}
......
......@@ -21,7 +21,7 @@ using namespace WhiskerMenu;
//-----------------------------------------------------------------------------
void Element::set_icon(const gchar* icon)
void Element::set_icon(const gchar* icon, bool use_fallbacks)
{
if (m_icon)
{
......@@ -34,12 +34,14 @@ void Element::set_icon(const gchar* icon)
return;
}
auto themed_icon_new = use_fallbacks ? &g_themed_icon_new_with_default_fallbacks : &g_themed_icon_new;
if (!g_path_is_absolute(icon))
{
const gchar* pos = g_strrstr(icon, ".");
if (!pos)
{
m_icon = g_themed_icon_new_with_default_fallbacks(icon);
m_icon = themed_icon_new(icon);
}
else
{
......@@ -50,12 +52,12 @@ void Element::set_icon(const gchar* icon)
|| (g_strcmp0(suffix, ".svgz") == 0))
{
gchar* name = g_strndup(icon, pos - icon);
m_icon = g_themed_icon_new_with_default_fallbacks(name);
m_icon = themed_icon_new(name);
g_free(name);
}
else
{
m_icon = g_themed_icon_new_with_default_fallbacks(icon);
m_icon = themed_icon_new(icon);
}
g_free(suffix);
}
......
......@@ -79,7 +79,7 @@ public:
protected:
Element() = default;
void set_icon(const gchar* icon);
void set_icon(const gchar* icon, bool use_fallbacks = false);
void set_text(const gchar* text)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment