GNOME Bugzilla – Bug 138959
[PATCH] show remaining time in battstat applet
Last modified: 2010-01-24 01:05:43 UTC
Hi, Here's a patch that replaces the (rather useless) Critical/Low/High status in the applet's tooltip with the remaining time estimation.
Created attachment 26290 [details] [review] the patch
I assume this is just working for APM? Could you do the same thing for ACPI maybe? Also is this portable wrt all the supported archs/platforms?
I tested it on my linux/ppc laptop. I don't have access to other arch/platform, but I think it'll work the same on other archs. Concerning BSD, it *should* work if I read the code correctly. I'm afraid I won't be able to help regarding ACPI stuff, as APM on linux/PPC is an emulation layer to PMU (the mac's may of managing energy), and ACPI doesn't exist on this.
Ok, thanks for the patch anyway. Kevin does this look ok?
Colin, one minor point about the patch - you use strdup which can return NULL (at which point the 'free' call will fail). Use g_strdup instead - this will use g_new to allocate the new string and abort the program if no memory is available. Also change the free call to g_free. I'll try and test this on my T30 (not sure ACPI or APM but the more testing the better :)
Created attachment 27526 [details] [review] second patch Hi, here's an updated patch. HTH, Colin
Created attachment 27756 [details] [review] patch with ACPI support This patch has ACPI support that seems to work. This is a long missing feature, is it ok to commit?
Patch applied. Thanks a lot to all who provided patches here!
The only comment I have is that this: + if (time == -1) + return g_strdup_printf(_("charged")); should be something like (_("Fully charged")); or at least be capitalized.
Christian, do you think this is important enough to go through updating translations in 2.6.x for?
Don't know really. Looks more like an improvement. Don't know if it's worth breaking the freeze in GNOME 2.6. We only have like 15 or so fully complete translations now in 2.6, whereas we had lots more at the 2.6.0 release time, due to the few remaining string changes done since. So I'd rather try to keep the string changes in 2.6 down to absolutely essential bug fix ones. But that's just my initial opinion, I'd love to hear others.
After thinking about it I think you're right. Let's keep it simple :)
Perhaps instead of having "%i hours %i minutes" perhaps "%i:%i" could be used. That would have minimal effect on breaking the string freeze. Then a decision could be made on how to have it for GNOME 2.8.
"%i:%i" would still need localization, so I don't understand how it would have less effect on the string freeze. It would still be a new message. These string additions are all GNOME 2.8 material IMHO, unless someone can give good reasons for why it shouldn't be.
*** Bug 104942 has been marked as a duplicate of this bug. ***