ui: file list modal: fixes navigation, improves modal size

This commit is contained in:
2026-01-15 22:09:07 +02:00
parent 4661a36acf
commit a447ff6225
4 changed files with 8 additions and 32 deletions
+2
View File
@@ -10,8 +10,10 @@ TODO:
- [ ] Bug with file list on downloading files - [ ] Bug with file list on downloading files
- [ ] Remember page numbers - [ ] Remember page numbers
- [ ] "Server message" to notification - [ ] "Server message" to notification
- [ ] file list -> list template
INPUT: INPUT:
- [x] hidden text for passwords - [x] hidden text for passwords
- [x] move cursor through the text in input - [x] move cursor through the text in input
-29
View File
@@ -1,29 +0,0 @@
client.o: src/client.c src/file_processor.h src/main.h src/types.h \
src/ui/widget/file_list.h src/ui/widget/../widget.h \
src/ui/widget/../../main.h src/client.h
connection.o: src/connection.c src/main.h src/types.h src/ui/app.h \
src/ui/../common.h src/ui/widget.h src/ui/../main.h \
src/ui/widget/dialogue.h src/ui/widget/../widget.h \
src/ui/widget/../../common.h src/ui/widget/button.h \
src/ui/widget/../../main.h src/ui/widget/group.h
file_processor.o: src/file_processor.c src/client.h src/main.h \
src/types.h src/query.h src/ui/app.h src/ui/../common.h src/ui/widget.h \
src/ui/../main.h src/ui/widget/dialogue.h src/ui/widget/../widget.h \
src/ui/widget/../../common.h src/ui/widget/button.h \
src/ui/widget/../../main.h src/ui/widget/group.h \
src/ui/widget/dialogue.h src/ui/widget/file_list.h \
src/ui/widget/progress_bar.h
fs.o: src/fs.c
main.o: src/main.c src/connection.h src/main.h src/types.h src/ui/app.h \
src/ui/../common.h src/ui/widget.h src/ui/../main.h \
src/ui/widget/dialogue.h src/ui/widget/../widget.h \
src/ui/widget/../../common.h src/ui/widget/button.h \
src/ui/widget/../../main.h src/ui/widget/group.h src/query.h \
src/ui/widget.h src/ui/widget/file_list.h
query.o: src/query.c src/client.h src/main.h src/types.h src/connection.h \
src/ui/app.h src/ui/../common.h src/ui/widget.h src/ui/../main.h \
src/ui/widget/dialogue.h src/ui/widget/../widget.h \
src/ui/widget/../../common.h src/ui/widget/button.h \
src/ui/widget/../../main.h src/ui/widget/group.h src/file_processor.h \
src/ui/widget/file_list.h src/server.h
server.o: src/server.c src/main.h src/types.h
+4 -1
View File
@@ -1,6 +1,5 @@
#include "fs_file_list.h" #include "fs_file_list.h"
#include "../../file_processor.h" #include "../../file_processor.h"
#include "../app.h"
#include "progress_bar.h" #include "progress_bar.h"
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
@@ -32,6 +31,7 @@ static void fl_add(fl_item_t **f_start, fl_item_t **f_current,
} }
fl_item_t *get_files_from_fs(char *path) { fl_item_t *get_files_from_fs(char *path) {
/* TODO: separate files from directories, mark directories, filter empty fields */
DIR *dir; DIR *dir;
struct dirent *dent; struct dirent *dent;
@@ -82,6 +82,7 @@ void fs_file_list_cb(callback_args_t *args) {
ui_fs_file_list_t *init_fs_file_list(WINDOW **win, widget_t *w_parent) { ui_fs_file_list_t *init_fs_file_list(WINDOW **win, widget_t *w_parent) {
ui_fs_file_list_t *fl_ui = malloc(sizeof(ui_fs_file_list_t)); ui_fs_file_list_t *fl_ui = malloc(sizeof(ui_fs_file_list_t));
WINDOW *win_par = *(w_parent->w_parent->parent_win);
init_widget(&(fl_ui->w), w_parent, win, ""); init_widget(&(fl_ui->w), w_parent, win, "");
fl_ui->current_idx = 0; fl_ui->current_idx = 0;
fl_ui->current_count = 0; fl_ui->current_count = 0;
@@ -90,6 +91,8 @@ ui_fs_file_list_t *init_fs_file_list(WINDOW **win, widget_t *w_parent) {
fl_ui->start = malloc(sizeof(fl_item_t *)); /* For compatibility reasons */ fl_ui->start = malloc(sizeof(fl_item_t *)); /* For compatibility reasons */
*(fl_ui->start) = get_files_from_fs("./"); *(fl_ui->start) = get_files_from_fs("./");
fl_ui->w.callback = fs_file_list_cb; fl_ui->w.callback = fs_file_list_cb;
fl_ui->w.x = getmaxx(win_par) / 10 * 8;
fl_ui->w.y = getmaxy(win_par) / 10 * 8;
return fl_ui; return fl_ui;
} }
+2 -2
View File
@@ -1,6 +1,5 @@
#include "group.h" #include "group.h"
#include "button.h" #include "button.h"
#include "file_list.h"
#include "fs_file_list.h" #include "fs_file_list.h"
#include "input.h" #include "input.h"
#include "progress_bar.h" #include "progress_bar.h"
@@ -65,9 +64,10 @@ void group_default_callback(callback_args_t *args) {
} else { } else {
widget = (widget_t *) element_ptr->element; widget = (widget_t *) element_ptr->element;
if (widget->callback != NULL) { if (widget->callback != NULL) {
memccpy(&new_args, args, 1, sizeof(callback_args_t *)); memccpy(&new_args, args, 1, sizeof(callback_args_t));
new_args.element = element_ptr->element; new_args.element = element_ptr->element;
widget->callback(&new_args); widget->callback(&new_args);
break;
} }
} }
MAKE_RESPONSE_M1(args, resp_data, response); MAKE_RESPONSE_M1(args, resp_data, response);