GNOME Bugzilla – Bug 692611
Saving power: Use g_timeout_add_seconds
Last modified: 2013-04-19 15:37:10 UTC
See https://live.gnome.org/GnomeGoals/UseTimeoutAddSeconds
Created attachment 234504 [details] [review] Use g_timeout_add_seconds wherever possible.
Review of attachment 234504 [details] [review]: Prefix the commit subject line with "mouse: " ::: panels/mouse/gnome-mouse-test.c @@ +159,3 @@ data.widget = widget; data.timeout_id = &information_label_timeout_id; + information_label_timeout_id = g_timeout_add_seconds (2.5, That's nice. Except that g_timeout_add_seconds() takes an integer, not a float. @@ +234,3 @@ data.widget = widget; data.timeout_id = &button_drawing_area_timeout_id; + button_drawing_area_timeout_id = g_timeout_add_seconds (2.5, (GSourceFunc) test_maybe_timeout, &data); Ditto.
(In reply to comment #2) > Review of attachment 234504 [details] [review]: > > Prefix the commit subject line with "mouse: " > > ::: panels/mouse/gnome-mouse-test.c > @@ +159,3 @@ > data.widget = widget; > data.timeout_id = &information_label_timeout_id; > + information_label_timeout_id = g_timeout_add_seconds (2.5, > > That's nice. Except that g_timeout_add_seconds() takes an integer, not a float. Can it be rounded off to 3 sec. > > @@ +234,3 @@ > data.widget = widget; > data.timeout_id = &button_drawing_area_timeout_id; > + button_drawing_area_timeout_id = g_timeout_add_seconds (2.5, > (GSourceFunc) test_maybe_timeout, &data); > > Ditto.
(In reply to comment #3) > (In reply to comment #2) > > Review of attachment 234504 [details] [review] [details]: > > > > Prefix the commit subject line with "mouse: " > > > > ::: panels/mouse/gnome-mouse-test.c > > @@ +159,3 @@ > > data.widget = widget; > > data.timeout_id = &information_label_timeout_id; > > + information_label_timeout_id = g_timeout_add_seconds (2.5, > > > > That's nice. Except that g_timeout_add_seconds() takes an integer, not a float. > > Can it be rounded off to 3 sec. No, and same problem for the other 2.5 seconds timeout. Given that they only trigger when you double-click/triple-click in the test area, I don't think that this is high priority, or saving power.
As per the comment from HavocPennington in the corresponding https://live.gnome.org/GnomeGoals/UseTimeoutAddSeconds, the callback functions used here in all three cases in the attached patch are non-recurring. So using add_seconds here will not be use.
I guess there's nothing left to be done here.