comparison src/pixbuf_util.c @ 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 f879e7d94c6d
children 956aab097ea7
comparison
equal deleted inserted replaced
1457:5c0ecb2ebbc5 1458:dc406812db14
12 12
13 13
14 #include "main.h" 14 #include "main.h"
15 #include "pixbuf_util.h" 15 #include "pixbuf_util.h"
16 #include "exif.h" 16 #include "exif.h"
17 #include "ui_fileops.h"
17 18
18 #include "icons/icons_inline.h" 19 #include "icons/icons_inline.h"
19 20
20 #include <math.h> 21 #include <math.h>
21 22
176 &error); 177 &error);
177 if (!pixbuf) 178 if (!pixbuf)
178 { 179 {
179 if (error) 180 if (error)
180 { 181 {
181 DEBUG_1("Couldn't load icon: %s", error->message); 182 DEBUG_1("Couldn't load icon %s: %s", icon, error->message);
182 g_error_free(error); 183 g_error_free(error);
183 } 184 error = NULL;
184 return FALSE; 185 }
185 } 186
187 if (strchr(icon, '.'))
188 {
189 /* try again without extension */
190 gchar *icon2 = remove_extension_from_path(icon);
191 pixbuf = gtk_icon_theme_load_icon(icon_theme,
192 icon2, /* icon name */
193 64, /* size */
194 0, /* flags */
195 &error);
196 if (error)
197 {
198 DEBUG_1("Couldn't load icon %s: %s", icon2, error->message);
199 g_error_free(error);
200 }
201 g_free(icon2);
202 }
203 }
204
205 if (!pixbuf) return FALSE;
186 206
187 register_stock_icon(key, pixbuf); 207 register_stock_icon(key, pixbuf);
188 return TRUE; 208 return TRUE;
189 } 209 }
190 210