1+ namespace ExerciseTimer {
2+ [GtkTemplate (ui = "/xyz /safeworlds /hiit /ui /training_editor .ui ")]
3+ public class TrainingEditor : Adw.Dialog {
4+ public signal void Applied (TrainingSetup setup);
5+
6+ public TrainingEditor (TrainingSetup _setup) {
7+ setup = new TrainingSetup (){
8+ Title = _setup. Title ,
9+ Sets = _setup. Sets ,
10+ ExerciseSec = _setup. ExerciseSec ,
11+ RestSec = _setup. RestSec ,
12+ WarmupSec = _setup. WarmupSec ,
13+ };
14+ setup. bind_property(" Title" , name_row, " text" , GLib . BindingFlags . BIDIRECTIONAL | GLib . BindingFlags . SYNC_CREATE , null , null );
15+ setup. bind_property(" Sets" , sets_adjustment, " value" , GLib . BindingFlags . BIDIRECTIONAL | GLib . BindingFlags . SYNC_CREATE , null , null );
16+ setup. bind_property(" ExerciseSec" , exercise_adjustment, " value" , GLib . BindingFlags . BIDIRECTIONAL | GLib . BindingFlags . SYNC_CREATE , null , null );
17+ setup. bind_property(" RestSec" , rest_adjustment, " value" , GLib . BindingFlags . BIDIRECTIONAL | GLib . BindingFlags . SYNC_CREATE , null , null );
18+ setup. bind_property(" WarmupSec" , preparation_adjustment, " value" , GLib . BindingFlags . BIDIRECTIONAL | GLib . BindingFlags . SYNC_CREATE , null , null );
19+ }
20+
21+ [GtkCallback ]
22+ private void on_apply_clicked() {
23+ Applied (setup);
24+ this . close();
25+ }
26+
27+ private TrainingSetup setup;
28+ [GtkChild ]
29+ private unowned Adw . EntryRow name_row;
30+ [GtkChild ]
31+ private unowned Gtk . Adjustment sets_adjustment;
32+ [GtkChild ]
33+ private unowned Gtk . Adjustment exercise_adjustment;
34+ [GtkChild ]
35+ private unowned Gtk . Adjustment rest_adjustment;
36+ [GtkChild ]
37+ private unowned Gtk . Adjustment preparation_adjustment;
38+ }
39+ }
0 commit comments