Icon: Replace code by call to helper function in wIconCreateWithIconFile
authorRodolfo García Peñas (kix) <kix@kix.es>
Mon, 1 Oct 2012 20:49:30 +0000 (1 22:49 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Sat, 6 Oct 2012 14:32:29 +0000 (6 15:32 +0100)
Code in the function wIconCreateWithIconFile does the same task as
get_default_icon_rimage(), therefore replace it with a call to that
function.

It is the code to get the image file (rimage) using the file name.

src/icon.c

index d929a8c..a940123 100644 (file)
@@ -156,14 +156,8 @@ WIcon *wIconCreateWithIconFile(WScreen *scr, char *iconfile, int tile)
 
        icon = wIconCreateCore(scr, 0, 0);
 
-       if (iconfile) {
-               icon->file_image = RLoadImage(scr->rcontext, iconfile, 0);
-               if (!icon->file_image)
-                       wwarning(_("error loading image file \"%s\": %s"), iconfile, RMessageForError(RErrorCode));
-
-               icon->file_image = wIconValidateIconSize(icon->file_image, wPreferences.icon_size);
-               icon->file = wstrdup(iconfile);
-       }
+       icon->file_image = get_default_icon_rimage(scr, iconfile, wPreferences.icon_size);
+       icon->file = wstrdup(iconfile);
 
        icon->tile_type = tile;