From 5cb31809d9cdb3ae2438c98808bb8dc5734ad807 Mon Sep 17 00:00:00 2001 From: Lukas K Date: Sat, 21 Mar 2020 16:19:27 +0100 Subject: [PATCH] backlight: always update notification --- src/xfpm-backlight.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/xfpm-backlight.c b/src/xfpm-backlight.c index 1c49562a..33925815 100644 --- a/src/xfpm-backlight.c +++ b/src/xfpm-backlight.c @@ -156,20 +156,27 @@ static void xfpm_backlight_show_notification (XfpmBacklight *backlight, gfloat value) { gchar *summary; + /* generate a human-readable summary for the notification */ + summary = g_strdup_printf (_("Brightness: %.0f percent"), value); /* create the notification on demand */ if ( backlight->priv->n == NULL ) { - /* generate a human-readable summary for the notification */ - summary = g_strdup_printf (_("Brightness: %.0f percent"), value); backlight->priv->n = xfpm_notify_new_notification (backlight->priv->notify, _("Power Manager"), summary, XFPM_DISPLAY_BRIGHTNESS_ICON, 0, XFPM_NOTIFY_NORMAL); - g_free (summary); } + else + { + notify_notification_update (backlight->priv->n, + _("Power Manager"), + summary, + XFPM_DISPLAY_BRIGHTNESS_ICON); + } + g_free (summary); /* add the brightness value to the notification */ notify_notification_set_hint (backlight->priv->n, "value", g_variant_new_int32 (value)); -- 2.25.1