Permalink
Browse files

[LINUX] Fix display of labelless mount points.

UDisks storage provider shouldn't assume volumes are in the GB range.
  • Loading branch information...
1 parent 8022115 commit 66d61d33900298fb7ee26843c73c21a5915c381e @t-nelson t-nelson committed Dec 10, 2013
Showing with 7 additions and 4 deletions.
  1. +6 −3 xbmc/storage/linux/UDisksProvider.cpp
  2. +1 −1 xbmc/storage/linux/UDisksProvider.h
@@ -39,7 +39,7 @@ CUDiskDevice::CUDiskDevice(const char *DeviceKitUDI)
m_isFileSystem = false;
m_isSystemInternal = false;
m_isOptical = false;
- m_PartitionSizeGiB = 0.0f;
+ m_PartitionSize = 0;
Update();
}
@@ -67,7 +67,7 @@ void CUDiskDevice::Update()
else
m_MountPath.clear();
- m_PartitionSizeGiB = properties["PartitionSize"].asUnsignedInteger() / 1024.0 / 1024.0 / 1024.0;
+ m_PartitionSize = properties["PartitionSize"].asUnsignedInteger();
m_isPartition = properties["DeviceIsPartition"].asBoolean();
m_isSystemInternal = properties["DeviceIsSystemInternal"].asBoolean();
m_isOptical = properties["DeviceIsOpticalDisc"].asBoolean();
@@ -140,7 +140,10 @@ CMediaSource CUDiskDevice::ToMediaShare()
CMediaSource source;
source.strPath = m_MountPath;
if (m_Label.empty())
- source.strName = StringUtils::Format("%.1f GB %s", m_PartitionSizeGiB, g_localizeStrings.Get(155).c_str());
+ {
+ std::string strSize = StringUtils::SizeToString(m_PartitionSize);
+ source.strName = StringUtils::Format("%s %s", strSize.c_str(), g_localizeStrings.Get(155).c_str());
+ }
else
source.strName = m_Label;
if (m_isOptical)
@@ -41,7 +41,7 @@ class CUDiskDevice
CStdString m_UDI, m_DeviceKitUDI, m_MountPath, m_FileSystem, m_Label;
bool m_isMounted, m_isMountedByUs, m_isRemovable, m_isPartition, m_isFileSystem, m_isSystemInternal, m_isOptical;
- float m_PartitionSizeGiB;
+ int64_t m_PartitionSize;
};
class CUDisksProvider : public IStorageProvider

0 comments on commit 66d61d3

Please sign in to comment.