From 04b1e6080d99601b8d6343be3140f545cd8f9eae Mon Sep 17 00:00:00 2001 From: Rubén Beltrán del Río Date: Fri, 16 Jan 2026 00:08:41 +0100 Subject: Separate concerns --- src/handlers/view.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/handlers/view.rs (limited to 'src/handlers/view.rs') diff --git a/src/handlers/view.rs b/src/handlers/view.rs new file mode 100644 index 0000000..64aeb98 --- /dev/null +++ b/src/handlers/view.rs @@ -0,0 +1,20 @@ +use relm4::gtk; + +use crate::AppModel; +use crate::stages::ALL_STAGE_TYPES; + +/// Toggles between horizontal and vertical layout orientation. +pub fn change_orientation(model: &mut AppModel) { + model.orientation = match model.orientation { + gtk::Orientation::Horizontal => gtk::Orientation::Vertical, + _ => gtk::Orientation::Horizontal, + }; +} + +/// Updates the selected stage type from dropdown selection. +pub fn stage_type_selected(model: &mut AppModel, index: usize) { + if index < ALL_STAGE_TYPES.len() { + model.stage_type = ALL_STAGE_TYPES[index]; + model.update_image(); + } +} -- cgit