[glibmm] File: Add remove_async() and remove_finish().



commit 84a47f5564c2da20514b14454fa049cbe5c13550
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Sep 16 14:28:09 2012 +0200

    File: Add remove_async() and remove_finish().
    
            * gio/src/file.[hg|ccg]: As for the sync version, we
    rename delete to remove, because the sync vesion would be
    delete(), which uses a C++ keyword.

 ChangeLog        |    8 ++++++++
 gio/src/file.ccg |   35 +++++++++++++++++++++++++++++++++++
 gio/src/file.hg  |   29 +++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 60c4914..9047de1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-09-16  Murray Cumming  <murrayc murrayc com>
 
+	File: Add remove_async() and remove_finish().
+
+        * gio/src/file.[hg|ccg]: As for the sync version, we 
+	rename delete to remove, because the sync vesion would be 
+	delete(), which uses a C++ keyword.
+
+2012-09-16  Murray Cumming  <murrayc murrayc com>
+
         Gio::DBus::Connection: Add 
 
         * gio/src/dbusconnection.[hg|ccg]: Add call(), call_with_unix_fd_finish(), 
diff --git a/gio/src/file.ccg b/gio/src/file.ccg
index a915a3a..04b1bf4 100644
--- a/gio/src/file.ccg
+++ b/gio/src/file.ccg
@@ -1839,4 +1839,39 @@ bool File::has_parent() const
 }
 
 
+void
+File::remove_async(const SlotAsyncReady& slot_ready,
+                 const Glib::RefPtr<Cancellable>& cancellable,
+                 int io_priority)
+{
+  // Create copies of slots.
+  // Pointers to them will be passed through the callbacks' data parameter
+  // and deleted in the corresponding callback.
+  SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
+
+  g_file_delete_async(gobj(),
+                    io_priority,
+                    Glib::unwrap(cancellable),
+                    &SignalProxy_async_callback,
+                    slot_ready_copy);
+}
+
+void
+File::remove_async(const SlotAsyncReady& slot_ready,
+                 int io_priority)
+{
+  // Create copies of slots.
+  // Pointers to them will be passed through the callbacks' data parameter
+  // and deleted in the corresponding callback.
+  SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
+
+  g_file_delete_async(gobj(),
+                    io_priority,
+                    0,
+                    &SignalProxy_async_callback,
+                    slot_ready_copy);
+}
+
+
+
 } // namespace Gio
diff --git a/gio/src/file.hg b/gio/src/file.hg
index f56380e..47cad10 100644
--- a/gio/src/file.hg
+++ b/gio/src/file.hg
@@ -1065,6 +1065,35 @@ public:
                 g_file_delete,
                 errthrow)
 
+   /** Asynchronously delete a file.
+    * If the @file is a directory, it will
+    * only be deleted if it is empty.  This has the same semantics as
+    * g_unlink().
+    *
+    * @param slot_ready A SlotAsyncReady to call when the request is satisfied
+    * @param cancellable A Cancellable object which can be used to cancel the operation
+    * @param io_priority The I/O priority of the request
+    * @newin{2,34}
+    */
+  void remove_async(const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
+
+   /** Asynchronously delete a file.
+    * If the @file is a directory, it will
+    * only be deleted if it is empty.  This has the same semantics as
+    * g_unlink().
+    *
+    * @param slot_ready A SlotAsyncReady to call when the request is satisfied
+    * @param io_priority The I/O priority of the request
+    * @newin{2,34}
+    */
+  void remove_async(const SlotAsyncReady& slot_ready, int io_priority = Glib::PRIORITY_DEFAULT);
+  _IGNORE(g_file_delete_async)
+
+  _WRAP_METHOD(bool remove_finish(const Glib::RefPtr<AsyncResult>& result),
+               g_file_delete_finish,
+               errthrow)
+
+
   _WRAP_METHOD(bool trash(const Glib::RefPtr<Cancellable>& cancellable{?}),
                g_file_trash,
                errthrow)



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