Skip to content

Commit

Permalink
[LINUX] Fix display of labelless mount points.
Browse files Browse the repository at this point in the history
UDisks storage provider shouldn't assume volumes are in the GB range.
  • Loading branch information
t-nelson committed Dec 10, 2013
1 parent 8022115 commit 66d61d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions xbmc/storage/linux/UDisksProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/storage/linux/UDisksProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 66d61d3

Please sign in to comment.