feat: add binding for g_file_find_enclosing_mount().

This commit is contained in:
Chris Xiong 2019-11-13 16:37:02 +08:00
parent 3f5bf7c081
commit 4fb8986d11
2 changed files with 16 additions and 0 deletions

View File

@ -37,6 +37,7 @@ enum DGioFileQueryInfoFlag
Q_DECLARE_FLAGS(DGioFileQueryInfoFlags, DGioFileQueryInfoFlag) Q_DECLARE_FLAGS(DGioFileQueryInfoFlags, DGioFileQueryInfoFlag)
class DGioFileInfo; class DGioFileInfo;
class DGioMount;
class DGioFileIterator; class DGioFileIterator;
class DGioMountOperation; class DGioMountOperation;
class DGioFilePrivate; class DGioFilePrivate;
@ -62,6 +63,8 @@ public:
void mountEnclosingVolume(DGioMountOperation *dgioMountOperation); void mountEnclosingVolume(DGioMountOperation *dgioMountOperation);
QExplicitlySharedDataPointer<DGioMount> findEnclosingMount();
Q_SIGNALS: Q_SIGNALS:
void createFileIteratorReady(QExplicitlySharedDataPointer<DGioFileIterator> iter); void createFileIteratorReady(QExplicitlySharedDataPointer<DGioFileIterator> iter);
void mountEnclosingVolumeReady(bool result, QString msg); void mountEnclosingVolumeReady(bool result, QString msg);

View File

@ -21,6 +21,7 @@
#include "dgiofile.h" #include "dgiofile.h"
#include "dgiofileinfo.h" #include "dgiofileinfo.h"
#include "dgiofileiterator.h" #include "dgiofileiterator.h"
#include "dgiomount.h"
#include <glibmm/refptr.h> #include <glibmm/refptr.h>
@ -343,3 +344,15 @@ void DGioFile::mountEnclosingVolume(DGioMountOperation *dgioMountOperation)
d->getGmmFileInstance()->mount_enclosing_volume(dgioMountOperation->getGIOMountOperationObj(), d->getGmmFileInstance()->mount_enclosing_volume(dgioMountOperation->getGIOMountOperationObj(),
sigc::mem_fun(d, &DGioFilePrivate::slot_mountEnclosingVolumeResult)); sigc::mem_fun(d, &DGioFilePrivate::slot_mountEnclosingVolumeResult));
} }
QExplicitlySharedDataPointer<DGioMount> DGioFile::findEnclosingMount()
{
Q_D(DGioFile);
QExplicitlySharedDataPointer<DGioMount> ret;
try {
ret = new DGioMount(d->getGmmFileInstance()->find_enclosing_mount().release());
} catch (const Glib::Error &error) {
qDebug() << QString::fromStdString(error.what().raw());
}
return ret;
}