mirror of
https://github.com/linuxdeepin/gio-qt.git
synced 2024-11-10 12:03:46 +01:00
feat: add sketchy way to get the type of a volume.
This commit is contained in:
parent
5fb3db906e
commit
68d2e61e2c
@ -47,6 +47,7 @@ public:
|
|||||||
~DGioVolume();
|
~DGioVolume();
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
|
QString volumeMonitorName() const;
|
||||||
bool canMount() const;
|
bool canMount() const;
|
||||||
bool canEject() const;
|
bool canEject() const;
|
||||||
bool shouldAutoMount() const;
|
bool shouldAutoMount() const;
|
||||||
|
@ -84,6 +84,17 @@ QString DGioVolume::name() const
|
|||||||
return d->name();
|
return d->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DGioVolume::volumeMonitorName() const
|
||||||
|
{
|
||||||
|
Q_D(const DGioVolume);
|
||||||
|
|
||||||
|
if (QString(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(d->m_gmmVolumePtr->gobj()))) == "GProxyVolume") {
|
||||||
|
return (const char*)g_object_get_data(G_OBJECT(d->m_gmmVolumePtr->gobj()), "g-proxy-volume-volume-monitor-name");
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
bool DGioVolume::canMount() const
|
bool DGioVolume::canMount() const
|
||||||
{
|
{
|
||||||
Q_D(const DGioVolume);
|
Q_D(const DGioVolume);
|
||||||
|
@ -123,10 +123,12 @@ int main(int argc, char * argv[])
|
|||||||
const QList<QExplicitlySharedDataPointer<DGioVolume> > vols = DGioVolumeManager::getVolumes();
|
const QList<QExplicitlySharedDataPointer<DGioVolume> > vols = DGioVolumeManager::getVolumes();
|
||||||
|
|
||||||
for (const QExplicitlySharedDataPointer<DGioVolume> &p : vols) {
|
for (const QExplicitlySharedDataPointer<DGioVolume> &p : vols) {
|
||||||
qDebug() << p->name()
|
qDebug() << p->name() << p->volumeMonitorName()
|
||||||
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_UUID)
|
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_UUID)
|
||||||
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_CLASS)
|
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_CLASS)
|
||||||
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_LABEL);
|
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_LABEL)
|
||||||
|
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_NFS_MOUNT)
|
||||||
|
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_UNIX_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "----------drives------------";
|
qDebug() << "----------drives------------";
|
||||||
|
Loading…
Reference in New Issue
Block a user