[glibmm] Implement Gio::Mount::mount/eject_with_operation()



commit 12c751cd19e1d16e4cf7a3bc141040268d2ac98e
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Thu Jul 9 22:44:40 2009 +0100

    Implement Gio::Mount::mount/eject_with_operation()
    
    	* gio/src/mount.ccg:
    	* gio/src/mount.hg: implement eject_with_operation() and
    	  mount_with_operation similarly to the GDrive methods mentioned
    	  below

 ChangeLog         |    7 +++
 gio/src/mount.ccg |  147 ++++++++++++++++++++++++++++++++++++++++++----------
 gio/src/mount.hg  |   54 +++++---------------
 3 files changed, 138 insertions(+), 70 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0e8bfee..7b56c60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-07-09  Jonathon Jongsma  <jonathon quotidian org>
 
+	* gio/src/mount.ccg:
+	* gio/src/mount.hg: implement eject_with_operation() and
+	  mount_with_operation similarly to the GDrive methods mentioned
+	  below
+
+2009-07-09  Jonathon Jongsma  <jonathon quotidian org>
+
 	* gio/src/inetaddress.hg: implement get_native_size()
 
 2009-07-09  Jonathon Jongsma  <jonathon quotidian org>
diff --git a/gio/src/mount.ccg b/gio/src/mount.ccg
index e526d2c..bd67ac9 100644
--- a/gio/src/mount.ccg
+++ b/gio/src/mount.ccg
@@ -32,11 +32,12 @@ void Mount::unmount(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>&
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_mount_unmount(gobj(),
-                  GMountUnmountFlags(flags),
-                  cancellable->gobj(),
-                  &SignalProxy_async_callback,
-                  slot_copy);
+  g_mount_unmount_with_operation(gobj(),
+                                 GMountUnmountFlags(flags),
+                                 0, // mount_operation
+                                 cancellable->gobj(),
+                                 &SignalProxy_async_callback,
+                                 slot_copy);
 }
 
 void Mount::unmount(const SlotAsyncReady& slot, MountUnmountFlags flags)
@@ -46,20 +47,65 @@ void Mount::unmount(const SlotAsyncReady& slot, MountUnmountFlags flags)
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_mount_unmount(gobj(),
-                  GMountUnmountFlags(flags),
-                  NULL,
-                  &SignalProxy_async_callback,
-                  slot_copy);
+  g_mount_unmount_with_operation(gobj(),
+                                 GMountUnmountFlags(flags),
+                                 0, // mount_operation
+                                 0, // cancellable
+                                 &SignalProxy_async_callback,
+                                 slot_copy);
 }
 
 void Mount::unmount(MountUnmountFlags flags)
 {
-  g_mount_unmount(gobj(),
-                  GMountUnmountFlags(flags),
-                  NULL,
-                  NULL,
-                  NULL);
+  g_mount_unmount_with_operation(gobj(),
+                                 GMountUnmountFlags(flags),
+                                 0, // mount_operation
+                                 0, // cancellable
+                                 0, // callback
+                                 0); // data
+}
+
+void Mount::unmount(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_mount_unmount_with_operation(gobj(),
+                                 GMountUnmountFlags(flags),
+                                 mount_operation->gobj(),
+                                 cancellable->gobj(),
+                                 &SignalProxy_async_callback,
+                                 slot_copy);
+}
+
+void Mount::unmount(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_mount_unmount_with_operation(gobj(),
+                                 GMountUnmountFlags(flags),
+                                 mount_operation->gobj(),
+                                 0, // cancellable
+                                 &SignalProxy_async_callback,
+                                 slot_copy);
+}
+
+void Mount::unmount(const Glib::RefPtr<MountOperation>& mount_operation,
+                    MountUnmountFlags flags)
+{
+  g_mount_unmount_with_operation(gobj(),
+                                 GMountUnmountFlags(flags),
+                                 mount_operation->gobj(),
+                                 0, // cancellable
+                                 0, // callback
+                                 0); // data
 }
 
 
@@ -120,11 +166,12 @@ void Mount::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& c
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_mount_eject(gobj(),
-                  GMountUnmountFlags(flags),
-                  cancellable->gobj(),
-                  &SignalProxy_async_callback,
-                  slot_copy);
+  g_mount_eject_with_operation(gobj(),
+                               GMountUnmountFlags(flags),
+                               0, // mount_operation
+                               cancellable->gobj(),
+                               &SignalProxy_async_callback,
+                               slot_copy);
 }
 
 void Mount::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
