diff --git a/TODO.md b/TODO.md index 7d9fceb..d1055a9 100644 --- a/TODO.md +++ b/TODO.md @@ -1,12 +1,10 @@ # TODO: ## Current: -- [x] UI: vertical layout (needs for email in registration) -- [x] Nested groups -- [x] Create dynamic map of elements IDs and their pointers -- [x] Adapt modals to new value-forwarding method +- [ ] PageUp/PageDown key functionality in lists +- [ ] File upload multiline description +- [ ] Permission checkboxes for file upload/edit - [ ] More intuitive navigation between nested groups (by pressing left and right buttons) -- [ ] UTF-8: correct sizing in modals ## Features: - [x] Search files @@ -15,7 +13,7 @@ - [ ] Privilege settings for files - [ ] Files removal - [ ] Encryption -- [ ] UTF-8 support +- [x] UTF-8 support ## Future ideas - [ ] Get rid of old notification mechanism diff --git a/src/widget/dialogue.c b/src/widget/dialogue.c index 3b86744..dc678b2 100644 --- a/src/widget/dialogue.c +++ b/src/widget/dialogue.c @@ -90,6 +90,7 @@ void dialogue_default_callback(callback_args_t *args) { if (widget->callback != NULL) { /* Existing callback case */ new_args.element = widget; widget->callback(&new_args); + memcpy(&(args->resp_data), &(new_args.resp_data), sizeof(cb_resp_data)); break; } /* Default cases */ if (d->active_el->g_type == g_action) { diff --git a/src/widget/fs_file_list.c b/src/widget/fs_file_list.c index bbe0d99..450ac73 100644 --- a/src/widget/fs_file_list.c +++ b/src/widget/fs_file_list.c @@ -87,7 +87,7 @@ fs_fl_item_t *get_files_from_fs(char *path) { 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 *selection = NULL; 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_idx = 0; + resp_data->code = cbrc_none; draw_fs_file_list(fui); } 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; case '\n': - select_item(fui, (int32_t *)args->resp_data.val.val.num); + select_item(fui, &(args->resp_data)); break; } } diff --git a/src/widget_core/widget_core.h b/src/widget_core/widget_core.h index c5abd22..7e81ee5 100644 --- a/src/widget_core/widget_core.h +++ b/src/widget_core/widget_core.h @@ -53,14 +53,16 @@ enum cbrp_code { cbrp_err }; +typedef struct { + enum cbrp_code code; + struct val_t val; +} cb_resp_data; + typedef struct { void *app; void *element; void *data; - struct { - enum cbrp_code code; - struct val_t val; - } resp_data; + cb_resp_data resp_data; void *active_el; } callback_args_t;