mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Merge branch '007_show_directory_sizes_shortcut'
* 007_show_directory_sizes_shortcut: Ticket #7: change shortcut C-space processing to calculate multi-directory size
This commit is contained in:
commit
d044d20480
32
src/cmd.c
32
src/cmd.c
@ -75,6 +75,7 @@
|
||||
#include "history.h"
|
||||
#include "strutil.h"
|
||||
#include "../src/search/search.h"
|
||||
#include "dir.h"
|
||||
|
||||
|
||||
#ifndef MAP_FILE
|
||||
@ -1158,6 +1159,30 @@ void quick_cd_cmd (void)
|
||||
g_free (p);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief calculate dirs sizes
|
||||
|
||||
calculate dirs sizes and resort panel:
|
||||
dirs_selected = show size for selected dirs,
|
||||
otherwise = show size for dir under cursor:
|
||||
dir under cursor ".." = show size for all dirs,
|
||||
otherwise = show size for dir under cursor
|
||||
*/
|
||||
void
|
||||
smart_dirsize_cmd (void)
|
||||
{
|
||||
WPanel *panel = current_panel;
|
||||
file_entry *entry;
|
||||
|
||||
entry = &(panel->dir.list[panel->selected]);
|
||||
if ( ( S_ISDIR (entry->st.st_mode) && ( strcmp(entry->fname, "..") == 0 ) )
|
||||
|| panel->dirs_marked )
|
||||
dirsizes_cmd ();
|
||||
else
|
||||
single_dirsize_cmd ();
|
||||
}
|
||||
|
||||
void
|
||||
single_dirsize_cmd (void)
|
||||
{
|
||||
@ -1186,6 +1211,10 @@ single_dirsize_cmd (void)
|
||||
send_message (&(panel->widget), WIDGET_KEY, KEY_DOWN);
|
||||
|
||||
recalculate_panel_summary (panel);
|
||||
|
||||
if ( current_panel->sort_type == (sortfn *) sort_size )
|
||||
panel_re_sort (panel);
|
||||
|
||||
panel->dirty = 1;
|
||||
}
|
||||
|
||||
@ -1219,7 +1248,10 @@ dirsizes_cmd (void)
|
||||
compute_dir_size_destroy_ui (ui);
|
||||
|
||||
recalculate_panel_summary (panel);
|
||||
|
||||
if ( current_panel->sort_type == (sortfn *) sort_size )
|
||||
panel_re_sort (panel);
|
||||
|
||||
panel->dirty = 1;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ void fishlink_cmd (void);
|
||||
void smblink_cmd (void);
|
||||
void undelete_cmd (void);
|
||||
void help_cmd (void);
|
||||
void smart_dirsize_cmd (void);
|
||||
void single_dirsize_cmd (void);
|
||||
void dirsizes_cmd (void);
|
||||
int view_file_at_line (const char *filename, int plain_view, int internal,
|
||||
|
@ -1303,7 +1303,7 @@ static const key_map default_map[] = {
|
||||
{KEY_F (19), menu_last_selected_cmd},
|
||||
{KEY_F (20), quiet_quit_cmd},
|
||||
|
||||
{XCTRL ('@'), single_dirsize_cmd},
|
||||
{XCTRL ('@'), smart_dirsize_cmd},
|
||||
|
||||
/* Copy useful information to the command line */
|
||||
{ALT ('a'), copy_current_pathname},
|
||||
|
Loading…
Reference in New Issue
Block a user