From b4b2d3b9b02064f8f1c945c7c724763ade40adfc Mon Sep 17 00:00:00 2001 From: Kimmo Pekkola Date: Tue, 10 Mar 2009 17:32:35 +0000 Subject: [PATCH] Free disk space can be read from the removable drives too. Size and count were reversed in the recycle manager. Fixed. --- Library/MeasureDiskSpace.cpp | 7 +++++-- Library/MeasureDiskSpace.h | 1 + Plugins/PluginRecycleManager/RecycleManager.cpp | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Library/MeasureDiskSpace.cpp b/Library/MeasureDiskSpace.cpp index 6765b42f..30efbd09 100644 --- a/Library/MeasureDiskSpace.cpp +++ b/Library/MeasureDiskSpace.cpp @@ -30,6 +30,8 @@ CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow) : CMeasure(meterWindow) { m_Total = false; + m_Label = false; + m_IgnoreRemovable = false; } /* @@ -55,7 +57,7 @@ bool CMeasureDiskSpace::Update() ULARGE_INTEGER i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes; UINT type = GetDriveType(m_Drive.c_str()); - if (type != DRIVE_CDROM && type != DRIVE_REMOVABLE) // Ignore CD-ROMS and removable drives + if (type != DRIVE_CDROM && (!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore CD-ROMS and removable drives { if(GetDiskFreeSpaceEx(m_Drive.c_str(), &i64FreeBytesToCaller, &i64TotalBytes, &i64FreeBytes)) { @@ -115,12 +117,13 @@ void CMeasureDiskSpace::ReadConfig(CConfigParser& parser, const WCHAR* section) m_Drive = parser.ReadString(section, L"Drive", L"C:\\"); m_Total = (1 == parser.ReadInt(section, L"Total", 0)); m_Label = (1 == parser.ReadInt(section, L"Label", 0)); + m_IgnoreRemovable = (1 == parser.ReadInt(section, L"IgnoreRemovable", 0)); // Set the m_MaxValue ULARGE_INTEGER i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes; UINT type = GetDriveType(m_Drive.c_str()); - if (type != DRIVE_CDROM && type != DRIVE_REMOVABLE) // Ignore CD-ROMS and removable drives + if (type != DRIVE_CDROM && (!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore CD-ROMS and removable drives { if(GetDiskFreeSpaceEx(m_Drive.c_str(), &i64FreeBytesToCaller, &i64TotalBytes, &i64FreeBytes)) { diff --git a/Library/MeasureDiskSpace.h b/Library/MeasureDiskSpace.h index bd4c55db..74286fef 100644 --- a/Library/MeasureDiskSpace.h +++ b/Library/MeasureDiskSpace.h @@ -36,6 +36,7 @@ private: std::wstring m_LabelName; bool m_Total; bool m_Label; + bool m_IgnoreRemovable; }; #endif diff --git a/Plugins/PluginRecycleManager/RecycleManager.cpp b/Plugins/PluginRecycleManager/RecycleManager.cpp index a1791a9b..3cfe8524 100644 --- a/Plugins/PluginRecycleManager/RecycleManager.cpp +++ b/Plugins/PluginRecycleManager/RecycleManager.cpp @@ -97,11 +97,11 @@ double Update2(UINT id) RecycleBinInfo.cbSize = sizeof( RecycleBinInfo ); // Tell size of structure SHQueryRecycleBin( L"C:", &RecycleBinInfo ); // Get recycle bin info - if (dataType == NUMRECYCLE) + if (dataType == SIZERECYCLE) { return (double)RecycleBinInfo.i64Size; // size in bytes } - else if (dataType == SIZERECYCLE) + else if (dataType == NUMRECYCLE) { return (double)RecycleBinInfo.i64NumItems; // number of items in bin }