Package: openbox-menu
Version: 0.8.0+hg20161009-3.1
Severity: minor
Tags: patch

Dear fellow developer,

openbox-menu contains a few lines of code to remove file extensions in icon names found in desktop files. It removes everything after the last dot, which prevents gtk_icon_theme_lookup_icon() to find an icon if its name contains a dot, which is the case in more and more applications, for example nearly all GNOME applications, Remmina, Wireshark or even XTerm.

Moreover, it seems that nowadays gtk_icon_theme_lookup_icon() is perfectly capable to retrieve icons which contain a file extension.

The provided patch removes the few lines of code which remove file extensions before the gtk_icon_theme_lookup_icon() query, allowing openbox-menu to correctly retrieve all icons.

Regards,

--
Raphaël Halimi
Description: Don't remove file extensions in icon names
 It seems that nowadays gtk_icon_theme_lookup_icon() is perfectly capable to
 retrieve icons which contain a file extension, so removing them is not needed
 anymore. Removing everything after the last dot prevented to find icons which
 contained a dot in their name, and more packages have such icons  for example
 nearly all GNOME applications, Remmina, Wireshark or even XTerm. 
Author: Raphaël Halimi <raphael.hal...@gmail.com>
Last-Update: 2022-09-24
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/utils.c
+++ b/src/utils.c
@@ -189,7 +189,6 @@
 {
 	GtkIconInfo *icon_info = NULL;
 	gchar *icon = NULL;
-	gchar *tmp_name = NULL;
 
 	const gchar *name = menu_cache_item_get_icon (MENU_CACHE_ITEM(item));
 
@@ -198,16 +197,11 @@
 		if (g_path_is_absolute (name))
 			return g_strdup (name);
 
-		/*  We remove the file extension as gtk_icon_theme_lookup_icon can't
-		 *  lookup a theme icon for, ie, 'geany.png'. It has to be 'geany'.
-		 */
-		tmp_name = strndup (name, strrchr (name, '.') - name);
 	#ifdef WITH_SVG
-		icon_info = gtk_icon_theme_lookup_icon (icon_theme, tmp_name, 16, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+		icon_info = gtk_icon_theme_lookup_icon (icon_theme, name, 16, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
 	#else
-		icon_info = gtk_icon_theme_lookup_icon (icon_theme, tmp_name, 16, GTK_ICON_LOOKUP_NO_SVG | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+		icon_info = gtk_icon_theme_lookup_icon (icon_theme, name, 16, GTK_ICON_LOOKUP_NO_SVG | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
 	#endif
-		g_free (tmp_name);
 	}
 
 	if (!icon_info) /* 2nd fallback */

Reply via email to