forked from mirrors/gio-qt
feat: add sketchy way to get the type of a volume.
This commit is contained in:
parent
5fb3db906e
commit
68d2e61e2c
3 changed files with 16 additions and 2 deletions
|
@ -47,6 +47,7 @@ public:
|
|||
~DGioVolume();
|
||||
|
||||
QString name() const;
|
||||
QString volumeMonitorName() const;
|
||||
bool canMount() const;
|
||||
bool canEject() const;
|
||||
bool shouldAutoMount() const;
|
||||
|
|
|
@ -84,6 +84,17 @@ QString DGioVolume::name() const
|
|||
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
|
||||
{
|
||||
Q_D(const DGioVolume);
|
||||
|
|
|
@ -123,10 +123,12 @@ int main(int argc, char * argv[])
|
|||
const QList<QExplicitlySharedDataPointer<DGioVolume> > vols = DGioVolumeManager::getVolumes();
|
||||
|
||||
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_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------------";
|
||||
|
|
Loading…
Reference in a new issue