mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
home directory
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@412 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <dlfcn.h>
|
||||
#include <signal.h>
|
||||
#include <dirent.h>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user