Compare commits

..

1 Commits

Author SHA1 Message Date
Savanni D'Gerinel ee2fc4b956 Bump the fitnesstrax version to 0.4.0 2024-02-09 09:48:34 -05:00
3 changed files with 48 additions and 46 deletions

View File

@ -3,16 +3,15 @@
<gresource prefix="/com/luminescent-dreams/fitnesstrax/"> <gresource prefix="/com/luminescent-dreams/fitnesstrax/">
<file>style.css</file> <file>style.css</file>
</gresource> </gresource>
<gresource prefix="/com/luminescent-dreams/fitnesstrax/icons/scalable/actions/">
<gresource prefix="/com/luminescent-dreams/fitnesstrax/icons/scalable/actions"> <file preprocess="xml-stripblanks">walking2-symbolic.svg</file>
<file preprocess="xml-stripblanks">cycling-symbolic.svg</file>
</gresource> </gresource>
<gresource prefix="/com/luminescent-dreams/fitnesstrax/icons/scalable/actions"> <gresource prefix="/com/luminescent-dreams/fitnesstrax/icons/scalable/actions">
<file preprocess="xml-stripblanks">running-symbolic.svg</file> <file preprocess="xml-stripblanks">running-symbolic.svg</file>
</gresource> </gresource>
<gresource prefix="/com/luminescent-dreams/fitnesstrax/icons/scalable/actions/"> <gresource prefix="/com/luminescent-dreams/fitnesstrax/icons/scalable/actions">
<file preprocess="xml-stripblanks">walking-symbolic.svg</file> <file preprocess="xml-stripblanks">cycling-symbolic.svg</file>
</gresource> </gresource>
</gresources> </gresources>

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -349,53 +349,56 @@ where
AddRow: Fn(Record<TraxRecord>) + 'static, AddRow: Fn(Record<TraxRecord>) + 'static,
{ {
let add_row = Rc::new(add_row); let add_row = Rc::new(add_row);
/*
let layout = gtk::Box::builder() let walking_button = gtk::Button::builder()
.orientation(gtk::Orientation::Horizontal) .icon_name("walking2-symbolic")
.build();
for (activity, icon, label) in [
(
TimeDistanceActivity::Biking,
"cycling-symbolic",
"Bike Ride",
),
(TimeDistanceActivity::Rowing, "rowing-symbolic", "Rowing"),
(TimeDistanceActivity::Running, "running-symbolic", "Run"),
(TimeDistanceActivity::Swimming, "swimming-symbolic", "Swim"),
(TimeDistanceActivity::Walking, "walking-symbolic", "Walk"),
] {
let button = workout_button(activity, icon, label, view_model.clone(), {
let add_row = add_row.clone();
move |record| add_row(record)
});
layout.append(&button);
}
layout
}
fn workout_button<AddRow>(
activity: TimeDistanceActivity,
_icon: &str,
label: &str,
view_model: DayDetailViewModel,
add_row: AddRow,
) -> gtk::Button
where
AddRow: Fn(Record<TraxRecord>) + 'static,
{
let button = gtk::Button::builder()
.label(label)
.width_request(64) .width_request(64)
.height_request(64) .height_request(64)
.build(); .build();
button.connect_clicked({ walking_button.connect_clicked({
let view_model = view_model.clone(); let view_model = view_model.clone();
let add_row = add_row.clone();
move |_| { move |_| {
let workout = view_model.new_time_distance(activity); let workout = view_model.new_time_distance(TimeDistanceActivity::Walking);
add_row(workout.map(TraxRecord::TimeDistance)); add_row(workout.map(TraxRecord::TimeDistance));
} }
}); });
button
let running_button = gtk::Button::builder()
.icon_name("running-symbolic")
.width_request(64)
.height_request(64)
.build();
running_button.connect_clicked({
let view_model = view_model.clone();
move |_| {
let workout = view_model.new_time_distance(TimeDistanceActivity::Running);
add_row(workout.map(TraxRecord::TimeDistance));
}
});
*/
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_time_distance(TimeDistanceActivity::Biking);
add_row(workout.map(TraxRecord::TimeDistance));
}
});
let layout = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.build();
let row = gtk::Box::builder()
.orientation(gtk::Orientation::Horizontal)
.build();
row.append(&biking_button);
layout.append(&row);
layout
} }