From 91caf7822fcac5131b1ccdd80a05829d487ba66e Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sun, 22 Jun 2025 14:03:36 +0300 Subject: [PATCH] nyx: part mgr: disable next step if already done --- .../frontend/gui_tools_partition_manager.c | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c index 68ea526a..7ede49b0 100644 --- a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c +++ b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c @@ -130,6 +130,8 @@ typedef struct _partition_ctxt_t lv_obj_t *lbl_and; lv_obj_t *lbl_hos_os; lv_obj_t *lbl_emu_sd; + + lv_obj_t *partition_button; } partition_ctxt_t; typedef struct _l4t_flasher_ctxt_t @@ -739,7 +741,7 @@ static void _prepare_and_flash_mbr_gpt() static lv_res_t _action_part_manager_ums_sd(lv_obj_t *btn) { - action_ums_sd(btn); + action_ums_sd(NULL); // Close and reopen partition manager. lv_action_t close_btn_action = lv_btn_get_action(close_btn, LV_BTN_ACTION_CLICK); @@ -1710,7 +1712,7 @@ static lv_res_t _action_part_manager_flash_options0(lv_obj_t *btns, const char * lv_obj_del(ums_mbox); break; case 1: - _action_check_flash_linux(btns); + _action_check_flash_linux(NULL); break; case 2: _action_flash_android_slot_select(btns); @@ -1888,7 +1890,7 @@ static bool _derive_bis_keys(gpt_t *gpt) return res; } -static lv_res_t _create_mbox_start_partitioning(lv_obj_t *btn) +static lv_res_t _create_mbox_start_partitioning() { char cwd[0x200]; gpt_t *new_gpt = NULL; @@ -2310,9 +2312,8 @@ exit: lv_obj_set_top(mbox, true); // Disable partitioning button. - if (btn){ - lv_btn_set_state(btn, LV_BTN_STATE_INA); - } + if (part_info.partition_button) + lv_btn_set_state(part_info.partition_button, LV_BTN_STATE_INA); free(new_gpt); @@ -2334,7 +2335,7 @@ static lv_res_t _create_mbox_partitioning_option0(lv_obj_t *btns, const char *tx return LV_RES_OK; case 1: mbox_action(btns, txt); - _create_mbox_start_partitioning(NULL); + _create_mbox_start_partitioning(); break; case 2: mbox_action(btns, txt); @@ -2353,14 +2354,14 @@ static lv_res_t _create_mbox_partitioning_option1(lv_obj_t *btns, const char *tx if (!btn_idx) { mbox_action(btns, txt); - _create_mbox_start_partitioning(NULL); + _create_mbox_start_partitioning(); return LV_RES_INV; } return LV_RES_OK; } -static lv_res_t _create_mbox_partitioning_warn(lv_obj_t *btn) +static lv_res_t _create_mbox_partitioning_warn() { lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL); lv_obj_set_style(dark_bg, &mbox_darken); @@ -2439,12 +2440,12 @@ static lv_res_t _create_mbox_partitioning_android(lv_obj_t *btns, const char *tx mbox_action(btns, txt); part_info.and_dynamic = !btn_idx; - _create_mbox_partitioning_warn(NULL); + _create_mbox_partitioning_warn(); return LV_RES_INV; } -static lv_res_t _create_mbox_partitioning_andr_part(lv_obj_t *btn) +static lv_res_t _create_mbox_partitioning_andr_part() { lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL); lv_obj_set_style(dark_bg, &mbox_darken); @@ -2474,9 +2475,9 @@ static lv_res_t _create_mbox_partitioning_andr_part(lv_obj_t *btn) static lv_res_t _create_mbox_partitioning_next(lv_obj_t *btn) { if (part_info.and_size) - return _create_mbox_partitioning_andr_part(NULL); + return _create_mbox_partitioning_andr_part(); else - return _create_mbox_partitioning_warn(NULL); + return _create_mbox_partitioning_warn(); } static void _update_partition_bar() @@ -4143,6 +4144,7 @@ lv_res_t create_window_partition_manager(lv_obj_t *btn, u8 drive) lv_label_set_static_text(label_btn, SYMBOL_SD" Next Step"); lv_obj_align(btn1, h1, LV_ALIGN_IN_TOP_RIGHT, 0, LV_DPI * 5); lv_btn_set_action(btn1, LV_BTN_ACTION_CLICK, _create_mbox_partitioning_next); + part_info.partition_button = btn1; free(txt_buf); free(gpt);