diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-10-14 14:27:48 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2013-10-14 14:27:48 +0200 |
commit | 77c3278ff525edf30e2e7adb417a8944b59ccefa (patch) | |
tree | b9d8b263f50eee07c07a9e24a2d5bea73a5652da /src/up-daemon.c | |
parent | ac1708e86e0f87c25e5cf7e11a82324c5d002fba (diff) | |
download | upower-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-daemon.c')
-rw-r--r-- | src/up-daemon.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/up-daemon.c b/src/up-daemon.c index 9651999..2018a91 100644 --- a/src/up-daemon.c +++ b/src/up-daemon.c @@ -543,14 +543,18 @@ up_daemon_set_warning_level (UpDaemon *daemon, UpDeviceLevel warning_level) } UpDeviceLevel -up_daemon_compute_warning_level (UpDaemon *daemon, - UpDeviceKind kind, - gboolean power_supply, - gdouble percentage, - gint64 time_to_empty) +up_daemon_compute_warning_level (UpDaemon *daemon, + UpDeviceState state, + UpDeviceKind kind, + gboolean power_supply, + gdouble percentage, + gint64 time_to_empty) { gboolean use_percentage = TRUE; + if (state != UP_DEVICE_STATE_DISCHARGING) + return UP_DEVICE_LEVEL_NONE; + /* Keyboard and mice usually have a coarser * battery level, so this avoids falling directly * into critical (or off) before any warnings */ |