Further cleanup of TrackerLoopControl. gStatusWindow is now nowhere used anymore

except inside TrackerLoopControl. The only expected change of behavior is when
trying to copy something onto a read-only volume. AFAICS, it would previously
prompt an alert and not already show the status window. Now it will show the
status window and prompt an alert, like in all the other situations when the
operation would be stopped before it even started by an alert. I was able to
remove quite a few code duplications along the way. CopyLoopControl can be
instantiated by itself and provides default implementations which could in turn
be removed from TrackerLoopControl.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35115 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-01-17 13:32:06 +00:00
parent d3bb2b9543
commit 3cc5c3ffb1
3 changed files with 187 additions and 144 deletions
+8 -4
View File
@@ -727,7 +727,9 @@ BInfoWindow::CalcSize(void *castToWindow)
off_t size = 0;
int32 fileCount = 0;
int32 dirCount = 0;
FSRecursiveCalcSize(window, &dir, &size, &fileCount, &dirCount);
CopyLoopControl loopControl;
FSRecursiveCalcSize(window, &loopControl, &dir, &size, &fileCount,
&dirCount);
// got the size value, update the size string
GetSizeString(sizeString, size, fileCount);
@@ -751,8 +753,9 @@ BInfoWindow::CalcSize(void *castToWindow)
BDirectory trashDir;
if (FSGetTrashDir(&trashDir, volume.Device()) == B_OK) {
FSRecursiveCalcSize(window, &trashDir, &currentSize,
&currentFileCount, &currentDirCount);
CopyLoopControl loopControl;
FSRecursiveCalcSize(window, &loopControl, &trashDir,
&currentSize, &currentFileCount, &currentDirCount);
totalSize += currentSize;
totalFileCount += currentFileCount;
totalDirCount += currentDirCount;
@@ -761,9 +764,10 @@ BInfoWindow::CalcSize(void *castToWindow)
GetSizeString(sizeString, totalSize, totalFileCount);
}
if (window->StopCalc())
if (window->StopCalc()) {
// window closed, bail
return B_OK;
}
AutoLock<BWindow> lock(window);
if (lock.IsLocked())