Compare commits
1 Commits
5a93c4fdcd
...
ee2fc4b956
Author | SHA1 | Date |
---|---|---|
Savanni D'Gerinel | ee2fc4b956 |
|
@ -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>
|
||||||
|
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue