diff --git a/fitnesstrax/app/gresources.xml b/fitnesstrax/app/gresources.xml
index 4eafed7..b26eb63 100644
--- a/fitnesstrax/app/gresources.xml
+++ b/fitnesstrax/app/gresources.xml
@@ -10,4 +10,8 @@
running-symbolic.svg
+
+
+ cycling-symbolic.svg
+
diff --git a/fitnesstrax/app/resources/cycling-symbolic.svg b/fitnesstrax/app/resources/cycling-symbolic.svg
new file mode 100644
index 0000000..d1a3f13
--- /dev/null
+++ b/fitnesstrax/app/resources/cycling-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/fitnesstrax/app/resources/resources.gresource.xml b/fitnesstrax/app/resources/resources.gresource.xml
deleted file mode 100644
index 67e604b..0000000
--- a/fitnesstrax/app/resources/resources.gresource.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- start-here-symbolic.svg
-
-
\ No newline at end of file
diff --git a/fitnesstrax/app/src/components/day.rs b/fitnesstrax/app/src/components/day.rs
index c50ab46..3143302 100644
--- a/fitnesstrax/app/src/components/day.rs
+++ b/fitnesstrax/app/src/components/day.rs
@@ -187,6 +187,7 @@ impl DayDetail {
}
TraxRecord::Row(row) => s.append(&time_distance_detail(RecordType::Row, row)),
TraxRecord::Run(run) => s.append(&time_distance_detail(RecordType::Run, run)),
+ TraxRecord::Swim(walk) => s.append(&time_distance_detail(RecordType::Swim, walk)),
TraxRecord::Walk(walk) => s.append(&time_distance_detail(RecordType::Walk, walk)),
_ => {}
}
@@ -248,6 +249,32 @@ impl DayEdit {
move |workout| s.add_row(workout)
});
+ view_model
+ .records()
+ .into_iter()
+ .filter_map({
+ let s = s.clone();
+ move |record| {
+ let workout_type = record.data.workout_type();
+ match record.data {
+ TraxRecord::BikeRide(workout)
+ | TraxRecord::Row(workout)
+ | TraxRecord::Run(workout)
+ | TraxRecord::Swim(workout)
+ | TraxRecord::Walk(workout) => {
+ Some(TimeDistanceEdit::new(workout_type, workout, {
+ let s = s.clone();
+ move |type_, data| {
+ s.update_workout(record.id, type_, data);
+ }
+ }))
+ }
+ _ => None,
+ }
+ }
+ })
+ .for_each(|row| s.imp().workout_rows.borrow().append(&row));
+
s.append(&control_buttons(&s, &view_model));
s.append(&weight_and_steps_row(&view_model));
s.append(&*s.imp().workout_rows.borrow());
@@ -355,6 +382,7 @@ where
AddRow: Fn(Record) + 'static,
{
let add_row = Rc::new(add_row);
+ /*
let walking_button = gtk::Button::builder()
.icon_name("walking2-symbolic")
.width_request(64)
@@ -381,6 +409,20 @@ where
add_row(workout);
}
});
+ */
+
+ let biking_button = gtk::Button::builder()
+ .icon_name("cycling-symbolic")
+ .width_request(64)
+ .height_request(64)
+ .build();
+ biking_button.connect_clicked({
+ let view_model = view_model.clone();
+ move |_| {
+ let workout = view_model.new_record(RecordType::Walk);
+ add_row(workout);
+ }
+ });
let layout = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
@@ -388,8 +430,7 @@ where
let row = gtk::Box::builder()
.orientation(gtk::Orientation::Horizontal)
.build();
- row.append(&walking_button);
- row.append(&running_button);
+ row.append(&biking_button);
layout.append(&row);
layout