21 #ifndef FM_MOUNTOPERATION_H 22 #define FM_MOUNTOPERATION_H 24 #include "libfmqtglobals.h" 46 explicit MountOperation(
bool interactive =
true, QWidget* parent = 0);
49 void mount(FmPath* path) {
50 GFile* gf = fm_path_to_gfile(path);
51 g_file_mount_enclosing_volume(gf, G_MOUNT_MOUNT_NONE, op, cancellable_, (GAsyncReadyCallback)onMountFileFinished,
new QPointer<MountOperation>(
this));
55 void mount(GVolume* volume) {
56 g_volume_mount(volume, G_MOUNT_MOUNT_NONE, op, cancellable_, (GAsyncReadyCallback)onMountVolumeFinished,
new QPointer<MountOperation>(
this));
59 void unmount(GMount* mount) {
60 prepareUnmount(mount);
61 g_mount_unmount_with_operation(mount, G_MOUNT_UNMOUNT_NONE, op, cancellable_, (GAsyncReadyCallback)onUnmountMountFinished,
new QPointer<MountOperation>(
this));
64 void unmount(GVolume* volume) {
65 GMount* mount = g_volume_get_mount(volume);
69 g_object_unref(mount);
72 void eject(GMount* mount) {
73 prepareUnmount(mount);
74 g_mount_eject_with_operation(mount, G_MOUNT_UNMOUNT_NONE, op, cancellable_, (GAsyncReadyCallback)onEjectMountFinished,
new QPointer<MountOperation>(
this));
77 void eject(GVolume* volume) {
78 GMount* mnt = g_volume_get_mount(volume);
81 g_volume_eject_with_operation(volume, G_MOUNT_UNMOUNT_NONE, op, cancellable_, (GAsyncReadyCallback)onEjectVolumeFinished,
new QPointer<MountOperation>(
this));
84 QWidget* parent()
const {
88 void setParent(QWidget* parent) {
92 GCancellable* cancellable()
const {
96 GMountOperation* mountOperation() {
101 g_cancellable_cancel(cancellable_);
104 bool isRunning()
const {
116 void setAutoDestroy(
bool destroy =
true) {
117 autoDestroy_ = destroy;
121 void finished(GError* error = NULL);
124 void prepareUnmount(GMount* mount);
126 static void onAskPassword(GMountOperation *_op, gchar* message, gchar* default_user, gchar* default_domain, GAskPasswordFlags flags,
MountOperation* pThis);
127 static void onAskQuestion(GMountOperation *_op, gchar* message, GStrv choices,
MountOperation* pThis);
131 static void onShowProcesses(GMountOperation *_op, gchar* message, GArray* processes, GStrv choices,
MountOperation* pThis);
132 static void onShowUnmountProgress(GMountOperation *_op, gchar* message, gint64 time_left, gint64 bytes_left,
MountOperation* pThis);
135 static void onMountFileFinished(GFile* file, GAsyncResult *res, QPointer<MountOperation>* pThis);
136 static void onMountVolumeFinished(GVolume* volume, GAsyncResult *res, QPointer<MountOperation>* pThis);
137 static void onUnmountMountFinished(GMount* mount, GAsyncResult *res, QPointer<MountOperation>* pThis);
138 static void onEjectMountFinished(GMount* mount, GAsyncResult *res, QPointer<MountOperation>* pThis);
139 static void onEjectVolumeFinished(GVolume* volume, GAsyncResult *res, QPointer<MountOperation>* pThis);
141 void handleFinish(GError* error);
145 GCancellable* cancellable_;
149 QEventLoop* eventLoop;
155 #endif // FM_MOUNTOPERATION_H Definition: appchoosercombobox.cpp:26
Definition: mountoperation.h:42