Patch to add ability to reset timeouts
Submitted by iain
Link to original bug (#681145)
Description
Created attachment 220250 Add functions to reset a timeout
Often a program is required to fire a timeout a certain length of time after the user does something, 500ms after the last key press. In these situations code like this is required so that multiple timeouts are not triggered:
if (timeout_id > 0) { g_source_remove (timeout_id); } timeout_id = g_timeout_add (500, callback, NULL);
The attached patch adds the functions g_timeout_reset (and it's GTimeoutSource equivalent: g_timeout_source_reset) which means that the same timeout can be used
if (timeout_id > 0) { g_timeout_reset (timeout_id); } else { timeout_id = g_timeout_add (500, callback, NULL); }
Patch 220250, "Add functions to reset a timeout":
0001-Add-functions-to-reset-a-timeout.patch
Version: 2.33.x