aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBirdZhang <0312birdzhang@gmail.com>2019-08-29 13:40:58 +0800
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-08-06 15:57:23 +0200
commit9d403329ad1ad1d6ef3acb936e617666aa902a6f (patch)
tree7bf62c2ae4547249ab31c9de580d23f823708dde /src
parent960b4eccb7c66668ab2a2b7e13c22cd6d1a11d41 (diff)
downloadayatana-indicator-power-9d403329ad1ad1d6ef3acb936e617666aa902a6f.tar.gz
ayatana-indicator-power-9d403329ad1ad1d6ef3acb936e617666aa902a6f.tar.bz2
ayatana-indicator-power-9d403329ad1ad1d6ef3acb936e617666aa902a6f.zip
Do not divide by battery size if percent less than 0.01
Diffstat (limited to 'src')
-rw-r--r--src/service.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/service.c b/src/service.c
index 06a74de..be17a55 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1342,10 +1342,12 @@ create_totalled_battery_device (const GList * devices)
const time_t t = indicator_power_device_get_time (walk);
const UpDeviceState state = indicator_power_device_get_state (walk);
- ++n_batteries;
if (percent > 0.01)
- sum_percent += percent;
+ {
+ sum_percent += percent;
+ ++n_batteries;
+ }
if (state == UP_DEVICE_STATE_CHARGING)
{