After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 138959 - [PATCH] show remaining time in battstat applet
[PATCH] show remaining time in battstat applet
Status: RESOLVED FIXED
Product: gnome-applets
Classification: Other
Component: battery
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-applets Maintainers
gnome-applets Maintainers
: 104942 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-04-03 16:55 UTC by Colin Leroy
Modified: 2010-01-24 01:05 UTC
See Also:
GNOME target: ---
GNOME version: 2.3/2.4


Attachments
the patch (2.15 KB, patch)
2004-04-03 16:55 UTC, Colin Leroy
none Details | Review
second patch (2.15 KB, patch)
2004-05-10 07:02 UTC, Colin Leroy
none Details | Review
patch with ACPI support (4.82 KB, patch)
2004-05-16 11:44 UTC, Danielle Madeley
none Details | Review

Description Colin Leroy 2004-04-03 16:55:01 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.
Comment 1 Colin Leroy 2004-04-03 16:55:40 UTC
Created attachment 26290 [details] [review]
the patch
Comment 2 Kjartan Maraas 2004-04-13 17:48:47 UTC
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?
Comment 3 Colin Leroy 2004-04-13 18:02:19 UTC
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.
Comment 4 Kjartan Maraas 2004-04-28 22:14:41 UTC
Ok, thanks for the patch anyway. Kevin does this look ok?
Comment 5 Richard Kinder 2004-05-09 09:26:19 UTC
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 :)
Comment 6 Colin Leroy 2004-05-10 07:02:48 UTC
Created attachment 27526 [details] [review]
second patch

Hi,

here's an updated patch.

HTH,
Colin
Comment 7 Danielle Madeley 2004-05-16 11:44:23 UTC
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?
Comment 8 Kevin Vandersloot 2004-05-16 12:50:50 UTC
Patch applied. Thanks a lot to all who provided patches here!
Comment 9 Kjartan Maraas 2004-05-16 13:04:45 UTC
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.
Comment 10 Kjartan Maraas 2004-05-16 13:05:47 UTC
Christian, do you think this is important enough to go through updating
translations in 2.6.x for?
Comment 11 Christian Rose 2004-05-16 22:25:07 UTC
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.
Comment 12 Kjartan Maraas 2004-05-17 07:50:00 UTC
After thinking about it I think you're right. Let's keep it simple :)
Comment 13 Danielle Madeley 2004-05-17 10:15:10 UTC
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.
Comment 14 Christian Rose 2004-05-17 21:27:19 UTC
"%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.
Comment 15 Danielle Madeley 2004-05-23 16:38:05 UTC
*** Bug 104942 has been marked as a duplicate of this bug. ***