mirror of
https://github.com/labwc/labwc.git
synced 2025-10-31 22:25:34 -04:00
icon-loader: support absolute icon names
This commit is contained in:
parent
be5472a840
commit
3394f191a4
1 changed files with 14 additions and 1 deletions
|
|
@ -118,7 +118,20 @@ out:
|
|||
static int
|
||||
process_abs_name(struct icon_ctx *ctx, const char *icon_name)
|
||||
{
|
||||
wlr_log(WLR_ERROR, "absolute paths not yet supported");
|
||||
ctx->path = xstrdup(icon_name);
|
||||
if (str_endswith(icon_name, ".png")) {
|
||||
ctx->format = SFDO_ICON_FILE_FORMAT_PNG;
|
||||
} else if (str_endswith(icon_name, ".svg")) {
|
||||
ctx->format = SFDO_ICON_FILE_FORMAT_SVG;
|
||||
} else if (str_endswith(icon_name, ".xpm")) {
|
||||
ctx->format = SFDO_ICON_FILE_FORMAT_XPM;
|
||||
} else {
|
||||
goto err;
|
||||
}
|
||||
return 0;
|
||||
err:
|
||||
wlr_log(WLR_ERROR, "'%s' has invalid file extension", icon_name);
|
||||
free(ctx->path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue