GNOME Bugzilla – Bug 353885
battery applet polls every second, even on a server
Last modified: 2006-09-22 00:21:07 UTC
Originally filed here: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=204858 I'll attach a patch we're using in Fedora.
Created attachment 72038 [details] [review] patch
This is in progress. Having the behaviour of the applet change depending on what state your system was in when you first booted it up seems a bit suboptimal. I'd be happier if it resumed using the higher-frequency timer once it saw you go on battery for the first time. In any case, this code would only be for the 'legacy' backends. The HAL backend is capable of telling us, for itself, when it gets updates -> no polling needed. *** This bug has been marked as a duplicate of 348750 ***
Based on the idea from your patch I've modified the check_for_updates function to reschedule the timer according to the state of the system: If using HAL: don't ever check (wait for HAL to tell us). If on AC without HAL: don't check again for another 10 seconds. If on battery without HAL: check again in 1 second like normal. 2006-09-21 Ryan Lortie <desrt@desrt.ca> * battstat.h: Rename pixtimer to timeout_id. Add 'timeout' to record current timeout length. * battstat_applet.c: Change pixtimer to timeout_id. Dynamically determine length of time for next wakeup according to Bug #353885. 1 second if on battery. 10 seconds if on AC (reduce polling on servers).