diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-10-18 17:34:31 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2013-10-18 17:34:31 +0200 |
commit | b90ade819ab5debeb92d1b646ab418df9faba4d9 (patch) | |
tree | f60f644dd66b15e2a4d1b9931b425e675e03c8cf /src | |
parent | 7fcce9156723b4f120442ae961660b9c1cd0aa76 (diff) | |
download | upower-b90ade819ab5debeb92d1b646ab418df9faba4d9.tar.gz |
daemon: Fix WarningLevel for devices with no "time to empty"
As can happen with missing metadata, we might not have a time
to empty, so rely on the percentage instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/up-daemon.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/up-daemon.c b/src/up-daemon.c index 611a25b..799e651 100644 --- a/src/up-daemon.c +++ b/src/up-daemon.c @@ -816,7 +816,9 @@ up_daemon_compute_warning_level (UpDaemon *daemon, default_level = UP_DEVICE_LEVEL_DISCHARGING; } - if (!power_supply || !daemon->priv->use_percentage_for_policy) + if (power_supply && + !daemon->priv->use_percentage_for_policy && + time_to_empty > 0.0) use_percentage = FALSE; if (use_percentage) { |