nyx: part mgr: disable next step if already done

This commit is contained in:
CTCaer
2025-06-22 14:03:36 +03:00
committed by NaGa
parent b22b90e55e
commit 91caf7822f

View File

@@ -130,6 +130,8 @@ typedef struct _partition_ctxt_t
lv_obj_t *lbl_and; lv_obj_t *lbl_and;
lv_obj_t *lbl_hos_os; lv_obj_t *lbl_hos_os;
lv_obj_t *lbl_emu_sd; lv_obj_t *lbl_emu_sd;
lv_obj_t *partition_button;
} partition_ctxt_t; } partition_ctxt_t;
typedef struct _l4t_flasher_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) 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. // Close and reopen partition manager.
lv_action_t close_btn_action = lv_btn_get_action(close_btn, LV_BTN_ACTION_CLICK); 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); lv_obj_del(ums_mbox);
break; break;
case 1: case 1:
_action_check_flash_linux(btns); _action_check_flash_linux(NULL);
break; break;
case 2: case 2:
_action_flash_android_slot_select(btns); _action_flash_android_slot_select(btns);
@@ -1888,7 +1890,7 @@ static bool _derive_bis_keys(gpt_t *gpt)
return res; 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]; char cwd[0x200];
gpt_t *new_gpt = NULL; gpt_t *new_gpt = NULL;
@@ -2310,9 +2312,8 @@ exit:
lv_obj_set_top(mbox, true); lv_obj_set_top(mbox, true);
// Disable partitioning button. // Disable partitioning button.
if (btn){ if (part_info.partition_button)
lv_btn_set_state(btn, LV_BTN_STATE_INA); lv_btn_set_state(part_info.partition_button, LV_BTN_STATE_INA);
}
free(new_gpt); 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; return LV_RES_OK;
case 1: case 1:
mbox_action(btns, txt); mbox_action(btns, txt);
_create_mbox_start_partitioning(NULL); _create_mbox_start_partitioning();
break; break;
case 2: case 2:
mbox_action(btns, txt); 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) if (!btn_idx)
{ {
mbox_action(btns, txt); mbox_action(btns, txt);
_create_mbox_start_partitioning(NULL); _create_mbox_start_partitioning();
return LV_RES_INV; return LV_RES_INV;
} }
return LV_RES_OK; 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_t *dark_bg = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_style(dark_bg, &mbox_darken); 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); mbox_action(btns, txt);
part_info.and_dynamic = !btn_idx; part_info.and_dynamic = !btn_idx;
_create_mbox_partitioning_warn(NULL); _create_mbox_partitioning_warn();
return LV_RES_INV; 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_t *dark_bg = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_style(dark_bg, &mbox_darken); 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) { static lv_res_t _create_mbox_partitioning_next(lv_obj_t *btn) {
if (part_info.and_size) if (part_info.and_size)
return _create_mbox_partitioning_andr_part(NULL); return _create_mbox_partitioning_andr_part();
else else
return _create_mbox_partitioning_warn(NULL); return _create_mbox_partitioning_warn();
} }
static void _update_partition_bar() 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_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_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); lv_btn_set_action(btn1, LV_BTN_ACTION_CLICK, _create_mbox_partitioning_next);
part_info.partition_button = btn1;
free(txt_buf); free(txt_buf);
free(gpt); free(gpt);