mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
* dir.c (do_load_dir): Add new argument "path" to avoid the need
to request the current directory. (do_reload_dir): Likewise. Adjust all callers.
This commit is contained in:
parent
ab84c14503
commit
61ac4d5ca1
@ -1,5 +1,9 @@
|
||||
2003-06-05 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* dir.c (do_load_dir): Add new argument "path" to avoid the need
|
||||
to request the current directory.
|
||||
(do_reload_dir): Likewise. Adjust all callers.
|
||||
|
||||
* screen.c (panel_destroy): Rewind history to the beginning
|
||||
before freeing it.
|
||||
* widget.c (input_destroy): Likewise.
|
||||
|
12
src/dir.c
12
src/dir.c
@ -462,8 +462,8 @@ handle_path (dir_list *list, char *path,
|
||||
}
|
||||
|
||||
int
|
||||
do_load_dir (dir_list *list, sortfn *sort, int reverse, int case_sensitive,
|
||||
char *filter)
|
||||
do_load_dir (char *path, dir_list *list, sortfn *sort, int reverse,
|
||||
int case_sensitive, char *filter)
|
||||
{
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
@ -504,7 +504,7 @@ do_load_dir (dir_list *list, sortfn *sort, int reverse, int case_sensitive,
|
||||
|
||||
if (next_free) {
|
||||
/* Add ".." except the root directory */
|
||||
if (strcmp (vfs_canon ("."), "/") != 0)
|
||||
if (strcmp (path, "/") != 0)
|
||||
add_dotdot_to_list (list, next_free++);
|
||||
do_sort (list, sort, next_free - 1, reverse, case_sensitive);
|
||||
} else {
|
||||
@ -567,8 +567,8 @@ alloc_dir_copy (int size)
|
||||
|
||||
/* If filter is null, then it is a match */
|
||||
int
|
||||
do_reload_dir (dir_list * list, sortfn * sort, int count, int rev,
|
||||
int case_sensitive, char *filter)
|
||||
do_reload_dir (char *path, dir_list *list, sortfn *sort, int count,
|
||||
int rev, int case_sensitive, char *filter)
|
||||
{
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
@ -656,7 +656,7 @@ do_reload_dir (dir_list * list, sortfn * sort, int count, int rev,
|
||||
g_hash_table_destroy (marked_files);
|
||||
if (next_free) {
|
||||
/* Add ".." except the root directory */
|
||||
if (strcmp (vfs_canon ("."), "/") != 0)
|
||||
if (strcmp (path, "/") != 0)
|
||||
add_dotdot_to_list (list, next_free++);
|
||||
do_sort (list, sort, next_free - 1, rev, case_sensitive);
|
||||
} else
|
||||
|
10
src/dir.h
10
src/dir.h
@ -29,12 +29,12 @@ typedef struct {
|
||||
|
||||
typedef int sortfn (const void *, const void *);
|
||||
|
||||
int do_load_dir (dir_list *list, sortfn *sort,
|
||||
int reverse, int case_sensitive, char *filter);
|
||||
void do_sort (dir_list *list, sortfn *sort, int top,
|
||||
int reverse, int case_sensitive);
|
||||
int do_load_dir (char *path, dir_list * list, sortfn * sort, int reverse,
|
||||
int case_sensitive, char *filter);
|
||||
void do_sort (dir_list * list, sortfn * sort, int top, int reverse,
|
||||
int case_sensitive);
|
||||
dir_list *do_collect_stat (dir_list * dir, int top);
|
||||
int do_reload_dir (dir_list *list, sortfn *sort, int count,
|
||||
int do_reload_dir (char *path, dir_list * list, sortfn * sort, int count,
|
||||
int reverse, int case_sensitive, char *filter);
|
||||
void clean_dir (dir_list * list, int count);
|
||||
int set_zero_dir (dir_list * list);
|
||||
|
@ -772,8 +772,8 @@ _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
|
||||
/* Reload current panel */
|
||||
panel_clean_dir (panel);
|
||||
panel->count =
|
||||
do_load_dir (&panel->dir, panel->sort_type, panel->reverse,
|
||||
panel->case_sensitive, panel->filter);
|
||||
do_load_dir (panel->cwd, &panel->dir, panel->sort_type,
|
||||
panel->reverse, panel->case_sensitive, panel->filter);
|
||||
try_to_select (panel, get_parent_dir_name (panel->cwd, olddir));
|
||||
load_hint (0);
|
||||
panel_update_contents (panel);
|
||||
|
12
src/screen.c
12
src/screen.c
@ -990,7 +990,8 @@ panel_new (const char *panel_name)
|
||||
}
|
||||
|
||||
/* Load the default format */
|
||||
panel->count = do_load_dir (&panel->dir, panel->sort_type,
|
||||
panel->count =
|
||||
do_load_dir (panel->cwd, &panel->dir, panel->sort_type,
|
||||
panel->reverse, panel->case_sensitive, panel->filter);
|
||||
return panel;
|
||||
}
|
||||
@ -1000,8 +1001,7 @@ panel_reload (WPanel *panel)
|
||||
{
|
||||
struct stat current_stat;
|
||||
|
||||
if (fast_reload
|
||||
&& !stat (panel->cwd, ¤t_stat)
|
||||
if (fast_reload && !stat (panel->cwd, ¤t_stat)
|
||||
&& current_stat.st_ctime == panel->dir_stat.st_ctime
|
||||
&& current_stat.st_mtime == panel->dir_stat.st_mtime)
|
||||
return;
|
||||
@ -1023,8 +1023,10 @@ panel_reload (WPanel *panel)
|
||||
show_dir (panel);
|
||||
}
|
||||
|
||||
panel->count = do_reload_dir (&panel->dir, panel->sort_type, panel->count,
|
||||
panel->reverse, panel->case_sensitive, panel->filter);
|
||||
panel->count =
|
||||
do_reload_dir (panel->cwd, &panel->dir, panel->sort_type,
|
||||
panel->count, panel->reverse, panel->case_sensitive,
|
||||
panel->filter);
|
||||
|
||||
panel->dirty = 1;
|
||||
if (panel->selected >= panel->count)
|
||||
|
Loading…
Reference in New Issue
Block a user