From 3d0223ded4979c3d347baa0999573f8651766b0d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Wed, 31 Oct 2012 22:44:18 +0100 Subject: [PATCH] wIconChangeImageFile removed dup code This patch removes the dup code with get_rimage_from_file. --- src/icon.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/icon.c b/src/icon.c index 94d95670..0b95df25 100644 --- a/src/icon.c +++ b/src/icon.c @@ -369,10 +369,9 @@ RImage *wIconValidateIconSize(RImage *icon, int max_size) return icon; } -Bool wIconChangeImageFile(WIcon * icon, char *file) +Bool wIconChangeImageFile(WIcon *icon, char *file) { WScreen *scr = icon->core->screen_ptr; - RImage *image; char *path; int error = 0; @@ -385,17 +384,20 @@ Bool wIconChangeImageFile(WIcon * icon, char *file) } path = FindImage(wPreferences.icon_path, file); + if (path) { + icon->file_image = get_rimage_from_file(scr, path, wPreferences.icon_size); + if (icon->file_image) { + icon->file = wstrdup(path); + wIconUpdate(icon); + } else { + error = 1; + } - if (path && (image = RLoadImage(scr->rcontext, path, 0))) { - icon->file_image = wIconValidateIconSize(image, wPreferences.icon_size); - wIconUpdate(icon); + wfree(path); } else { error = 1; } - if (path) - wfree(path); - return !error; } -- 2.11.4.GIT