From 262ed2553c5f5dbf6bc85968247c7546f8609121 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sun, 20 Sep 2026 19:00:31 +0200 Subject: [PATCH] Split merge_ui::wire into one function per section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 312-line wire() registered the panorama page's callbacks in three comment-delimited sections. Lift each into its own fn: wire_start (the "Merge to panorama" press, its fetch, and the DARKROOM_START_MERGE dev entry point — all three only ever used together), wire_decision (confirm, projection and border chips, the fill knobs), and wire_stop_and_leave (abandon, close). wire() itself now just calls the three in order; S, C and F stay generic on wire_start since sources/context/on_done are used nowhere else. --- ui/dr-ui/src/merge_ui.rs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/ui/dr-ui/src/merge_ui.rs b/ui/dr-ui/src/merge_ui.rs index 9968e80..67a4e5d 100644 --- a/ui/dr-ui/src/merge_ui.rs +++ b/ui/dr-ui/src/merge_ui.rs @@ -92,11 +92,28 @@ pub fn wire( S: Fn() -> Vec + 'static, C: Fn() -> Option + 'static, F: Fn(&AppWindow) + 'static, +{ + wire_start(window, &ctl, gpu, sources, context, on_done); + wire_decision(window, &ctl); + wire_stop_and_leave(window, &ctl); +} + +/// Start. +fn wire_start( + window: &AppWindow, + ctl: &Rc, + gpu: Option, + sources: S, + context: C, + on_done: F, +) where + S: Fn() -> Vec + 'static, + C: Fn() -> Option + 'static, + F: Fn(&AppWindow) + 'static, { let on_done = Rc::new(on_done); let gpu_for_start = gpu.clone(); - // --- start ----------------------------------------------------------- { let weak = window.as_weak(); let ctl = ctl.clone(); @@ -243,7 +260,7 @@ pub fn wire( }; start( window, - &ctl, + ctl, gpu, names, MergeDestination::Local(dir), @@ -265,8 +282,10 @@ pub fn wire( } } } +} - // --- the decision ---------------------------------------------------- +/// The decision. +fn wire_decision(window: &AppWindow, ctl: &Rc) { { let weak = window.as_weak(); let ctl = ctl.clone(); @@ -360,8 +379,10 @@ pub fn wire( w.set_merge_stage("Filling the preview".into()); }); } +} - // --- stopping and leaving -------------------------------------------- +/// Stopping and leaving. +fn wire_stop_and_leave(window: &AppWindow, ctl: &Rc) { { let weak = window.as_weak(); let ctl = ctl.clone();