Skip to content

Commit

Permalink
fixed loading of desktop file icons, gtk seems to expect an icon name…
Browse files Browse the repository at this point in the history
… without extension
  • Loading branch information
nadvornik committed Mar 17, 2009
1 parent 8b21951 commit 4bb3d0e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/pixbuf_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "main.h"
#include "pixbuf_util.h"
#include "exif.h"
#include "ui_fileops.h"

#include "icons/icons_inline.h"

Expand Down Expand Up @@ -178,11 +179,30 @@ gboolean register_theme_icon_as_stock(const gchar *key, const gchar *icon)
{
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;
}

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);
}
return FALSE;
}

if (!pixbuf) return FALSE;

register_stock_icon(key, pixbuf);
return TRUE;
Expand Down

0 comments on commit 4bb3d0e

Please sign in to comment.