GNOME Bugzilla – Bug 574033
Use g_timeout_add_seconds where appropiate
Last modified: 2011-02-25 20:37:10 UTC
According to https://wiki.ubuntu.com/SavingTheWorld (and of course according to the gtk docs) using g_timeout_add_seconds is preferred over g_timeout_add if a timeout in seconds is desired. I grepped nautilus trunk and found several calls that could be improved in this regard, patch attached.
Created attachment 129999 [details] [review] Use g_timeout_add_seconds instead of g_timeout_add where appropiate
Looks good, please commit after we branch for 2.27.
(In reply to comment #2) > Looks good, please commit after we branch for 2.27. > Ok, thank you!.
*** Bug 574206 has been marked as a duplicate of this bug. ***
Fixed in master. commit 60e58366e06f42b03072e06a19f8adeece0ded6a Author: Nelson Benitez <nbenitezl@gmail.com> Date: Tue Apr 21 15:37:34 2009 +0200 Use g_timeout_add_seconds where appropriate Use g_timeout_add_seconds instead of g_timeout_add where appropriate. Fix bug #574033. Signed-off-by: Cosimo Cecchi <cosimoc@gnome.org>
many of the "fixes" in this patch are regressions. a specific instance: the audio preview timeout. another (less serious): the save-window-geometry timeout. maybe others. timeout_add_seconds() should only be used when you don't care about accuracy and you want to save power by not waking up on a recurrent timer too frequently. in both of the mentioned cases, accuracy is important (particularly in the sound preview case) and it's not a recurrent timeout. the upshot for the example is that the audio preview timeout is somewhat non-deterministic (and, really, no power is being saved here). these ought to be reviewed on a case-by-case basis and some of them reversed.