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

New helper function unset_icon_image()

The new function unset_icon_image() removes the RImage and the
file path for a given icon.
This commit is contained in:
Rodolfo García Peñas (kix)
2012-11-03 19:53:54 +01:00
committed by Carlos R. Mafra
parent 0106b2a4e9
commit 2ff138f311

View File

@@ -66,6 +66,7 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon);
static void get_pixmap_icon_from_default_icon(WIcon *icon); static void get_pixmap_icon_from_default_icon(WIcon *icon);
static void icon_update_pixmap(WIcon *icon, RImage *image); static void icon_update_pixmap(WIcon *icon, RImage *image);
static void unset_icon_image(WIcon *icon);
static RImage *get_default_image(WScreen *scr); static RImage *get_default_image(WScreen *scr);
/****** Notification Observers ******/ /****** Notification Observers ******/
@@ -251,11 +252,7 @@ void wIconDestroy(WIcon * icon)
if (icon->pixmap) if (icon->pixmap)
XFreePixmap(dpy, icon->pixmap); XFreePixmap(dpy, icon->pixmap);
if (icon->file) unset_icon_image(icon);
wfree(icon->file);
if (icon->file_image != NULL)
RReleaseImage(icon->file_image);
wCoreDestroy(icon->core); wCoreDestroy(icon->core);
wfree(icon); wfree(icon);
@@ -390,10 +387,7 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
/* New image! */ /* New image! */
if (!error && image) { if (!error && image) {
/* Remove the old one */ /* Remove the old one */
if (icon->file_image) { unset_icon_image(icon);
RReleaseImage(icon->file_image);
icon->file_image = NULL;
}
/* Set the new image */ /* Set the new image */
icon->file_image = image; icon->file_image = image;
@@ -585,6 +579,15 @@ void wIconSelect(WIcon * icon)
} }
} }
static void unset_icon_image(WIcon *icon)
{
if (icon->file)
wfree(icon->file);
if (icon->file_image)
RReleaseImage(icon->file_image);
}
void wIconUpdate(WIcon *icon) void wIconUpdate(WIcon *icon)
{ {
WScreen *scr = icon->core->screen_ptr; WScreen *scr = icon->core->screen_ptr;