Skip to content

Instantly share code, notes, and snippets.

@naaando
Created December 17, 2018 15:52
Show Gist options
  • Save naaando/6261eae4ea1f9966a1b7eac46874a479 to your computer and use it in GitHub Desktop.
Save naaando/6261eae4ea1f9966a1b7eac46874a479 to your computer and use it in GitHub Desktop.
public void some_method (Pomodoro.Service ps) {
pomodoro_service.start.connect (on_pomodoro_service_started);
pomodoro_service.stop.connect ((state) => {
cancellable.cancel ();
start_n_stop_stack.visible_child_name = "start-button";
});
}
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";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment