Fix svg icons and free call
Now looks properly in folder for svg icons. Also g_free should be used for maybe_icon_path.
This commit is contained in:
parent
c4a002bc79
commit
ce37a46b0f
7
src/x.c
7
src/x.c
@ -340,11 +340,16 @@ static GdkPixbuf *get_pixbuf_from_path(char *icon_path)
|
|||||||
if (end == NULL) end = strchr(settings.icon_folders, '\0'); /* end = end of string */
|
if (end == NULL) end = strchr(settings.icon_folders, '\0'); /* end = end of string */
|
||||||
|
|
||||||
current_folder = strndup(start, end - start);
|
current_folder = strndup(start, end - start);
|
||||||
|
/* 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);
|
maybe_icon_path = g_strconcat(current_folder, "/", icon_path, ".png", NULL);
|
||||||
|
}
|
||||||
free(current_folder);
|
free(current_folder);
|
||||||
|
|
||||||
pixbuf = get_pixbuf_from_file(maybe_icon_path);
|
pixbuf = get_pixbuf_from_file(maybe_icon_path);
|
||||||
free(maybe_icon_path);
|
g_free(maybe_icon_path);
|
||||||
if (pixbuf != NULL) {
|
if (pixbuf != NULL) {
|
||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user