Compare commits
3 Commits
689565f732
...
b7124cbb1d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7124cbb1d | ||
|
|
adac32fcc1 | ||
|
|
dcb47d420b |
53
dir.c
53
dir.c
@@ -295,59 +295,6 @@ void print_dir(WINDOW *win, char print_info, dir *dir){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char update_selected_file(){
|
|
||||||
char ret = -1; /* -1 on empty or inaccessible file, 0 on unchanged file, 1 on changed file */
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (selected_file_current >= mid_file_count) {
|
|
||||||
selected_file_current = mid_file_count-1;
|
|
||||||
}
|
|
||||||
if (selected_file_current != selected_file_last && selected_file_last <= mid_file_count) {
|
|
||||||
mid_content[selected_file_last].status &= ~FILE_STATUS_HOVER;
|
|
||||||
ret = 1;
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
mid_dir.current_dir.status |= FILE_STATUS_HOVER;
|
|
||||||
selected_file_last = selected_file_current;
|
|
||||||
*/
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
void dir_set_selected_file_current(unsigned long selected_file_current){
|
|
||||||
/*
|
|
||||||
if (mid_content->file_name) {
|
|
||||||
current_dir->selected_file_current = selected_file_current;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long dir_get_selected_file_current(){
|
|
||||||
|
|
||||||
/*
|
|
||||||
current_dir = visited_dirs;
|
|
||||||
if (mid_content->file_name[0] == '\0') {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
char hit = 0;
|
|
||||||
char *path = getcwd(NULL, 0);
|
|
||||||
while(current_dir->next != NULL) {
|
|
||||||
if (strcmp(path, current_dir->path) == 0) {
|
|
||||||
hit = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
current_dir = current_dir->next;
|
|
||||||
}
|
|
||||||
if (hit == 0) {
|
|
||||||
current_dir->next = malloc(sizeof(linked_dir));
|
|
||||||
current_dir->next->next = NULL;
|
|
||||||
current_dir->next->path = path;
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
free(path);
|
|
||||||
return current_dir->selected_file_current;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
void dir_init(){
|
void dir_init(){
|
||||||
visited_dirs = malloc(sizeof(linked_dir));
|
visited_dirs = malloc(sizeof(linked_dir));
|
||||||
visited_dirs->path = getcwd(NULL, 0);
|
visited_dirs->path = getcwd(NULL, 0);
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ void move_right(){
|
|||||||
} else {
|
} else {
|
||||||
char *mime = get_mimetype(mid_dir.current_file);
|
char *mime = get_mimetype(mid_dir.current_file);
|
||||||
char *extension = mid_dir.current_file->file_name;
|
char *extension = mid_dir.current_file->file_name;
|
||||||
char *cmd;
|
char *cmd = NULL;
|
||||||
while (extension <= mid_dir.current_file->file_name + strlen(mid_dir.current_file->file_name)) {
|
while (extension <= mid_dir.current_file->file_name + strlen(mid_dir.current_file->file_name)) {
|
||||||
if (*extension == '.') {
|
if (*extension == '.') {
|
||||||
break;
|
break;
|
||||||
@@ -216,7 +216,7 @@ void move_right(){
|
|||||||
extension++;
|
extension++;
|
||||||
}
|
}
|
||||||
|
|
||||||
long i;
|
unsigned long i;
|
||||||
if (extension <= mid_dir.current_file->file_name + strlen(mid_dir.current_file->file_name)) {
|
if (extension <= mid_dir.current_file->file_name + strlen(mid_dir.current_file->file_name)) {
|
||||||
for (i = 0; i < file_extension_default_count; i++) {
|
for (i = 0; i < file_extension_default_count; i++) {
|
||||||
if (strcmp(extension, file_extension_default_cmd[i].file_extension) == 0) {
|
if (strcmp(extension, file_extension_default_cmd[i].file_extension) == 0) {
|
||||||
@@ -278,7 +278,19 @@ void makefile(){
|
|||||||
TODO;
|
TODO;
|
||||||
}
|
}
|
||||||
void enter_shell(unsigned long passes, int index){
|
void enter_shell(unsigned long passes, int index){
|
||||||
TODO;
|
(void*)passes; /*remove compiler warning*/
|
||||||
|
|
||||||
|
endwin();\
|
||||||
|
echo();\
|
||||||
|
curs_set(1);\
|
||||||
|
if (system(key_binding[index].black_magic)) {
|
||||||
|
}
|
||||||
|
initscr(); /* start ncurses */
|
||||||
|
noecho(); /* hide keyboard input */
|
||||||
|
curs_set(0);
|
||||||
|
|
||||||
|
status |= (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY);
|
||||||
|
|
||||||
}
|
}
|
||||||
void not_implemented(unsigned long passes, int index){
|
void not_implemented(unsigned long passes, int index){
|
||||||
(void)passes;
|
(void)passes;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void *thread_mid(){
|
|||||||
btm_status = local_status;
|
btm_status = local_status;
|
||||||
|
|
||||||
|
|
||||||
long i;
|
unsigned long i;
|
||||||
for (i = 0; i < tmp.file_count; i++) {
|
for (i = 0; i < tmp.file_count; i++) {
|
||||||
free(tmp.file_list[i].file_name);
|
free(tmp.file_list[i].file_name);
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ void *thread_rgt(){
|
|||||||
render_queue[RENDER_QUEUE_RGT] = 1;
|
render_queue[RENDER_QUEUE_RGT] = 1;
|
||||||
|
|
||||||
pthread_mutex_unlock(&mutex_rgt);
|
pthread_mutex_unlock(&mutex_rgt);
|
||||||
long i;
|
unsigned long i;
|
||||||
for (i = 0; i < tmp.file_count; i++) {
|
for (i = 0; i < tmp.file_count; i++) {
|
||||||
free(tmp.file_list[i].file_name);
|
free(tmp.file_list[i].file_name);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user