ui: fixes menu navigation

This commit is contained in:
2026-03-11 12:19:36 +02:00
parent 58ec827f38
commit e20a239ac6
4 changed files with 17 additions and 13 deletions
+4 -6
View File
@@ -1,12 +1,10 @@
# TODO: # TODO:
## Current: ## Current:
- [x] UI: vertical layout (needs for email in registration) - [ ] PageUp/PageDown key functionality in lists
- [x] Nested groups - [ ] File upload multiline description
- [x] Create dynamic map of elements IDs and their pointers - [ ] Permission checkboxes for file upload/edit
- [x] Adapt modals to new value-forwarding method
- [ ] More intuitive navigation between nested groups (by pressing left and right buttons) - [ ] More intuitive navigation between nested groups (by pressing left and right buttons)
- [ ] UTF-8: correct sizing in modals
## Features: ## Features:
- [x] Search files - [x] Search files
@@ -15,7 +13,7 @@
- [ ] Privilege settings for files - [ ] Privilege settings for files
- [ ] Files removal - [ ] Files removal
- [ ] Encryption - [ ] Encryption
- [ ] UTF-8 support - [x] UTF-8 support
## Future ideas ## Future ideas
- [ ] Get rid of old notification mechanism - [ ] Get rid of old notification mechanism
+1
View File
@@ -90,6 +90,7 @@ void dialogue_default_callback(callback_args_t *args) {
if (widget->callback != NULL) { /* Existing callback case */ if (widget->callback != NULL) { /* Existing callback case */
new_args.element = widget; new_args.element = widget;
widget->callback(&new_args); widget->callback(&new_args);
memcpy(&(args->resp_data), &(new_args.resp_data), sizeof(cb_resp_data));
break; break;
} /* Default cases */ } /* Default cases */
if (d->active_el->g_type == g_action) { if (d->active_el->g_type == g_action) {
+6 -3
View File
@@ -87,7 +87,7 @@ fs_fl_item_t *get_files_from_fs(char *path) {
return d_start; return d_start;
} }
void select_item(ui_fs_file_list_t *fui, int32_t *resp_data) { void select_item(ui_fs_file_list_t *fui, cb_resp_data *resp_data) {
char *bash_case = NULL; char *bash_case = NULL;
char *selection = NULL; char *selection = NULL;
size_t dp_current; size_t dp_current;
@@ -109,9 +109,12 @@ void select_item(ui_fs_file_list_t *fui, int32_t *resp_data) {
} }
fui->current = fui->start; fui->current = fui->start;
fui->current_idx = 0; fui->current_idx = 0;
resp_data->code = cbrc_none;
draw_fs_file_list(fui); draw_fs_file_list(fui);
} else if (fui->current->d_type == DT_REG) { } else if (fui->current->d_type == DT_REG) {
*resp_data = 1; resp_data->code = cbrp_val;
resp_data->val.type = val_num;
resp_data->val.val.num = 1;
} }
} }
@@ -134,7 +137,7 @@ void fs_file_list_cb(callback_args_t *args) {
} }
break; break;
case '\n': case '\n':
select_item(fui, (int32_t *)args->resp_data.val.val.num); select_item(fui, &(args->resp_data));
break; break;
} }
} }
+6 -4
View File
@@ -53,14 +53,16 @@ enum cbrp_code {
cbrp_err cbrp_err
}; };
typedef struct {
enum cbrp_code code;
struct val_t val;
} cb_resp_data;
typedef struct { typedef struct {
void *app; void *app;
void *element; void *element;
void *data; void *data;
struct { cb_resp_data resp_data;
enum cbrp_code code;
struct val_t val;
} resp_data;
void *active_el; void *active_el;
} callback_args_t; } callback_args_t;