summaryrefslogtreecommitdiff
path: root/libupower-glib
diff options
context:
space:
mode:
authorMarijn Suijten <marijns95@gmail.com>2021-02-02 18:15:47 +0100
committerMarijn Suijten <marijns95@gmail.com>2021-02-02 18:15:47 +0100
commitd86c637f31eb0f21a3394d6379ecce7d6edf72f0 (patch)
tree2c10f4282a8824b2181441563f5a6220873b642e /libupower-glib
parent64582256a8c75127c3de23f5542c8467e2e9484a (diff)
lib: Invert percentage conditional in device_to_text
Almost every device kind except line power and invalid (>= last) carry a valid percentage property. By inverting this conditional not every new device needs to be added explicitly to this already long and lacking chain (PDA and MONITOR were already missing).
Diffstat (limited to 'libupower-glib')
-rw-r--r--libupower-glib/up-device.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c
index 66695aa..36fda27 100644
--- a/libupower-glib/up-device.c
+++ b/libupower-glib/up-device.c
@@ -363,17 +363,8 @@ up_device_to_text (UpDevice *device)
g_free (time_str);
}
}
- if (kind == UP_DEVICE_KIND_BATTERY ||
- kind == UP_DEVICE_KIND_MOUSE ||
- kind == UP_DEVICE_KIND_KEYBOARD ||
- kind == UP_DEVICE_KIND_PHONE ||
- kind == UP_DEVICE_KIND_TABLET ||
- kind == UP_DEVICE_KIND_COMPUTER ||
- kind == UP_DEVICE_KIND_MEDIA_PLAYER ||
- kind == UP_DEVICE_KIND_UPS ||
- kind == UP_DEVICE_KIND_GAMING_INPUT ||
- kind == UP_DEVICE_KIND_PEN ||
- kind == UP_DEVICE_KIND_TOUCHPAD) {
+ if (kind != UP_DEVICE_KIND_LINE_POWER ||
+ kind >= UP_DEVICE_KIND_LAST) {
if (battery_level == UP_DEVICE_LEVEL_NONE)
g_string_append_printf (string, " percentage: %g%%\n", up_exported_device_get_percentage (priv->proxy_device));
else