c89-ification

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@387 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-17 00:16:02 +00:00
parent f4eed938cf
commit 758ae46138
8 changed files with 80 additions and 30 deletions

View File

@@ -237,6 +237,10 @@ static void resize(MwWidget handle, void* user, void* call) {
static void scan(MwWidget handle, const char* path) {
filechooser_t* fc = handle->opaque;
MwVaApply(fc->addr,
MwNtext, path,
NULL);
MwListBoxReset(fc->files);
MwListBoxInsert(fc->files, -1, NULL, "Name", "Date modified", "Size", NULL);
MwListBoxSetWidth(fc->files, 0, -128 - 64);
@@ -251,6 +255,7 @@ MwWidget MwFileChooser(MwWidget handle, const char* title) {
int wh = MwGetInteger(handle, MwNheight);
int w, h;
filechooser_t* fc = malloc(sizeof(*fc));
char* path;
memset(fc, 0, sizeof(*fc));
@@ -275,7 +280,9 @@ MwWidget MwFileChooser(MwWidget handle, const char* title) {
layout(window);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
scan(window, ".");
path = MwDirectoryCurrent();
scan(window, path);
free(path);
MwLLDetach(window->lowlevel, &p);
MwLLMakePopup(window->lowlevel, handle->lowlevel);