godu icon indicating copy to clipboard operation
godu copied to clipboard

Allow keystroke to remove/rescan selected file/dir

Open metakeule opened this issue 8 years ago • 3 comments

The idea is to have a shortcut like 'x' or 'r' to remove the selected file/dir when scrolling trough the view and have the view jump to the upper directory and refresh this one as well as every directory above by a simple substraction (without a scan).

Also a shortcut to rescan the selected directory would be cool (if other apps changed it).

metakeule avatar Apr 10 '18 06:04 metakeule

That's a good idea. That will require some changes to the core design since godu has been designed to be read only, 1 walk through. I'll think about it and I'm open to suggestions.

viktomas avatar Apr 12 '18 22:04 viktomas

I did not have a look at the code, but from the top of my head, I would suggest something like this:

A tree structure: parent-nodes that are directories to child-nodes that are directories or files. Each node would have 5 properties: 'name', 'size' (in bytes), 'path' (or 'parents'), 'children' and an 'isDirectory' boolean. Now when a node gets deleted, each node of the path is visited and the size of the deleted node is subtracted from each parent node. When a rescan is done, the difference between the former size and the new size is calculated and added to each parent node.

metakeule avatar Apr 13 '18 22:04 metakeule

The structure you described roughly reflects the implementation. The main issue I see is that the original design parses the file data into a read-only structure.

viktomas avatar May 22 '18 22:05 viktomas