[glibmm] Wrap g_drive_eject_with_operation() and related functions



commit 42e0376470774c33e8bbeea7e029403794f37fa2
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Thu Jul 9 22:13:27 2009 +0100

    Wrap g_drive_eject_with_operation() and related functions
    
    	* gio/src/drive.ccg:
    	* gio/src/drive.hg: Wrap the new eject_with_operation() methods and
    	  implement the other eject() functions with
    	  g_drive_eject_with_operation since g_drive_eject has been
    	  deprecated in favor of eject_with_operation()

 ChangeLog         |    8 ++++++
 gio/src/drive.ccg |   73 ++++++++++++++++++++++++++++++++++++++++++-----------
 gio/src/drive.hg  |   12 +++++++-
 3 files changed, 76 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f175cf0..07889c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
 2009-07-09  Jonathon Jongsma  <jonathon quotidian org>
 
 	* gio/src/drive.ccg:
+	* gio/src/drive.hg: Wrap the new eject_with_operation() methods and
+	  implement the other eject() functions with
+	  g_drive_eject_with_operation since g_drive_eject has been
+	  deprecated in favor of eject_with_operation()
+
+2009-07-09  Jonathon Jongsma  <jonathon quotidian org>
+
+	* gio/src/drive.ccg:
 	* gio/src/drive.hg:
 	* gio/src/gio_enums.defs:
 	* tools/m4/convert_gio.m4: wrap added GDrive methods: start(),
diff --git a/gio/src/drive.ccg b/gio/src/drive.ccg
index 0b7d6d8..efa89c6 100644
--- a/gio/src/drive.ccg
+++ b/gio/src/drive.ccg
@@ -32,11 +32,12 @@ void Drive::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& c
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_drive_eject(gobj(),
-                static_cast<GMountUnmountFlags>(flags), 
-                cancellable->gobj(),
-                &SignalProxy_async_callback,
-                slot_copy);
+  g_drive_eject_with_operation(gobj(),
+                               static_cast<GMountUnmountFlags>(flags),
+                               0, // mount_operation
+                               cancellable->gobj(),
+                               &SignalProxy_async_callback,
+                               slot_copy);
 }
 
 void Drive::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
@@ -46,20 +47,62 @@ void Drive::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_drive_eject(gobj(),
-                static_cast<GMountUnmountFlags>(flags), 
-                NULL, // cancellable
-                &SignalProxy_async_callback,
-                slot_copy);
+  g_drive_eject_with_operation(gobj(),
+                               static_cast<GMountUnmountFlags>(flags), 
+                               0, // mount_operation
+                               0, // cancellable
+                               &SignalProxy_async_callback,
+                               slot_copy);
+}
+
+void Drive::eject(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, 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_drive_eject_with_operation(gobj(),
+                               static_cast<GMountUnmountFlags>(flags),
+                               mount_operation->gobj(),
+                               cancellable->gobj(),
+                               &SignalProxy_async_callback,
+                               slot_copy);
+}
+
+void Drive::eject(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, 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_drive_eject_with_operation(gobj(),
+                               static_cast<GMountUnmountFlags>(flags),
+                               0, // mount_operation
+                               0, // cancellable
+                               &SignalProxy_async_callback,
+                               slot_copy);
+}
+
+void Drive::eject(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags)
+{
+  g_drive_eject_with_operation(gobj(),
+                               static_cast<GMountUnmountFlags>(flags), 
+                               mount_operation->gobj(),
+                               0, // cancellable
+                               0, // callback
+                               0); // user_data
 }
 
 void Drive::eject(MountUnmountFlags flags)
 {
-  g_drive_eject(gobj(),
-                static_cast<GMountUnmountFlags>(flags), 
-                NULL, // cancellable
-                NULL,
-                NULL);
+  g_drive_eject_with_operation(gobj(),
+                               static_cast<GMountUnmountFlags>(flags), 
+                               0, // mount_operation
+                               0, // cancellable
+                               0, // callback
+                               0); // user_data
 }
 
 void Drive::poll_for_media(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
diff --git a/gio/src/drive.hg b/gio/src/drive.hg
index 8d7d6ff..7d2e41f 100644
--- a/gio/src/drive.hg
+++ b/gio/src/drive.hg
@@ -79,17 +79,25 @@ public:
    * @param flags Flags affecting the unmount if required for eject.
    */
   void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
-  _IGNORE(g_drive_eject)
+  void eject(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+  void eject(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
   /** Ejects the drive.
    * @param slot A callback which will be called when the eject is completed.
    * @param flags Flags affecting the unmount if required for eject.
    */
   void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+  void eject(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+  _IGNORE(g_drive_eject)
 
+  // eject_finish() is deprecated in favor of eject_with_operation_finish(), and
+  // since all of our eject() overloads are implemented by
+  // eject_with_operation(), we implement the _finish() with
+  // eject_with_operation_finish and ignore the deprecated one
   _WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result),
-               g_drive_eject_finish,
+               g_drive_eject_with_operation_finish,
                errthrow)
+  _IGNORE (g_drive_eject_finish)
 
   /** Polls drive to see if media has been inserted or removed.
    * @param slot A callback which will be called when the poll is completed.



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