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 353885 - battery applet polls every second, even on a server
battery applet polls every second, even on a server
Status: RESOLVED DUPLICATE of bug 348750
Product: gnome-applets
Classification: Other
Component: battery
2.15.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-applets Maintainers
gnome-applets Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-09-01 18:05 UTC by Matthias Clasen
Modified: 2006-09-22 00:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (987 bytes, patch)
2006-09-01 18:07 UTC, Matthias Clasen
none Details | Review

Description Matthias Clasen 2006-09-01 18:05:28 UTC
Originally filed here:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=204858

I'll attach a patch we're using in Fedora.
Comment 1 Matthias Clasen 2006-09-01 18:07:29 UTC
Created attachment 72038 [details] [review]
patch
Comment 2 Allison Karlitskaya (desrt) 2006-09-21 17:23:20 UTC
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 ***
Comment 3 Allison Karlitskaya (desrt) 2006-09-22 00:21:07 UTC
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).