ui: fixes bugs after unsuccessful file upload

This commit is contained in:
2026-05-07 18:44:31 +03:00
parent e5d4ff5c2a
commit 950662b372
5 changed files with 17 additions and 2 deletions
+4
View File
@@ -5,12 +5,16 @@
#include <widget.h>
#include "main.h"
static void (*active_callback_backup)(w_cb_args_t *) = NULL;
void app_draw_modal(app_t *app) {
if (app->modal.needs_destroy ||
(app->query_args->state == S_WAIT_SERVER && app->modal.is_initiated)) {
w_dialogue_destroy(&(app->modal), app);
app->active_callback = active_callback_backup;
}
if (!app->modal.is_initiated) {
active_callback_backup = app->active_callback;
switch (app->query_args->state) {
case S_ASK_SEVER_IP:
m_asa_init(app);
+1
View File
@@ -51,6 +51,7 @@ void upload_props_dialogue_modal_cb(w_cb_args_t *args) {
FREE_MLC(app->query_args->file->name);
FREE_MLC(app->query_args->file->path)
FREE_MLC(app->query_args->file);
app->modal.needs_destroy = true;
app->query_args->state = S_WAIT_SERVER;
break;
}
+6
View File
@@ -123,6 +123,7 @@ void query_loop(app_t *app) {
w_alert("error while processing user input");
}
}
d_args.resp_data.code = cbrc_none;
}
}
}
@@ -184,6 +185,11 @@ int process_query(app_t *app) {
if (!file_upload_start(query_args)) {
query_args->state = S_UPLOAD_FILE;
} else {
if (app->query_args->file != NULL) {
FREE_MLC(app->query_args->file->name);
FREE_MLC(app->query_args->file->path)
FREE_MLC(app->query_args->file);
}
query_args->state = WAIT_CLIENT;
}
break;
+1 -1
View File
@@ -15,7 +15,7 @@ bool w_checkbox_default_key_action(w_cb_args_t *args) {
w_g_el_t *g_el = args->active_el;
w_checkbox_t *cbx = g_el->element;
switch (key) {
case '\40':
case '\40': /* SPACE */
cbx->value = !cbx->value;
break;
default:
+4
View File
@@ -9,6 +9,8 @@
#include <widget.h>
#include <widget_core.h>
static void (*active_callback_backup)(w_cb_args_t *) = NULL;
void incr_active_id(w_dialogue_t *d) {
w_g_el_t *active_el = NULL;
while (true) {
@@ -133,6 +135,8 @@ void w_dialogue_callback_default(w_cb_args_t *args) {
new_args.element = d->g_action;
}
w_group_cb_default(&new_args);
/* copy new result to the parental structure */
mempcpy(&(args->resp_data), &(new_args.resp_data), sizeof(new_args.resp_data));
}
}