From c55308b8a7c1f79a8dda062eecf41d3a80a6ee7e Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Fri, 6 Oct 2017 22:14:37 +0300 Subject: [PATCH] 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. --- src/notification.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/notification.c b/src/notification.c index 2b34e10..0733129 100644 --- a/src/notification.c +++ b/src/notification.c @@ -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 {