$OpenBSD: patch-libgnome_gnome-dentry_c,v 1.4 2007/06/01 16:44:41 jasper Exp $
--- libgnome/gnome-dentry.c.orig	Wed Aug  7 00:57:14 2002
+++ libgnome/gnome-dentry.c	Fri Jun  1 18:38:20 2007
@@ -88,7 +88,7 @@ add_comment_or_name(GList *list, char *lang, char *nam
 
 /*read the names and comments from the desktop file*/
 static GList *
-read_names_and_comments(const char *file, int is_kde)
+read_names_and_comments(const char *file, int is_old_kde)
 {
 	GList *i18n_list = NULL;
 	
@@ -97,11 +97,11 @@ read_names_and_comments(const char *file, int is_kde)
 	char *prefix;
 	
 	gnome_config_push_prefix ("");
-	if(!is_kde) {
-		prefix = g_strconcat ("=", file, "=/Desktop Entry", NULL);
-	} else {
-		prefix = g_strconcat ("=", file, "=/KDE Desktop Entry", NULL);
-	}
+        if(!is_old_kde) {
+                prefix = g_strconcat ("=", file, "=/Desktop Entry", NULL);
+        } else {
+                prefix = g_strconcat ("=", file, "=/KDE Desktop Entry", NULL);
+        }
 	iterator = gnome_config_init_iterator(prefix);
 	g_free(prefix);
 	gnome_config_pop_prefix ();
@@ -155,7 +155,7 @@ gnome_desktop_entry_load_flags_conditional (const char
 	int exec_length;
 	char *icon_base;
 	char *p = NULL;
-	gboolean is_kde = FALSE;
+	gboolean is_old_kde = FALSE;
  	gboolean is_dot_directory = FALSE;
 #ifdef __GLIBC__
 	gboolean is_utf8;
@@ -178,8 +178,8 @@ gnome_desktop_entry_load_flags_conditional (const char
 		gnome_config_push_prefix (prefix);
 		g_free (prefix);
 
-		is_kde = TRUE;
-
+		is_old_kde = TRUE;
+		
 		name = gnome_config_get_translated_string ("Name");
 		if (!name) {
 			gnome_config_pop_prefix ();
@@ -197,7 +197,8 @@ gnome_desktop_entry_load_flags_conditional (const char
 	    strcmp (file + strlen (file) - strlen (".directory"), ".directory") == 0)
 		is_dot_directory = TRUE;
 	
-	type      = gnome_config_get_string (is_dot_directory ? "Type=Directory" : "Type");
+	if( !(type = gnome_config_get_string ("Type") ) )
+ 	    type = gnome_config_get_string ("Type=Directory");
 	gnome_config_get_vector ("Exec", &exec_length, &exec_vector);
 	try_file  = gnome_config_get_string ("TryExec");
 
@@ -249,15 +250,21 @@ gnome_desktop_entry_load_flags_conditional (const char
 	newitem->geometry      = gnome_config_get_string ("Geometry");
 	newitem->multiple_args = gnome_config_get_bool   ("MultipleArgs=0");
 	newitem->location      = g_strdup (file);
-	newitem->is_kde       =  is_kde;
 
 	icon_base              = gnome_config_get_string ("Icon");
 
 	if (icon_base && *icon_base) {
 		/* Sigh, now we need to make them local to the gnome install */
 		if (*icon_base != '/') {
-			if (newitem->is_kde) {
-				gchar *iconname = g_concat_dir_and_file (KDE_ICONDIR, icon_base);
+		        /*
+			   HACK: determine if file is an KDE desktop entry.
+			   KDE desktop files don't have the file-extension embedded in icon_base.
+			*/
+		        if( !strstr( icon_base, "." ) ) {
+			        gchar *icon_base_full = g_strconcat (icon_base, ".png", NULL);
+				gchar *iconname = g_concat_dir_and_file (KDE_ICONDIR, icon_base_full);
+			        newitem->is_kde = TRUE;
+				g_free (icon_base_full);
 				if (g_file_exists (iconname))
 					newitem->icon = iconname;
 				else {
@@ -293,7 +300,7 @@ gnome_desktop_entry_load_flags_conditional (const char
 	gnome_config_pop_prefix ();
 
 	/*get us the Names and comments of different languages*/
-	i18n_list = read_names_and_comments (file, is_kde);
+	i18n_list = read_names_and_comments (file, is_old_kde);
 	gnome_desktop_entry_set_i18n_list (newitem, i18n_list);
 	
 	if (clean_from_memory_after_load) {
