This is an automated email from the git hooks/post-receive script.

ochosi pushed a 
commit to branch 
master
in repository xfce/xfce4-power-manager.

commit df7c0ae1ea7d7c25e28bbb0b34aba3a9ad2faa05
Author: Simon Steinbeiss <simon.steinbe...@elfenbeinturm.at>
Date:   Sun Nov 10 00:33:58 2019 +0100

    Dismiss critical notification when connecting to AC
    
    We can most likely dismiss the critical notification on all battery state 
changes,
    because if there still is one around it means we just connected to a power 
source
    (critical notifications always get cleared before new ones are spawned).
---
 src/xfpm-notify.c | 10 +++++++---
 src/xfpm-power.c  |  3 +++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/xfpm-notify.c b/src/xfpm-notify.c
index c1845a6..fc19d85 100644
--- a/src/xfpm-notify.c
+++ b/src/xfpm-notify.c
@@ -345,8 +345,9 @@ void xfpm_notify_critical (XfpmNotify *notify, 
NotifyNotification *n)
 
 void xfpm_notify_close_critical (XfpmNotify *notify)
 {
-    g_return_if_fail (XFPM_IS_NOTIFY (notify));
+       GError *error = NULL;
 
+       g_return_if_fail (XFPM_IS_NOTIFY (notify));
 
     if (notify->priv->critical_id != 0)
     {
@@ -356,8 +357,11 @@ void xfpm_notify_close_critical (XfpmNotify *notify)
 
     if ( notify->priv->critical )
     {
-       if (!notify_notification_close (notify->priv->critical, NULL))
-           g_warning ("Failed to close notification\n");
+                       if (!notify_notification_close (notify->priv->critical, 
&error))
+                       {
+                               g_warning ("Failed to close critical 
notification: %s", error->message);
+                               g_error_free (error);
+                       }
 
        g_object_unref (G_OBJECT(notify->priv->critical) );
        notify->priv->critical  = NULL;
diff --git a/src/xfpm-power.c b/src/xfpm-power.c
index ab22a36..4919f47 100644
--- a/src/xfpm-power.c
+++ b/src/xfpm-power.c
@@ -249,6 +249,9 @@ xfpm_power_check_power (XfpmPower *power, gboolean 
on_battery)
 
         xfpm_dpms_set_on_battery (power->priv->dpms, on_battery);
 
+                               /* Dismiss critical notifications on battery 
state changes */
+                               xfpm_notify_close_critical 
(power->priv->notify);
+
            power->priv->on_battery = on_battery;
            list = g_hash_table_get_values (power->priv->hash);
            len = g_list_length (list);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to