I'd like to save the state of a widget once it has not been editted for 2 seconds. Right now, my code looks something like this:
bool timerActive = false;
...
widget.Changed += delegate {
if (timerActive)
return;
timerActive = true;
GLib.Timeout.Add (2000, () => {
Save ();
timerActive = false;
return false;
});
};
This keeps a new timer from being added if one is already running, but does not reset the timer that is already running. I've looked through the docs, and I can't seem to figure out a good way to accomplish this. How do I reset a timer?