[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 05/12: Fix loading incorrect icons for some applications.

noreply at xfce.org noreply at xfce.org
Wed Mar 11 13:58:03 CET 2020


This is an automated email from the git hooks/post-receive script.

g   o   t   t   c   o   d   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       a   n   n   o   t   a   t   e   d       t   a   g       v   2   .   4   .   3   
   in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 59c53da23205ad5efd5266baa3d9fb087a5c5ca2
Author: Graeme Gott <graeme at gottcode.org>
Date:   Fri Feb 21 08:57:23 2020 -0500

    Fix loading incorrect icons for some applications.
---
 panel-plugin/category.cpp |  2 +-
 panel-plugin/element.cpp  | 10 ++++++----
 panel-plugin/element.h    |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/panel-plugin/category.cpp b/panel-plugin/category.cpp
index 4128394..0a150ad 100644
--- a/panel-plugin/category.cpp
+++ b/panel-plugin/category.cpp
@@ -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 : "");
 }
diff --git a/panel-plugin/element.cpp b/panel-plugin/element.cpp
index 744627a..de71b6d 100644
--- a/panel-plugin/element.cpp
+++ b/panel-plugin/element.cpp
@@ -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);
 		}
diff --git a/panel-plugin/element.h b/panel-plugin/element.h
index 44ed537..1bb8c67 100644
--- a/panel-plugin/element.h
+++ b/panel-plugin/element.h
@@ -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)
 	{

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list