[glibmm] File: Added start_mountable(), stop_mountable(), poll_mountable().
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glibmm] File: Added start_mountable(), stop_mountable(), poll_mountable().
- Date: Thu, 28 Jan 2010 16:54:37 +0000 (UTC)
commit 86afa68c0ebc879a88e86b8e536c91765930363f
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jan 28 17:53:55 2010 +0100
File: Added start_mountable(), stop_mountable(), poll_mountable().
* gio/src/drive.[hg|ccg]:
* gio/src/mount.hg:
* gio/src/volume.hg: Change some includes to allow file.h to include
more.
* gio/src/file.[hg|ccg]: Added start_mountable(), stop_mountable(),
poll_mountable() and the *_finish() methods. The awful documenation
will be improved when I have improved it (tomorrow) for the C functions.
ChangeLog | 12 +++++
gio/src/drive.ccg | 1 +
gio/src/drive.hg | 1 +
gio/src/file.ccg | 86 ++++++++++++++++++++++++++++++++++
gio/src/file.hg | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++-
gio/src/mount.hg | 15 ++++--
gio/src/volume.hg | 1 +
7 files changed, 243 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index de7b4bb..07f8972 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2010-01-28 Murray Cumming <murrayc murrayc com>
+ File: Added start_mountable(), stop_mountable(), poll_mountable().
+
+ * gio/src/drive.[hg|ccg]:
+ * gio/src/mount.hg:
+ * gio/src/volume.hg: Change some includes to allow file.h to include
+ more.
+ * gio/src/file.[hg|ccg]: Added start_mountable(), stop_mountable(),
+ poll_mountable() and the *_finish() methods. The awful documenation
+ will be improved when I have improved it (tomorrow) for the C functions.
+
+2010-01-28 Murray Cumming <murrayc murrayc com>
+
* gio/src/file.hg: Correct/Add newin2p* doxygen comments.
2010-01-28 Murray Cumming <murrayc murrayc com>
diff --git a/gio/src/drive.ccg b/gio/src/drive.ccg
index 4741f81..ee3f485 100644
--- a/gio/src/drive.ccg
+++ b/gio/src/drive.ccg
@@ -18,6 +18,7 @@
*/
#include <gio/gio.h>
+#include <giomm/volume.h>
#include <glibmm/error.h>
#include <glibmm/exceptionhandler.h>
#include "slot_async.h"
diff --git a/gio/src/drive.hg b/gio/src/drive.hg
index e82496f..ddfe803 100644
--- a/gio/src/drive.hg
+++ b/gio/src/drive.hg
@@ -19,6 +19,7 @@
#include <giomm/mount.h>
#include <giomm/icon.h>
+//#include <giomm/volume.h>
//#include <giomm/mountoperation.h>
_DEFS(giomm,gio)
diff --git a/gio/src/file.ccg b/gio/src/file.ccg
index 48187ab..35fac1b 100644
--- a/gio/src/file.ccg
+++ b/gio/src/file.ccg
@@ -1896,6 +1896,92 @@ Glib::RefPtr<FileMonitor> File::monitor(FileMonitorFlags flags, std::auto_ptr<G
return retvalue;
}
+void File::start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& start_operation, DriveStartFlags flags)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_file_start_mountable(gobj(),
+ ((GDriveStartFlags)(flags)),
+ Glib::unwrap(start_operation),
+ Glib::unwrap(cancellable),
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+void File::start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& start_operation, DriveStartFlags flags)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_file_start_mountable(gobj(),
+ ((GDriveStartFlags)(flags)),
+ Glib::unwrap(start_operation),
+ 0,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+void File::stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& start_operation, MountUnmountFlags flags)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_file_stop_mountable(gobj(),
+ ((GMountUnmountFlags)(flags)),
+ Glib::unwrap(start_operation),
+ Glib::unwrap(cancellable),
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+void File::stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& start_operation, MountUnmountFlags flags)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_file_stop_mountable(gobj(),
+ ((GMountUnmountFlags)(flags)),
+ Glib::unwrap(start_operation),
+ 0,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+
+void File::poll_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_file_poll_mountable(gobj(),
+ Glib::unwrap(cancellable),
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+void File::poll_mountable(const SlotAsyncReady& slot)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_file_poll_mountable(gobj(),
+ 0,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInputStream> File::read()
diff --git a/gio/src/file.hg b/gio/src/file.hg
index 1fe510c..74eba53 100644
--- a/gio/src/file.hg
+++ b/gio/src/file.hg
@@ -33,6 +33,7 @@
#include <giomm/filemonitor.h>
#include <giomm/fileoutputstream.h>
#include <giomm/mountoperation.h>
+#include <giomm/drive.h>
#include <giomm/error.h> //Because this is thrown by some of these methods.
//#include <giomm/volume.h>
@@ -53,8 +54,7 @@ _WRAP_ENUM(FileQueryInfoFlags, GFileQueryInfoFlags, NO_GTYPE)
_WRAP_ENUM(FileCreateFlags, GFileCreateFlags, NO_GTYPE)
_WRAP_ENUM(FileCopyFlags, GFileCopyFlags, NO_GTYPE)
_WRAP_ENUM(FileMonitorFlags, GFileMonitorFlags, NO_GTYPE)
-_WRAP_ENUM(MountUnmountFlags, GMountUnmountFlags, NO_GTYPE)
-_WRAP_ENUM(MountMountFlags, GMountMountFlags, NO_GTYPE)
+
/** File and directory handling.
* Gio::File is a high level abstraction for manipulating files on a virtual file system. Gio::Files are lightweight, immutable objects that do no
@@ -396,7 +396,7 @@ public:
#else
Glib::RefPtr<FileIOStream> create_file_readwrite(FileCreateFlags flags, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
- _IGNORE(g_file_create)
+ _IGNORE(g_file_create_readwrite)
@@ -2030,6 +2030,134 @@ public:
#endif //GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_file_monitor)
+ //TODO: The documentation for these start/stop/poll_mountable functions needs to be improved once we've figured out what they do and what the C documentation means. murrayc.
+
+ /** Starts a file of type Mountable.
+ * Using @a start_operation, you can request callbacks when, for instance,
+ * passwords are needed during authentication.
+ *
+ * When this operation has completed, @a slot will be called
+ * and the operation can be finalized with start_mountable_finish().
+ *
+ * The operation can be cancelled by
+ * triggering the cancellable object from another thread. If the operation
+ * was cancelled, a Gio::Error with CANCELLED will be thrown.
+ *
+ * @param slot: A callback to call when the request is satisfied.
+ * @param cancellable A Cancellable object.
+ * @param flags Flags affecting the operation
+ *
+ * @newin2p24
+ */
+ void start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& start_operation, DriveStartFlags flags = DRIVE_START_NONE);
+
+ /** Starts a file of type Mountable.
+ * Using @a start_operation, you can request callbacks when, for instance,
+ * passwords are needed during authentication.
+ *
+ * When this operation has completed, @a slot will be called
+ * and the operation can be finalized with start_mountable_finish().
+ *
+ * The operation can be cancelled by
+ * triggering the cancellable object from another thread. If the operation
+ * was cancelled, a Gio::Error with CANCELLED will be thrown.
+ *
+ * @param slot: A callback to call when the request is satisfied.
+ * @param cancellable A Cancellable object.
+ * @param flags Flags affecting the operation
+ *
+ * @newin2p24
+ */
+ void start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& start_operation, DriveStartFlags flags = DRIVE_START_NONE);
+ _IGNORE(g_file_start_mountable)
+
+ _WRAP_METHOD(bool start_mountable_finish(const Glib::RefPtr<AsyncResult>& result),
+ g_file_start_mountable_finish, errthrow)
+
+
+ /** Stops a file of type Mountable.
+ * Using @a start_operation, you can request callbacks when, for instance,
+ * passwords are needed during authentication.
+ *
+ * When this operation has completed, @a slot will be called
+ * and the operation can be finalized with stop_mountable_finish().
+ *
+ * The operation can be cancelled by
+ * triggering the cancellable object from another thread. If the operation
+ * was cancelled, a Gio::Error with CANCELLED will be thrown.
+ *
+ * @param slot: A callback to call when the request is satisfied.
+ * @param cancellable A Cancellable object.
+ * @param flags Flags affecting the operation
+ *
+ * @newin2p24
+ */
+ void stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& start_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+
+
+ /** Stops a file of type Mountable.
+ * Using @a start_operation, you can request callbacks when, for instance,
+ * passwords are needed during authentication.
+ *
+ * When this operation has completed, @a slot will be called
+ * and the operation can be finalized with stop_mountable_finish().
+ *
+ * The operation can be cancelled by
+ * triggering the cancellable object from another thread. If the operation
+ * was cancelled, a Gio::Error with CANCELLED will be thrown.
+ *
+ * @param slot: A callback to call when the request is satisfied.
+ * @param start_operation A Cancellable object.
+ * @param flags Flags affecting the operation
+ *
+ * @newin2p24
+ */
+ void stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& start_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+ _IGNORE(g_file_stop_mountable)
+
+ _WRAP_METHOD(bool stop_mountable_finish(const Glib::RefPtr<AsyncResult>& result),
+ g_file_stop_mountable_finish, errthrow)
+
+
+ /** Polls a file of type Mountable.
+ * Using @a start_operation, you can request callbacks when, for instance,
+ * passwords are needed during authentication.
+ *
+ * When this operation has completed, @a slot will be called
+ * and the operation can be finalized with stop_mountable_finish().
+ *
+ * The operation can be cancelled by
+ * triggering the cancellable object from another thread. If the operation
+ * was cancelled, a Gio::Error with CANCELLED will be thrown.
+ *
+ * @param slot: A callback to call when the request is satisfied.
+ * @param cancellable A Cancellable object.
+ *
+ * @newin2p24
+ */
+ void poll_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
+
+
+ /** Polls a file of type Mountable.
+ * Using @a start_operation, you can request callbacks when, for instance,
+ * passwords are needed during authentication.
+ *
+ * When this operation has completed, @a slot will be called
+ * and the operation can be finalized with stop_mountable_finish().
+ *
+ * The operation can be cancelled by
+ * triggering the cancellable object from another thread. If the operation
+ * was cancelled, a Gio::Error with CANCELLED will be thrown.
+ *
+ * @param slot: A callback to call when the request is satisfied.
+ *
+ * @newin2p24
+ */
+ void poll_mountable(const SlotAsyncReady& slot);
+ _IGNORE(g_file_poll_mountable)
+
+ _WRAP_METHOD(bool poll_mountable_finish(const Glib::RefPtr<AsyncResult>& result),
+ g_file_poll_mountable_finish, errthrow)
_WRAP_METHOD(Glib::RefPtr<AppInfo> query_default_handler(const Glib::RefPtr<Cancellable>& cancellable),
g_file_query_default_handler,
diff --git a/gio/src/mount.hg b/gio/src/mount.hg
index 57b072b..c62ffe8 100644
--- a/gio/src/mount.hg
+++ b/gio/src/mount.hg
@@ -18,9 +18,13 @@
*/
//#include <giomm/drive.h>
-#include <giomm/file.h>
-#include <giomm/volume.h>
+//#include <giomm/file.h>
+//#include <giomm/volume.h>
#include <glibmm/interface.h>
+#include <giomm/asyncresult.h>
+#include <giomm/cancellable.h>
+#include <giomm/mountoperation.h>
+#include <giomm/icon.h>
_DEFS(giomm,gio)
@@ -30,12 +34,15 @@ _PINCLUDE(glibmm/private/interface_p.h)
typedef struct _GMountIface GMountIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
namespace Gio
{
+_WRAP_ENUM(MountUnmountFlags, GMountUnmountFlags, NO_GTYPE)
+_WRAP_ENUM(MountMountFlags, GMountMountFlags, NO_GTYPE)
+
+class File;
class Drive;
-//class Volume;
+class Volume;
/** The Mount interface represents user-visible mounts.
* Mount is a "mounted" filesystem that you can access. Mounted is in quotes because it's not the same as a unix mount:
diff --git a/gio/src/volume.hg b/gio/src/volume.hg
index 973649d..2f9cfb1 100644
--- a/gio/src/volume.hg
+++ b/gio/src/volume.hg
@@ -19,6 +19,7 @@
#include <giomm/file.h>
#include <giomm/mountoperation.h>
+#include <giomm/mount.h>
//#include <giomm/drive.h>
//#include <giomm/icon.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]