[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Show discharge level even in unknown state (Bug #15280)

noreply at xfce.org noreply at xfce.org
Thu Apr 25 18:03:52 CEST 2019


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

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-power-manager.

commit a6a6b210996a3fd4ef05b3015f8f2edf89399314
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Apr 25 18:03:36 2019 +0200

    Show discharge level even in unknown state (Bug #15280)
    
    Also strip leading/trailing whitespace from vendor and model.
---
 common/xfpm-power-common.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/common/xfpm-power-common.c b/common/xfpm-power-common.c
index 95e64bd..fd525dd 100644
--- a/common/xfpm-power-common.c
+++ b/common/xfpm-power-common.c
@@ -260,8 +260,12 @@ get_device_description (UpClient *upower, UpDevice *device)
 
     if (vendor == NULL)
         vendor = g_strdup ("");
+    else
+        vendor = g_strstrip (vendor);
     if (model == NULL)
         model = g_strdup ("");
+    else
+        model = g_strstrip (model);
 
     /* If we get a vendor or model we can use it, otherwise translate the
      * device type into something readable (works for things like ac_power)
@@ -354,6 +358,12 @@ get_device_description (UpClient *upower, UpDevice *device)
         tip = g_strdup_printf (_("<b>%s %s</b>\nis empty"),
                                vendor, model);
     }
+    else if ( state == UP_DEVICE_STATE_UNKNOWN && percentage != 0.0 )
+    {
+        tip = g_strdup_printf (_("<b>%s %s</b>\nCurrent charge: %0.0f%%"),
+                               vendor, model,
+                               percentage);
+    }
     else
     {
         if (type == UP_DEVICE_KIND_LINE_POWER)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list