glibmm r583 - in trunk: . gio/src
- From: markoa svn gnome org
- To: svn-commits-list gnome org
- Subject: glibmm r583 - in trunk: . gio/src
- Date: Mon, 4 Feb 2008 21:28:28 +0000 (GMT)
Author: markoa
Date: Mon Feb 4 21:28:28 2008
New Revision: 583
URL: http://svn.gnome.org/viewvc/glibmm?rev=583&view=rev
Log:
2008-02-04 Marko Anastasov <marko anastasov gmail com>
* gio/src/file.ccg:
* gio/src/file.hg: Added copy_async(), with overloads without
slot_progress (which is optional and would run in the main loop),
with documentation. Wrapped copy_finish(), query_default_handler().
Modified:
trunk/ChangeLog
trunk/gio/src/file.ccg
trunk/gio/src/file.hg
Modified: trunk/gio/src/file.ccg
==============================================================================
--- trunk/gio/src/file.ccg (original)
+++ trunk/gio/src/file.ccg Mon Feb 4 21:28:28 2008
@@ -619,6 +619,100 @@
return res;
}
+void
+File::copy_async(const Glib::RefPtr<File>& destination,
+ const SlotFileProgress& slot_progress,
+ const SlotAsyncReady& slot_ready,
+ const Glib::RefPtr<Cancellable>& cancellable,
+ FileCopyFlags flags,
+ 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);
+ SlotFileProgress* slot_progress_copy = new SlotFileProgress(slot_progress);
+
+ g_file_copy_async(gobj(),
+ destination->gobj(),
+ static_cast<GFileCopyFlags>(flags),
+ io_priority,
+ cancellable->gobj(),
+ &SignalProxy_file_progress_callback,
+ slot_progress_copy,
+ &SignalProxy_async_callback,
+ slot_ready_copy);
+}
+
+void
+File::copy_async(const Glib::RefPtr<File>& destination,
+ const SlotAsyncReady& slot_ready,
+ const Glib::RefPtr<Cancellable>& cancellable,
+ FileCopyFlags flags,
+ 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_copy_async(gobj(),
+ destination->gobj(),
+ static_cast<GFileCopyFlags>(flags),
+ io_priority,
+ cancellable->gobj(),
+ NULL,
+ NULL,
+ &SignalProxy_async_callback,
+ slot_ready_copy);
+}
+
+void
+File::copy_async(const Glib::RefPtr<File>& destination,
+ const SlotFileProgress& slot_progress,
+ const SlotAsyncReady& slot_ready,
+ FileCopyFlags flags,
+ 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);
+ SlotFileProgress* slot_progress_copy = new SlotFileProgress(slot_progress);
+
+ g_file_copy_async(gobj(),
+ destination->gobj(),
+ static_cast<GFileCopyFlags>(flags),
+ io_priority,
+ NULL,
+ &SignalProxy_file_progress_callback,
+ slot_progress_copy,
+ &SignalProxy_async_callback,
+ slot_ready_copy);
+}
+
+void
+File::copy_async(const Glib::RefPtr<File>& destination,
+ const SlotAsyncReady& slot_ready,
+ FileCopyFlags flags,
+ 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_copy_async(gobj(),
+ destination->gobj(),
+ static_cast<GFileCopyFlags>(flags),
+ io_priority,
+ NULL,
+ NULL,
+ NULL,
+ &SignalProxy_async_callback,
+ slot_ready_copy);
+}
+
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool
File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags)
Modified: trunk/gio/src/file.hg
==============================================================================
--- trunk/gio/src/file.hg (original)
+++ trunk/gio/src/file.hg Mon Feb 4 21:28:28 2008
@@ -19,6 +19,7 @@
#include <glibmm/error.h>
#include <glibmm/interface.h>
+#include <giomm/appinfo.h>
#include <giomm/asyncresult.h>
#include <giomm/fileattributeinfolist.h>
#include <giomm/fileenumerator.h>
@@ -958,6 +959,74 @@
#endif // GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_file_copy)
+ /** Copies the file to the location specified by @destination asynchronously.
+ * For details of the behaviour, see copy().
+ *
+ * When the operation is finished, @slot_ready will be called.
+ * You can then call copy_finish() to get the result of the operation.
+ *
+ * The function specified by @slot_progress will be called just like
+ * in copy(), however the callback will run in the main loop, not in
+ * the thread that is doing the I/O operation.
+ *
+ * @param destination Destination File
+ * @param slot_progress The callback slot to be called with progress information
+ * @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 flags Set of FileCopyFlags
+ * @param io_priority The I/O priority of the request
+ */
+ void copy_async(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags = FILE_COPY_NONE, int io_priority = G_PRIORITY_DEFAULT);
+
+ /** Copies the file to the location specified by @destination asynchronously.
+ * For details of the behaviour, see copy().
+ *
+ * When the operation is finished, @slot_ready will be called.
+ * You can then call copy_finish() to get the result of the operation.
+ *
+ * @param destination Destination File
+ * @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 flags Set of FileCopyFlags
+ * @param io_priority The I/O priority of the request
+ */
+ void copy_async(const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags = FILE_COPY_NONE, int io_priority = G_PRIORITY_DEFAULT);
+
+ /** Copies the file to the location specified by @destination asynchronously.
+ * For details of the behaviour, see copy().
+ *
+ * When the operation is finished, @slot_ready will be called.
+ * You can then call copy_finish() to get the result of the operation.
+ *
+ * The function specified by @slot_progress will be called just like
+ * in copy(), however the callback will run in the main loop, not in
+ * the thread that is doing the I/O operation.
+ *
+ * @param destination Destination File
+ * @param slot_progress The callback slot to be called with progress information
+ * @param slot_ready A SlotAsyncReady to call when the request is satisfied
+ * @param flags Set of FileCopyFlags
+ * @param io_priority The I/O priority of the request
+ */
+ void copy_async(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, FileCopyFlags flags = FILE_COPY_NONE, int io_priority = G_PRIORITY_DEFAULT);
+
+ /** Copies the file to the location specified by @destination asynchronously.
+ * For details of the behaviour, see copy().
+ *
+ * When the operation is finished, @slot_ready will be called.
+ * You can then call copy_finish() to get the result of the operation.
+ *
+ * @param destination Destination File
+ * @param slot_ready A SlotAsyncReady to call when the request is satisfied
+ * @param flags Set of FileCopyFlags
+ * @param io_priority The I/O priority of the request
+ */
+ void copy_async(const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready, FileCopyFlags flags = FILE_COPY_NONE, int io_priority = G_PRIORITY_DEFAULT);
+ _IGNORE(g_file_copy_async)
+
+ _WRAP_METHOD(bool copy_finish(const Glib::RefPtr<AsyncResult>& result),
+ g_file_copy_finish,
+ errthrow)
//TODO: Rephrase this in terms of exceptions rather than errors. And what exceptions are thrown?
/** Tries to move the file or directory source to the location specified by destination. If native move operations are supported then this is
@@ -1517,6 +1586,9 @@
#endif //GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_file_monitor_file)
+ _WRAP_METHOD(Glib::RefPtr<AppInfo> query_default_handler(const Glib::RefPtr<Cancellable>& cancellable),
+ g_file_query_default_handler,
+ refreturn, errthrow)
//TODO: Documentation.
//TODO: atm I don't understand what's etag_out:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]