@@ -134,20 +181,62 @@ void Mount::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
   // and deleted in the callback.
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
-  g_mount_eject(gobj(),
-                  GMountUnmountFlags(flags),
-                  NULL,
-                  &SignalProxy_async_callback,
-                  slot_copy);
+  g_mount_eject_with_operation(gobj(),
+                               GMountUnmountFlags(flags),
+                               0, // mount_operation
+                               0, // cancellable
+                               &SignalProxy_async_callback,
+                               slot_copy);
 }
 
 void Mount::eject(MountUnmountFlags flags)
 {
-  g_mount_eject(gobj(),
+  g_mount_eject_with_operation(gobj(),
+                               GMountUnmountFlags(flags),
+                               0, // mount_operation
+                               0, // cancellable
+                               0, // callback
+                               0); // data
+}
+
+void Mount::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_mount_eject_with_operation(gobj(),
+                               GMountUnmountFlags(flags),
+                               mount_operation->gobj(),
+                               cancellable->gobj(),
+                               &SignalProxy_async_callback,
+                               slot_copy);
+}
+
+void Mount::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_mount_eject_with_operation(gobj(),
+                               GMountUnmountFlags(flags),
+                               mount_operation->gobj(),
+                               0, // cancellable
+                               &SignalProxy_async_callback,
+                               slot_copy);
+}
+
+void Mount::eject(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags)
+{
+  g_mount_eject_with_operation(gobj(),
                   GMountUnmountFlags(flags),
-                  NULL,
-                  NULL,
-                  NULL);
+                  mount_operation->gobj(),
+                  0, // cancellable
+                  0, // callback
+                  0); // data
 }
 
 
diff --git a/gio/src/mount.hg b/gio/src/mount.hg
index b3c27b9..13dc05f 100644
--- a/gio/src/mount.hg
+++ b/gio/src/mount.hg
@@ -74,31 +74,17 @@ public:
   _WRAP_METHOD(bool can_unmount() const, g_mount_can_unmount)
   _WRAP_METHOD(bool can_eject() const, g_mount_can_eject)
 
-  /** Unmounts a mount. 
-   * This is an asynchronous operation, and is finished by calling unmount_finish() with the AsyncResult data returned in the callback slot.
-   *
-   * @param slot A callback which will be called when the operation is completed or canceled.
-   * @param cancellable A cancellable object which can be used to cancel the operation.
-   * @param flags Flags affecting the unmount.
-   */
   void unmount(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
-
-  /** Unmounts a mount. 
-   * This is an asynchronous operation, and is finished by calling unmount_finish() with the AsyncResult data returned in the callback slot.
-   *
-   * @param slot A callback which will be called when the operation is completed or canceled.
-   * @param flags Flags affecting the unmount.
-   */
   void unmount(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
-
-  /** Unmounts a mount.
-   *
-   * @param cancellable A cancellable object which can be used to cancel the operation.
-   */
   void unmount(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+  void unmount(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+  void unmount(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+  void unmount(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
   _IGNORE(g_mount_unmount)
+  _IGNORE(g_mount_unmount_with_operation)
 
-  _WRAP_METHOD(bool unmount_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_unmount_finish, errthrow)
+  _WRAP_METHOD(bool unmount_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_unmount_with_operation_finish, errthrow)
+  _IGNORE(g_mount_unmount_finish)
 
   /** Remounts a mount.
    * This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.
@@ -147,32 +133,17 @@ public:
 
   _WRAP_METHOD(bool remount_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_remount_finish, errthrow)
 
-  /** Ejects a mount. 
-   * This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
-   *
-   * @param slot A callback which will be called when the operation is completed or canceled.
-   * @param cancellable A cancellable object which can be used to cancel the operation.
-   * @param flags Flags affecting the unmount if required for eject.
-   */
   void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
-
-  /** Ejects a mount. 
-   * This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
-   *
-   * @param slot A callback which will be called when the operation is completed or canceled.
-   * @param flags Flags affecting the unmount if required for eject.
-   */
   void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
-
-  /** Ejects a mount. 
-   *
-   * @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, 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);
+  void eject(const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
   _IGNORE(g_mount_eject)
+  _IGNORE(g_mount_eject_with_operation)
 
-  _WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_eject_finish, errthrow)
-
+  _WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_eject_with_operation_finish, errthrow)
+  _IGNORE(g_mount_eject_finish)
 
 
 
@@ -240,6 +211,7 @@ public:
 
   _WRAP_SIGNAL(void changed(), changed)
   _WRAP_SIGNAL(void unmounted(), unmounted)
+  _WRAP_SIGNAL(void pre_unmount(), pre_unmount, no_default_handler)
 
   //There are no properties.
 };



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