Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #186 from progandy/master
Browse files Browse the repository at this point in the history
allow file:// protocol for icons
  • Loading branch information
knopwob committed Jul 29, 2014
2 parents 6f3bd10 + 84fcd78 commit 088cfe1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion x.c
Expand Up @@ -276,7 +276,14 @@ static dimension_t calculate_dimensions(GSList *layouts)
static cairo_surface_t *get_icon_surface(char *icon_path)
{
cairo_surface_t *icon_surface = NULL;
gchar *uri_path = NULL;
if (strlen(icon_path) > 0 && settings.icon_position != icons_off) {
if (g_str_has_prefix(icon_path, "file://")) {
uri_path = g_filename_from_uri(icon_path, NULL, NULL);
if (uri_path != NULL) {
icon_path = uri_path;
}
}
/* absolute path? */
if (icon_path[0] == '/' || icon_path[0] == '~') {
icon_surface = cairo_image_surface_create_from_png(icon_path);
Expand Down Expand Up @@ -309,9 +316,13 @@ static cairo_surface_t *get_icon_surface(char *icon_path)
start = end + 1;
} while (*(end) != '\0');
}
if (icon_surface == NULL)
if (icon_surface == NULL) {
fprintf(stderr,
"Could not load icon: '%s'\n", icon_path);
}
if (uri_path != NULL) {
g_free(uri_path);
}
}
return icon_surface;
}
Expand Down

0 comments on commit 088cfe1

Please sign in to comment.