* Now it should work correctly, but apparently, the battery info is not updated
in the way it should be. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34022 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -359,19 +359,28 @@ PowerStatusView::Update(bool force)
|
|||||||
char text[256];
|
char text[256];
|
||||||
const char* open = "";
|
const char* open = "";
|
||||||
const char* close = "";
|
const char* close = "";
|
||||||
if (!fOnline) {
|
if (fOnline) {
|
||||||
open = "(";
|
open = "(";
|
||||||
close = ")";
|
close = ")";
|
||||||
}
|
}
|
||||||
if (fHasBattery) {
|
if (fHasBattery) {
|
||||||
size_t length = snprintf(text, sizeof(text), "%s%ld%%%s\n",
|
size_t length = snprintf(text, sizeof(text), "%s%ld%%%s",
|
||||||
open, fPercent, close);
|
open, fPercent, close);
|
||||||
if (fTimeLeft) {
|
if (fTimeLeft) {
|
||||||
length += snprintf(text + length, sizeof(text) - length,
|
length += snprintf(text + length, sizeof(text) - length,
|
||||||
"%ld:%02ld\n", fTimeLeft / 3600, (fTimeLeft / 60) % 60);
|
"\n%ld:%02ld", fTimeLeft / 3600, (fTimeLeft / 60) % 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* state = NULL;
|
||||||
|
if ((fBatteryInfo.state & BATTERY_CHARGING) != 0)
|
||||||
|
state = "charging";
|
||||||
|
else if ((fBatteryInfo.state & BATTERY_DISCHARGING) != 0)
|
||||||
|
state = "discharging";
|
||||||
|
|
||||||
|
if (state != NULL) {
|
||||||
|
snprintf(text + length, sizeof(text) - length, "\n%s",
|
||||||
|
state);
|
||||||
}
|
}
|
||||||
length += snprintf(text + length, sizeof(text) - length, "%s",
|
|
||||||
!fOnline ? "charging" : "discharging");
|
|
||||||
} else
|
} else
|
||||||
strcpy(text, "no battery");
|
strcpy(text, "no battery");
|
||||||
SetToolTip(text);
|
SetToolTip(text);
|
||||||
|
|||||||
Reference in New Issue
Block a user