From ce37a46b0f208fc85bdaf299c42d1101406cfd26 Mon Sep 17 00:00:00 2001 From: Eizen Date: Wed, 18 Jan 2017 01:06:27 -0300 Subject: [PATCH] Fix svg icons and free call Now looks properly in folder for svg icons. Also g_free should be used for maybe_icon_path. --- src/x.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/x.c b/src/x.c index 4316853..a145848 100644 --- a/src/x.c +++ b/src/x.c @@ -340,13 +340,18 @@ static GdkPixbuf *get_pixbuf_from_path(char *icon_path) if (end == NULL) end = strchr(settings.icon_folders, '\0'); /* end = end of string */ current_folder = strndup(start, end - start); - maybe_icon_path = g_strconcat(current_folder, "/", icon_path, ".png", NULL); + /* try svg */ + maybe_icon_path = g_strconcat(current_folder, "/", icon_path, ".svg", NULL); + if (maybe_icon_path == NULL) { + /* fallback to png */ + maybe_icon_path = g_strconcat(current_folder, "/", icon_path, ".png", NULL); + } free(current_folder); pixbuf = get_pixbuf_from_file(maybe_icon_path); - free(maybe_icon_path); + g_free(maybe_icon_path); if (pixbuf != NULL) { - return pixbuf; + return pixbuf; } start = end + 1;