diff --git a/include/Mw/MachDep.h b/include/Mw/MachDep.h index a74d398..0f14b84 100644 --- a/include/Mw/MachDep.h +++ b/include/Mw/MachDep.h @@ -20,6 +20,7 @@ #include #else #include +#include #include #include #include diff --git a/src/filechooser.c b/src/filechooser.c index be73b3d..21f67d9 100644 --- a/src/filechooser.c +++ b/src/filechooser.c @@ -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,