From e3fe07fd984d3df8376b2f287c538875c231bc5d Mon Sep 17 00:00:00 2001 From: Darren Banfi <33876110+boingball@users.noreply.github.com> Date: Sat, 5 Sep 2026 00:39:54 +0100 Subject: [PATCH] Save selected Unit profile when activating --- src/MintPrintSettings.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/MintPrintSettings.c b/src/MintPrintSettings.c index 331c1f9..9d596a7 100644 --- a/src/MintPrintSettings.c +++ b/src/MintPrintSettings.c @@ -10378,21 +10378,32 @@ void process_window_events(struct Window *win) { current_unit_index); } else { int selected_unit = current_unit_index; + char unit_env[64], unit_envarc[64]; char active_env[64], active_envarc[64]; BOOL ok; + unit_config_path(selected_unit, FALSE, unit_env, + sizeof(unit_env)); + unit_config_path(selected_unit, TRUE, unit_envarc, + sizeof(unit_envarc)); active_config_path(FALSE, active_env, sizeof(active_env)); active_config_path(TRUE, active_envarc, sizeof(active_envarc)); - /* Activate into the separate live profile. + /* Activate saves the current GUI state in the + * selected Unit first, then mirrors that + * same state into the separate live profile. * Unit0-Unit7 are never overwritten. */ capture_driver_settings(win); ok = ensure_config_dir((CONST_STRPTR)"ENV:MintPRINT") && ensure_config_dir((CONST_STRPTR)"ENVARC:MintPRINT") && - write_driver_config_file((CONST_STRPTR)active_env) && - write_driver_config_file((CONST_STRPTR)active_envarc); + write_driver_config_file((CONST_STRPTR)unit_env) && + write_driver_config_file((CONST_STRPTR)unit_envarc); + + if (ok) + ok = write_driver_config_file((CONST_STRPTR)active_env) && + write_driver_config_file((CONST_STRPTR)active_envarc); if (ok) ok = write_active_unit_marker(selected_unit);