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:
parent
13ed6301d8
commit
23cae3110d
@ -33,7 +33,6 @@ typedef struct _notification {
|
|||||||
char *appname;
|
char *appname;
|
||||||
char *summary;
|
char *summary;
|
||||||
char *body;
|
char *body;
|
||||||
bool icon_overridden;
|
|
||||||
char *icon;
|
char *icon;
|
||||||
RawImage *raw_icon;
|
RawImage *raw_icon;
|
||||||
char *msg; /* formatted message */
|
char *msg; /* formatted message */
|
||||||
|
@ -25,7 +25,8 @@ void rule_apply(rule_t *r, notification *n)
|
|||||||
if (r->new_icon) {
|
if (r->new_icon) {
|
||||||
g_free(n->icon);
|
g_free(n->icon);
|
||||||
n->icon = g_strdup(r->new_icon);
|
n->icon = g_strdup(r->new_icon);
|
||||||
n->icon_overridden = true;
|
rawimage_free(n->raw_icon);
|
||||||
|
n->raw_icon = NULL;
|
||||||
}
|
}
|
||||||
if (r->fg)
|
if (r->fg)
|
||||||
n->color_strings[ColFG] = r->fg;
|
n->color_strings[ColFG] = r->fg;
|
||||||
|
@ -425,7 +425,7 @@ static colored_layout *r_init_shared(cairo_t *c, notification *n)
|
|||||||
|
|
||||||
GdkPixbuf *pixbuf = NULL;
|
GdkPixbuf *pixbuf = NULL;
|
||||||
|
|
||||||
if (n->raw_icon && !n->icon_overridden &&
|
if (n->raw_icon &&
|
||||||
settings.icon_position != icons_off) {
|
settings.icon_position != icons_off) {
|
||||||
|
|
||||||
pixbuf = get_pixbuf_from_raw_image(n->raw_icon);
|
pixbuf = get_pixbuf_from_raw_image(n->raw_icon);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user