summaryrefslogtreecommitdiff
path: root/src/up-device.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-14 14:27:48 +0200
committerBastien Nocera <hadess@hadess.net>2013-10-14 14:27:48 +0200
commit77c3278ff525edf30e2e7adb417a8944b59ccefa (patch)
treeb9d8b263f50eee07c07a9e24a2d5bea73a5652da /src/up-device.c
parentac1708e86e0f87c25e5cf7e11a82324c5d002fba (diff)
downloadupower-77c3278ff525edf30e2e7adb417a8944b59ccefa.tar.gz
daemon: Move all computations of warning level to daemon
There's no reason why the state check should be done in the UpDevice implementation, and the state will be needed to add a new warning level for UPSes.
Diffstat (limited to 'src/up-device.c')
-rw-r--r--src/up-device.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/up-device.c b/src/up-device.c
index c51e7d7..371dcb9 100644
--- a/src/up-device.c
+++ b/src/up-device.c
@@ -180,14 +180,12 @@ update_warning_level (UpDevice *device)
{
UpDeviceLevel warning_level;
- if (device->priv->state != UP_DEVICE_STATE_DISCHARGING)
- warning_level = UP_DEVICE_LEVEL_NONE;
- else
- warning_level = up_daemon_compute_warning_level (device->priv->daemon,
- device->priv->type,
- device->priv->power_supply,
- device->priv->percentage,
- device->priv->time_to_empty);
+ warning_level = up_daemon_compute_warning_level (device->priv->daemon,
+ device->priv->state,
+ device->priv->type,
+ device->priv->power_supply,
+ device->priv->percentage,
+ device->priv->time_to_empty);
if (warning_level == device->priv->warning_level)
return;