From 62e0ca759c61f8b31fea5aee67662c7740a0afb3 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Sat, 18 Oct 2025 15:27:13 +0000 Subject: [PATCH] show ok button git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@410 b9cfdab3-6d41-4d17-bbe4-086880011989 --- src/filechooser.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/filechooser.c b/src/filechooser.c index 57f79dd..be73b3d 100644 --- a/src/filechooser.c +++ b/src/filechooser.c @@ -69,6 +69,13 @@ static void okay(MwWidget handle, void* user, void* call) { destroy(handle->parent); } +static void msgbox_okay(MwWidget handle, void* user, void* call){ + (void)user; + (void)call; + + MwDestroyWidget(handle->parent); +} + static void files_activate(MwWidget handle, void* user, void* call) { int index = *(int*)call; filechooser_t* fc = handle->parent->opaque; @@ -310,18 +317,21 @@ static void scan(MwWidget handle, const char* path) { char** sizes = NULL; MwLLPixmap* icons = NULL; - arrfree(fc->sorted_entries); - for(i = 0; i < arrlen(fc->entries); i++) MwDirectoryFreeEntry(fc->entries[i]); - arrfree(fc->entries); - if(dir != NULL) { MwDirectoryEntry* entry; + + arrfree(fc->sorted_entries); + for(i = 0; i < arrlen(fc->entries); i++) MwDirectoryFreeEntry(fc->entries[i]); + arrfree(fc->entries); + while((entry = MwDirectoryRead(dir)) != NULL) arrput(fc->entries, entry); MwDirectoryClose(dir); qsort(fc->entries, arrlen(fc->entries), sizeof(MwDirectoryEntry*), qsort_files); } else { - MwMessageBox(handle, "Directory does not exist!", "Error", MwMB_ICONERROR | MwMB_BUTTONOK); + MwWidget msgbox = MwMessageBox(handle, "Directory does not exist!", "Error", MwMB_ICONERROR | MwMB_BUTTONOK); + MwAddUserHandler(MwMessageBoxGetChild(msgbox, MwMB_BUTTONOK), MwNactivateHandler, msgbox_okay, NULL); + return; } if(fc->path != NULL) free(fc->path);