home directory

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@412 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-18 16:31:59 +00:00
parent 846228771e
commit 2130498be2
2 changed files with 19 additions and 1 deletions

View File

@@ -20,6 +20,7 @@
#include <direct.h>
#else
#include <unistd.h>
#include <pwd.h>
#include <dlfcn.h>
#include <signal.h>
#include <dirent.h>

View File

@@ -69,7 +69,7 @@ static void okay(MwWidget handle, void* user, void* call) {
destroy(handle->parent);
}
static void msgbox_okay(MwWidget handle, void* user, void* call){
static void msgbox_okay(MwWidget handle, void* user, void* call) {
(void)user;
(void)call;
@@ -93,6 +93,22 @@ static void files_activate(MwWidget handle, void* user, void* call) {
}
}
static void nav_activate(MwWidget handle, void* user, void* call) {
int index = *(int*)call;
const char* e = MwListBoxGet(handle, index);
(void)user;
if(strcmp(e, "Home") == 0) {
#ifdef _WIN32
#else
struct passwd* p = getpwuid(getuid());
scan(handle->parent, p->pw_dir);
#endif
}
}
static void addr_up_activate(MwWidget handle, void* user, void* call) {
filechooser_t* fc = handle->parent->opaque;
char* p = MwDirectoryJoin(fc->path, "..");
@@ -127,6 +143,7 @@ static void layout(MwWidget handle) {
MwNleftPadding, 16,
NULL);
MwListBoxInsert(fc->nav, -1, fc->computer, "Home", NULL);
MwAddUserHandler(fc->nav, MwNactivateHandler, nav_activate, NULL);
} else {
MwVaApply(fc->nav,
MwNx, wx,