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).
This commit is contained in:
Marijn Suijten 2021-02-02 18:15:47 +01:00
parent 64582256a8
commit d86c637f31

View file

@ -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