Initialize icons before parsing the format

Since the format supports flags for including the icon name in the
notification the icon should be initialized first (and set to the
default if not set) in order for the flag to function properly.
This commit is contained in:
Nikos Tsipinakis 2017-10-06 22:14:37 +03:00
parent 0a3298dde4
commit c55308b8a7

View File

@ -316,6 +316,15 @@ int notification_init(notification *n, int id)
rule_apply_all(n);
if (n->icon != NULL && strlen(n->icon) <= 0) {
g_free(n->icon);
n->icon = NULL;
}
if (n->raw_icon == NULL && n->icon == NULL) {
n->icon = g_strdup(settings.icons[n->urgency]);
}
n->urls = notification_extract_markup_urls(&(n->body));
n->msg = string_replace_all("\\n", "\n", g_strdup(n->format));
@ -416,15 +425,6 @@ int notification_init(notification *n, int id)
n->msg = buffer;
}
if (n->icon != NULL && strlen(n->icon) <= 0) {
g_free(n->icon);
n->icon = NULL;
}
if (n->raw_icon == NULL && n->icon == NULL) {
n->icon = g_strdup(settings.icons[n->urgency]);
}
if (id == 0) {
n->id = ++next_notification_id;
} else {