1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 22:52:34 +01:00

wIconChangeImageFile removed dup code

This patch removes the dup code with get_rimage_from_file.
This commit is contained in:
Rodolfo García Peñas (kix)
2012-10-31 22:44:18 +01:00
committed by Carlos R. Mafra
parent 156d8ebfa5
commit 3d0223ded4

View File

@@ -369,10 +369,9 @@ RImage *wIconValidateIconSize(RImage *icon, int max_size)
return icon; return icon;
} }
Bool wIconChangeImageFile(WIcon * icon, char *file) Bool wIconChangeImageFile(WIcon *icon, char *file)
{ {
WScreen *scr = icon->core->screen_ptr; WScreen *scr = icon->core->screen_ptr;
RImage *image;
char *path; char *path;
int error = 0; int error = 0;
@@ -385,16 +384,19 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
} }
path = FindImage(wPreferences.icon_path, file); path = FindImage(wPreferences.icon_path, file);
if (path) {
if (path && (image = RLoadImage(scr->rcontext, path, 0))) { icon->file_image = get_rimage_from_file(scr, path, wPreferences.icon_size);
icon->file_image = wIconValidateIconSize(image, wPreferences.icon_size); if (icon->file_image) {
icon->file = wstrdup(path);
wIconUpdate(icon); wIconUpdate(icon);
} else { } else {
error = 1; error = 1;
} }
if (path)
wfree(path); wfree(path);
} else {
error = 1;
}
return !error; return !error;
} }