Battery format fixes

This commit is contained in:
o9000 2017-06-20 18:58:13 +02:00
parent b5578ff5bc
commit ea0e52c5a2

View file

@ -170,7 +170,9 @@ void battery_update_text(char *dest, char *format)
? "Charging"
: (battery_state.state == BATTERY_DISCHARGING)
? "Discharging"
: (battery_state.state == BATTERY_FULL) ? "Full" : "Unknown",
: (battery_state.state == BATTERY_FULL || battery_state.percentage >= 100)
? "Full"
: "Unknown",
BATTERY_BUF_SIZE);
break;
case 'm':
@ -186,7 +188,8 @@ void battery_update_text(char *dest, char *format)
strnappend(dest, buf, BATTERY_BUF_SIZE);
break;
case 't':
if (battery_state.state == BATTERY_FULL) {
if (battery_state.state == BATTERY_FULL ||
(battery_state.state == BATTERY_UNKNOWN && battery_state.percentage >= 100)) {
snprintf(buf, sizeof(buf), "Full");
strnappend(dest, buf, BATTERY_BUF_SIZE);
} else {
@ -386,11 +389,7 @@ int update_battery()
int battery_compute_desired_size(void *obj)
{
Battery *battery = (Battery *)obj;
return text_area_compute_desired_size(&battery->area,
buf_bat_line1,
buf_bat_line2,
bat1_font_desc,
bat2_font_desc);
return text_area_compute_desired_size(&battery->area, buf_bat_line1, buf_bat_line2, bat1_font_desc, bat2_font_desc);
}
gboolean resize_battery(void *obj)