changeset 1458:dc406812db14

fixed loading of desktop file icons, gtk seems to expect an icon name without extension
author nadvornik
date Tue, 17 Mar 2009 19:52:56 +0000
parents 5c0ecb2ebbc5
children 8c7bb5c1fb9c
files src/pixbuf_util.c
diffstat 1 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/pixbuf_util.c	Tue Mar 17 19:09:34 2009 +0000
+++ b/src/pixbuf_util.c	Tue Mar 17 19:52:56 2009 +0000
@@ -14,6 +14,7 @@
 #include "main.h"
 #include "pixbuf_util.h"
 #include "exif.h"
+#include "ui_fileops.h"
 
 #include "icons/icons_inline.h"
 
@@ -178,11 +179,30 @@
 		{
 		if (error)
 			{
-			DEBUG_1("Couldn't load icon: %s", error->message);
+			DEBUG_1("Couldn't load icon %s: %s", icon, error->message);
 			g_error_free(error);
+			error = NULL;
 			}
-		return FALSE;
+			
+		if (strchr(icon, '.'))
+			{
+			/* try again without extension */
+			gchar *icon2 = remove_extension_from_path(icon);
+			pixbuf = gtk_icon_theme_load_icon(icon_theme,
+		                           icon2, /* icon name */
+		                           64, /* size */
+		                           0,  /* flags */
+		                           &error);
+			if (error)
+				{
+				DEBUG_1("Couldn't load icon %s: %s", icon2, error->message);
+				g_error_free(error);
+				}
+			g_free(icon2);
+			}
 		}
+
+	if (!pixbuf) return FALSE;
 	
 	register_stock_icon(key, pixbuf);
 	return TRUE;