Skip to content

Commit 515645b

Browse files
authored
Fix #7 stop timer if window is closed
1 parent 594eb85 commit 515645b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/MainWindow.vala

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace Timer {
2525
public int uid { get; construct set; }
2626
public string? timer_name { get; construct set; }
2727
public string timer { get; construct set; }
28+
TimerManager timer_manager;
2829

2930
public MainWindow (Gtk.Application application, int window_id, string? name, string? t_set) {
3031
Object (application: application,
@@ -63,7 +64,7 @@ namespace Timer {
6364

6465
this.delete_event.connect (on_window_closing);
6566

66-
var timer_manager = new TimerManager ();
67+
timer_manager = new TimerManager ();
6768
var time_entry = new TimerEntry (timer_manager, uid);
6869

6970
var box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
@@ -163,11 +164,12 @@ namespace Timer {
163164
}
164165

165166
private bool on_window_closing () {
167+
timer_manager.actual_timer.stop ();
166168
int root_x, root_y;
167169
get_position (out root_x, out root_y);
168170
settings.set_int ("window-x", root_x);
169171
settings.set_int ("window-y", root_y);
170172
return false;
171173
}
172174
}
173-
}
175+
}

0 commit comments

Comments
 (0)