Skip to content

Draft: Partial rescan support

Chris Heywood requested to merge cheywood/baobab:partial-rescan into main

This adds support for rescanning individual directories or files within the original location.

It works something like this:

  1. The user uses the menu on the chart or tree to select Rescan
  2. The location for the partial rescan is sent to the Scanner
  3. The scanner removes the previous size and element count for this part of the tree from its totals
  4. The special case of a rescan on a removed location is handled
  5. The scanner thread kicks off
  6. The special case of a single file rescan is handled, otherwise a directory scan is started, similar to the main scan
  7. While processing results the parent of the partial scan location is set to be the parent of the new child for the partial scan location
  8. When the scan completes..
    1. Updated percentages for the rescan level are calculated using the new figures plus the values in the model. These are then then bubbled up the tree.
    2. The maximum depth is re-calculated in a direct way. There are likely faster ways to go about this at the cost of more memory.
  9. The UI is notified

The TreeModel is retained between partial rescans, with the values in the model being used for calculations at the end of the rescan process.

In its current implementation the UI is disabled while the rescan is underway, ala the primary scan. Ideally only certain interactions would be disabled, but I'm envisaging that maybe being a piece of work that could be broken off separately. One of the reasons for the current approach is that the model needed to be detached from the treeview during the rescan otherwise I think it's attempting to filter the model while it's also getting updated in the scanner. On large scans this bogs down the UI and locks up the application. I'm still pretty new to GNOME dev though so would be happy to hear if there's an easy way around this 😄

It seems to be working reasonably well and is a useful thing to have.

Like I mentioned in the commit log the scanner callback methods in the Window could perhaps do with some merging/cleanup and I'm sure there'll be other things to look at too 🙂

Fixes #12 and fixes #40

Edited by Jeff Fortin

Merge request reports