Skip to content

Instantly share code, notes, and snippets.

@naaando
Created December 17, 2018 15:47
Show Gist options
  • Save naaando/1058efde2cdc4f4469a1a61892c9c0ad to your computer and use it in GitHub Desktop.
Save naaando/1058efde2cdc4f4469a1a61892c9c0ad to your computer and use it in GitHub Desktop.
void on_pomodoro_service_started (Pomodoro.State state) {
state_label.set_pomodoro_state (state);
cancellable = new Cancellable ();
Timeout.add (500, () => {
timer_label.set_time_in_seconds (pomodoro_service.timer.get_remaining_time ());
return !cancellable.is_cancelled ();
});
print (@"Pomodoro started\n");
start_n_stop_stack.visible_child_name = "stop-button";
}
void on_pomodoro_service_stopped () {
cancellable.cancel ();
start_n_stop_stack.visible_child_name = "start-button";
}
void on_start_button_clicked () {
return_if_fail (pomodoro_service != null);
pomodoro_service.start_next ();
}
void on_stop_button_clicked () {
return_if_fail (pomodoro_service != null);
pomodoro_service.stop ();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment