[glibmm] unmount_mountable(), eject_mountable(): Add overrides with MountOperation.



commit 28ffa7f402509bf79fd62ef6a623edca3a7ea5b9
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 28 12:27:46 2010 +0100

    unmount_mountable(), eject_mountable(): Add overrides with MountOperation.
    
    * gio/src/file.[hg|ccg]: unmount_mountable(), eject_mountable():
    Reimplement these with the new *_with_operation functions.
    Undeprecate them - that should not have happened without replacements.
    Added unmount_mountable() and eject_mountable() overrides with
    MountOperation parameters. Unfortunately there are now 6 of each.

 ChangeLog        |   10 +++++
 gio/src/file.ccg |  119 ++++++++++++++++++++++++++++++++++++++++++++++--------
 gio/src/file.hg  |   86 +++++++++++++++++++++++++++++++++-----
 3 files changed, 186 insertions(+), 29 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 74fdc76..5f78d25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-01-28  Murray Cumming  <murrayc murraycv>
+
+	unmount_mountable(), eject_mountable(): Add overrides with MountOperation.
+
+	* gio/src/file.[hg|ccg]: unmount_mountable(), eject_mountable(): 
+	Reimplement these with the new *_with_operation functions.
+	Undeprecate them - that should not have happened without replacements.
+	Added unmount_mountable() and eject_mountable() overrides with 
+	MountOperation parameters. Unfortunately there are now 6 of each.
+
 2010-01-28  Murray Cumming  <murrayc murrayc com>
 
 	File, Cancellable: Added some new methods.
diff --git a/gio/src/file.ccg b/gio/src/file.ccg
index 2d38fb4..bede099 100644
--- a/gio/src/file.ccg
+++ b/gio/src/file.ccg
@@ -1145,8 +1145,6 @@ void File::mount_mountable(MountMountFlags flags)
                          NULL);
 }
 
-#ifndef GIOMM_DISABLE_DEPRECATED
-
 void File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
 {
   // Create a copy of the slot.
@@ -1154,8 +1152,9 @@ void File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Canc
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_file_unmount_mountable(gobj(),
-                           static_cast<GMountUnmountFlags>(flags), 
+  g_file_unmount_mountable_with_operation(gobj(),
+                           static_cast<GMountUnmountFlags>(flags),
+                           0,
                            cancellable->gobj(),
                            &SignalProxy_async_callback,
                            slot_copy);
@@ -1169,8 +1168,9 @@ File::unmount_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags)
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_file_unmount_mountable(gobj(),
-                           static_cast<GMountUnmountFlags>(flags), 
+  g_file_unmount_mountable_with_operation(gobj(),
+                           static_cast<GMountUnmountFlags>(flags),
+                           0,
                            NULL,
                            &SignalProxy_async_callback,
                            slot_copy);
@@ -1179,14 +1179,57 @@ File::unmount_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags)
 void
 File::unmount_mountable(MountUnmountFlags flags)
 {
-  g_file_unmount_mountable(gobj(),
+  g_file_unmount_mountable_with_operation(gobj(),
+                           static_cast<GMountUnmountFlags>(flags), 
+                           0,
+                           NULL,
+                           NULL,
+                           NULL);
+}
+
+void File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& mount_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_unmount_mountable_with_operation(gobj(),
+                           static_cast<GMountUnmountFlags>(flags),
+                           Glib::unwrap(mount_operation),
+                           cancellable->gobj(),
+                           &SignalProxy_async_callback,
+                           slot_copy);
+}
+
+void
+File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& mount_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_unmount_mountable_with_operation(gobj(),
+                           static_cast<GMountUnmountFlags>(flags),
+                           Glib::unwrap(mount_operation),
+                           NULL,
+                           &SignalProxy_async_callback,
+                           slot_copy);
+}
+
+void
+File::unmount_mountable(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags)
+{
+  g_file_unmount_mountable_with_operation(gobj(),
                            static_cast<GMountUnmountFlags>(flags), 
+                           Glib::unwrap(mount_operation),
                            NULL,
                            NULL,
                            NULL);
 }
 
-#endif /* !GIOMM_DISABLE_DEPRECATED */
+
 
 void File::mount_enclosing_volume(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags)
 {
@@ -1243,7 +1286,48 @@ void File::mount_enclosing_volume(MountMountFlags flags)
                          NULL);
 }
 
-#ifndef GIOMM_DISABLE_DEPRECATED
+void
+File::eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& mount_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_eject_mountable_with_operation(gobj(),
+                         static_cast<GMountUnmountFlags>(flags),
+                         Glib::unwrap(mount_operation),
+                         cancellable->gobj(),
+                         &SignalProxy_async_callback,
+                         slot_copy);
+}
+
+void
+File::eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& mount_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_eject_mountable_with_operation(gobj(),
+                         static_cast<GMountUnmountFlags>(flags),
+                         Glib::unwrap(mount_operation),
+                         NULL,
+                         &SignalProxy_async_callback,
+                         slot_copy);
+}
+
+void
+File::eject_mountable(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags)
+{
+  g_file_eject_mountable_with_operation(gobj(),
+                         static_cast<GMountUnmountFlags>(flags),
+                         Glib::unwrap(mount_operation),
+                         NULL,
+                         NULL,
+                         NULL);
+}
 
 void
 File::eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
@@ -1253,8 +1337,9 @@ File::eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_file_eject_mountable(gobj(),
-                         static_cast<GMountUnmountFlags>(flags), 
+  g_file_eject_mountable_with_operation(gobj(),
+                         static_cast<GMountUnmountFlags>(flags),
+                         0,
                          cancellable->gobj(),
                          &SignalProxy_async_callback,
                          slot_copy);
@@ -1268,8 +1353,9 @@ File::eject_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags)
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_file_eject_mountable(gobj(),
-                         static_cast<GMountUnmountFlags>(flags), 
+  g_file_eject_mountable_with_operation(gobj(),
+                         static_cast<GMountUnmountFlags>(flags),
+                         0,
                          NULL,
                          &SignalProxy_async_callback,
                          slot_copy);
@@ -1278,15 +1364,14 @@ File::eject_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags)
 void
 File::eject_mountable(MountUnmountFlags flags)
 {
-  g_file_eject_mountable(gobj(),
-                         static_cast<GMountUnmountFlags>(flags), 
+  g_file_eject_mountable_with_operation(gobj(),
+                         static_cast<GMountUnmountFlags>(flags),
+                         0,
                          NULL,
                          NULL,
                          NULL);
 }
 
-#endif /* !GIOMM_DISABLE_DEPRECATED */
-
 void
 File::load_contents_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
 {
diff --git a/gio/src/file.hg b/gio/src/file.hg
index 908a3bc..93a4504 100644
--- a/gio/src/file.hg
+++ b/gio/src/file.hg
@@ -547,7 +547,7 @@ public:
   _IGNORE(g_file_open_readwrite_async)
 
   _WRAP_METHOD(Glib::RefPtr<FileIOStream> open_readwrite_finish(const Glib::RefPtr<AsyncResult>& result),
-               g_file_replace_readwrite_finish,
+               g_file_open_readwrite_finish,
                refreturn, errthrow)
 
 
@@ -575,7 +575,7 @@ public:
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 
 
-  /**  /** Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first.
+  /** Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first.
    * 
    * If the file doesn't exist, it will be created.
    *
@@ -604,6 +604,7 @@ public:
   /** Asyncronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.
    *
    * For more details, see replace_readwrite() which is the synchronous version of this call.
+   *
    * When the operation is finished, @a slot will be called. You can then call replace_readwrite_finish() to get the result of the operation.
    *
    * @param slot A callback slot which will be called when the request is satisfied.
@@ -631,7 +632,7 @@ public:
    * @newin2p22
    */
   void replace_readwrite_async(const SlotAsyncReady& slot, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT);
-  _IGNORE(g_file_replace_async)
+  _IGNORE(g_file_replace_readwrite_async)
 
   _WRAP_METHOD(Glib::RefPtr<FileIOStream> replace_readwrite_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_replace_readwrite_finish,
@@ -1642,8 +1643,6 @@ public:
                g_file_mount_mountable_finish,
                refreturn, errthrow)
 
-_DEPRECATE_IFDEF_START
-
   /** Unmounts a file of type FILE_TYPE_MOUNTABLE.
    *
    * The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, 
@@ -1671,10 +1670,42 @@ _DEPRECATE_IFDEF_START
    * @param flags Flags affecting the operation.
    */
   void unmount_mountable(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
-  _IGNORE(g_file_unmount_mountable)
+
+  /** Unmounts a file of type FILE_TYPE_MOUNTABLE.
+   *
+   * 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.
+   *
+   * When the operation is finished, @a slot will be called. You can then call unmount_mountable_finish() to get the result of the operation.
+   *
+   * @param slot A callback slot which will be called when the request is satisfied.
+   * @param cancellable A Cancellable object which can be used to cancel the operation.
+   * @param mount_operation A MountOperation
+   * @param flags Flags affecting the operation.
+   */
+  void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+
+  /** Unmounts a file of type FILE_TYPE_MOUNTABLE.
+   *
+   * When the operation is finished, @a slot will be called. You can then call unmount_mountable_finish() to get the result of the operation.
+   *
+   * @param slot A callback slot which will be called when the request is satisfied.
+   * @param mount_operation A MountOperation
+   * @param flags Flags affecting the operation.
+   */
+  void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+
+  /** Unmounts a file of type FILE_TYPE_MOUNTABLE.
+   *
+   * @param mount_operation A MountOperation
+   * @param flags Flags affecting the operation.
+   */
+  void unmount_mountable(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+
+  _IGNORE(g_file_unmount_mountable, g_file_unmount_mountable_finish, g_file_unmount_mountable_with_operation)
 
   _WRAP_METHOD(bool unmount_mountable_finish(const Glib::RefPtr<AsyncResult>& result),
-               g_file_unmount_mountable_finish,
+               g_file_unmount_mountable_with_operation_finish,
                errthrow)
 
   /** Starts an asynchronous eject on a mountable.
@@ -1684,9 +1715,9 @@ _DEPRECATE_IFDEF_START
    *
    * When the operation is finished, @a slot will be called. You can then call eject_mountable_finish() to get the result of the operation.
    *
-   * @param flags Flags affecting the operation.
-   * @param cancellable A Cancellable object which can be used to cancel the operation.
    * @param slot A callback slot which will be called when the request is satisfied.
+   * @param cancellable A Cancellable object which can be used to cancel the operation.
+   * @param flags Flags affecting the operation.
    */
   void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
@@ -1704,13 +1735,44 @@ _DEPRECATE_IFDEF_START
    * @param flags Flags affecting the operation.
    */
   void eject_mountable(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
-  _IGNORE(g_file_eject_mountable)
+
+  /** Starts an asynchronous eject on a mountable.
+   *
+   * 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.
+   *
+   * When the operation is finished, @a slot will be called. You can then call eject_mountable_finish() to get the result of the operation.
+   *
+   * @param slot A callback slot which will be called when the request is satisfied.
+   * @param cancellable A Cancellable object which can be used to cancel the operation.
+   * @param mount_operation A MountOperation
+   * @param flags Flags affecting the operation.
+   */
+  void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+
+  /** Starts an asynchronous eject on a mountable.
+   *
+   * When the operation is finished, @a slot will be called. You can then call eject_mountable_finish() to get the result of the operation.
+   *
+   * @param slot A callback slot which will be called when the request is satisfied.
+   * @param mount_operation A MountOperation
+   * @param flags Flags affecting the operation.
+   */
+  void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+
+  /** Starts an asynchronous eject on a mountable.
+   *
+   * @param mount_operation A MountOperation
+   * @param flags Flags affecting the operation.
+   */
+  void eject_mountable(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+
+  _IGNORE(g_file_eject_mountable, g_file_eject_mountable_finish, g_file_eject_mountable_with_operation)
 
   _WRAP_METHOD(bool eject_mountable_finish(const Glib::RefPtr<AsyncResult>& result),
-               g_file_eject_mountable_finish,
+               g_file_eject_mountable_with_operation_finish,
                errthrow)
 
-_DEPRECATE_IFDEF_END
 
   /** Copies the file attributes from @a source to @a destination. 
    *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]