Optimize out icon_overridden

There is no need save if the icon field should have precedence, as
setting raw_icon to NULL emphasizes the same.

Also freeing raw_icon saves unneccessary memory.
This commit is contained in:
Benedikt Heine 2017-10-29 13:42:25 +01:00
parent 13ed6301d8
commit 23cae3110d
3 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,6 @@ typedef struct _notification {
char *appname;
char *summary;
char *body;
bool icon_overridden;
char *icon;
RawImage *raw_icon;
char *msg; /* formatted message */

View File

@ -25,7 +25,8 @@ void rule_apply(rule_t *r, notification *n)
if (r->new_icon) {
g_free(n->icon);
n->icon = g_strdup(r->new_icon);
n->icon_overridden = true;
rawimage_free(n->raw_icon);
n->raw_icon = NULL;
}
if (r->fg)
n->color_strings[ColFG] = r->fg;

View File

@ -425,7 +425,7 @@ static colored_layout *r_init_shared(cairo_t *c, notification *n)
GdkPixbuf *pixbuf = NULL;
if (n->raw_icon && !n->icon_overridden &&
if (n->raw_icon &&
settings.icon_position != icons_off) {
pixbuf = get_pixbuf_from_raw_image(n->raw_icon);