summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--gio/src/fileinfo.ccg7
-rw-r--r--gio/src/fileinfo.hg3
-rw-r--r--gio/src/fileinputstream.ccg19
-rw-r--r--gio/src/fileinputstream.hg16
-rw-r--r--gio/src/fileoutputstream.ccg18
-rw-r--r--gio/src/fileoutputstream.hg5
-rw-r--r--gio/src/inputstream.ccg6
-rw-r--r--gio/src/inputstream.hg6
-rw-r--r--gio/src/outputstream.ccg34
-rw-r--r--gio/src/outputstream.hg6
11 files changed, 116 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index b81a1dec..f8cce802 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-01-17 Marko Anastasov <marko.anastasov@gmail.com>
+
+ * gio/src/inputstream.ccg:
+ * gio/src/inputstream.hg: Fixed const-ness of Cancellables.
+ * gio/src/fileinputstream.ccg:
+ * gio/src/fileinputstream.ccg:
+ * gio/src/fileoutputstream.ccg:
+ * gio/src/fileoutputstream.hg: Added an overload of query_info_async(),
+ * gio/src/outputstream.ccg:
+ * gio/src/outputstream.hg: write_async(), splice_async() without
+ the Cancellable.
+
+ Patch from José Alburquerque, bug #510080.
+
2008-01-17 Murray Cumming <murrayc@murrayc.com>
* gio/src/file.hg:
diff --git a/gio/src/fileinfo.ccg b/gio/src/fileinfo.ccg
index 65a7c8a2..d4e2167e 100644
--- a/gio/src/fileinfo.ccg
+++ b/gio/src/fileinfo.ccg
@@ -29,4 +29,11 @@ FileAttributeMatcher::create(const std::string& attributes)
return Glib::wrap(g_file_attribute_matcher_new(attributes.c_str()));
}
+Glib::TimeVal FileInfo::modification_time() const
+{
+ Glib::TimeVal result;
+ g_file_info_get_modification_time(const_cast<GFileInfo*>(gobj()), (GTimeVal*)(&result));
+ return result;
+}
+
} // namespace Gio
diff --git a/gio/src/fileinfo.hg b/gio/src/fileinfo.hg
index 5d4debf7..2196e638 100644
--- a/gio/src/fileinfo.hg
+++ b/gio/src/fileinfo.hg
@@ -132,8 +132,7 @@ public:
_WRAP_METHOD(std::string get_content_type() const, g_file_info_get_content_type)
_WRAP_METHOD(goffset get_size() const, g_file_info_get_size)
- //TODO: Change this to a return value?
- _WRAP_METHOD(void get_modification_time(Glib::TimeVal& mtime) const, g_file_info_get_modification_time)
+ Glib::TimeVal modification_time() const;
_WRAP_METHOD(std::string get_symlink_target() const, g_file_info_get_symlink_target)
_WRAP_METHOD(std::string get_etag() const, g_file_info_get_etag)
diff --git a/gio/src/fileinputstream.ccg b/gio/src/fileinputstream.ccg
index 85fb4dcc..72793649 100644
--- a/gio/src/fileinputstream.ccg
+++ b/gio/src/fileinputstream.ccg
@@ -50,7 +50,7 @@ namespace Gio
{
void
-FileInputStream::query_info_async(const std::string& attributes, const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority)
+FileInputStream::query_info_async(const std::string& attributes, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
@@ -65,6 +65,22 @@ FileInputStream::query_info_async(const std::string& attributes, const SlotAsync
slot_copy);
}
+void
+FileInputStream::query_info_async(const std::string& attributes, const SlotAsyncReady& slot, int io_priority)
+{
+ // 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_input_stream_query_info_async(gobj(),
+ const_cast<char*>(attributes.c_str()),
+ io_priority,
+ NULL,
+ &SignalProxy_query_async_callback,
+ slot_copy);
+}
+
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool FileInputStream::seek(goffset offset, Glib::SeekType type)
#else
@@ -85,5 +101,4 @@ bool FileInputStream::seek(goffset offset, Glib::SeekType type, std::auto_ptr<Gl
}
-
} // namespace Gio
diff --git a/gio/src/fileinputstream.hg b/gio/src/fileinputstream.hg
index bc488a08..014cf029 100644
--- a/gio/src/fileinputstream.hg
+++ b/gio/src/fileinputstream.hg
@@ -54,9 +54,6 @@ public:
g_file_input_stream_query_info,
errthrow)
-
- //TODO: Add a version without the Cancellable?
-
/** Queries the stream information asynchronously. For the synchronous version of this function, see query_info().
*
* The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error
@@ -69,7 +66,18 @@ public:
* @param cancellable A Cancellable object which can be used to cancel the operation.
* @param io_priority The I/O priority of the request.
*/
- void query_info_async(const std::string& attributes, const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
+ void query_info_async(const std::string& attributes, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
+
+ /** Queries the stream information asynchronously. For the synchronous version of this function, see query_info().
+ *
+ * When the operation is finished, @a slot will be called. You can then call query_info_finish() to get the result of the operation.
+ *
+ * @param attributes A file attribute query string.
+ * @param slot A callback slot which will be called when the request is satisfied.
+ * @param io_priority The I/O priority of the request.
+ */
+ void query_info_async(const std::string& attributes, const SlotAsyncReady& slot, int io_priority = G_PRIORITY_DEFAULT);
+
_IGNORE(g_file_input_stream_query_info_async)
_WRAP_METHOD(Glib::RefPtr<FileInfo> query_info_finish(const Glib::RefPtr<AsyncResult>& result),
diff --git a/gio/src/fileoutputstream.ccg b/gio/src/fileoutputstream.ccg
index 329f6420..92f9f9bc 100644
--- a/gio/src/fileoutputstream.ccg
+++ b/gio/src/fileoutputstream.ccg
@@ -52,7 +52,7 @@ namespace Gio
{
void
-FileOutputStream::query_info_async(const std::string& attributes, const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority)
+FileOutputStream::query_info_async(const std::string& attributes, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
@@ -67,4 +67,20 @@ FileOutputStream::query_info_async(const std::string& attributes, const SlotAsyn
slot_copy);
}
+void
+FileOutputStream::query_info_async(const std::string& attributes, const SlotAsyncReady& slot, int io_priority)
+{
+ // 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_output_stream_query_info_async(gobj(),
+ const_cast<char*>(attributes.c_str()),
+ io_priority,
+ NULL,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
} // namespace Gio
diff --git a/gio/src/fileoutputstream.hg b/gio/src/fileoutputstream.hg
index 63a0be27..5d3fdf0e 100644
--- a/gio/src/fileoutputstream.hg
+++ b/gio/src/fileoutputstream.hg
@@ -61,7 +61,10 @@ public:
refreturn, errthrow)
_IGNORE(g_file_input_stream_query_info_async)
- void query_info_async(const std::string& attributes, const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
+
+ void query_info_async(const std::string& attributes, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
+ void query_info_async(const std::string& attributes, const SlotAsyncReady& slot, int io_priority = G_PRIORITY_DEFAULT);
+
//TODO: cancellable can probably be NULL.
_WRAP_METHOD(Glib::RefPtr<FileInfo> query_info_finish(const Glib::RefPtr<AsyncResult>& result),
diff --git a/gio/src/inputstream.ccg b/gio/src/inputstream.ccg
index 5c652fe1..e25f3cc1 100644
--- a/gio/src/inputstream.ccg
+++ b/gio/src/inputstream.ccg
@@ -49,7 +49,7 @@ SignalProxy_input_stream_async_callback(GObject*, GAsyncResult* res, void* data)
namespace Gio {
void
-InputStream::read_async(void* buffer, gsize count, const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority)
+InputStream::read_async(void* buffer, gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
@@ -66,7 +66,7 @@ InputStream::read_async(void* buffer, gsize count, const SlotAsyncReady& slot, G
}
void
-InputStream::skip_async(gsize count, const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority)
+InputStream::skip_async(gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
@@ -82,7 +82,7 @@ InputStream::skip_async(gsize count, const SlotAsyncReady& slot, Glib::RefPtr<Ca
}
void
-InputStream::close_async(const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority)
+InputStream::close_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
diff --git a/gio/src/inputstream.hg b/gio/src/inputstream.hg
index be8c84b0..7cf688ae 100644
--- a/gio/src/inputstream.hg
+++ b/gio/src/inputstream.hg
@@ -61,7 +61,7 @@ public:
//TODO: Documentation.
- void read_async(void* buffer, gsize count, const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
+ void read_async(void* buffer, gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
_IGNORE(g_input_stream_read_async)
_WRAP_METHOD(gssize read_finish(const Glib::RefPtr<AsyncResult>& result),
@@ -69,7 +69,7 @@ public:
errthrow)
//TODO: Use std::size_type instead of gsize?
- void skip_async(gsize count, const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
+ void skip_async(gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
_IGNORE(g_input_stream_skip_async)
_WRAP_METHOD(gssize skip_finish(const Glib::RefPtr<AsyncResult>& result),
@@ -77,7 +77,7 @@ public:
errthrow)
//TODO: Can Cancellable be NULL?
- void close_async(const SlotAsyncReady& slot, Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
+ void close_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
_IGNORE(g_input_stream_close_async)
_WRAP_METHOD(gboolean close_finish(const Glib::RefPtr<AsyncResult>& result),
diff --git a/gio/src/outputstream.ccg b/gio/src/outputstream.ccg
index 77aee231..d6b1859a 100644
--- a/gio/src/outputstream.ccg
+++ b/gio/src/outputstream.ccg
@@ -67,6 +67,23 @@ OutputStream::write_async(const void* buffer, gsize count, const SlotAsyncReady&
}
void
+OutputStream::write_async(const void* buffer, gsize count, const SlotAsyncReady& slot, int io_priority)
+{
+ // 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_output_stream_write_async(gobj(),
+ buffer,
+ count,
+ io_priority,
+ NULL,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+void
OutputStream::splice_async(const Glib::RefPtr<InputStream>& source, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags, int io_priority)
{
// Create a copy of the slot.
@@ -84,6 +101,23 @@ OutputStream::splice_async(const Glib::RefPtr<InputStream>& source, const SlotAs
}
void
+OutputStream::splice_async(const Glib::RefPtr<InputStream>& source, const SlotAsyncReady& slot, OutputStreamSpliceFlags flags, int io_priority)
+{
+ // 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_output_stream_splice_async(gobj(),
+ source->gobj(),
+ static_cast<GOutputStreamSpliceFlags>(flags),
+ io_priority,
+ NULL,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+void
OutputStream::flush_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
diff --git a/gio/src/outputstream.hg b/gio/src/outputstream.hg
index f98fad82..06ff4260 100644
--- a/gio/src/outputstream.hg
+++ b/gio/src/outputstream.hg
@@ -62,16 +62,18 @@ public:
g_output_stream_close,
errthrow)
- //TODO: Can Cancellable be NULL?
void write_async(const void* buffer, gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = G_PRIORITY_DEFAULT);
+ void write_async(const void* buffer, gsize count, const SlotAsyncReady& slot, int io_priority = G_PRIORITY_DEFAULT);
_IGNORE(g_output_stream_write_async)
_WRAP_METHOD(gssize write_finish(const Glib::RefPtr<AsyncResult>& result),
g_output_stream_write_finish,
errthrow)
- //TODO: Can Cancellable be NULL?
void splice_async(const Glib::RefPtr<InputStream>& source, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE, int io_priority = G_PRIORITY_DEFAULT);
+
+ void splice_async(const Glib::RefPtr<InputStream>& source, const SlotAsyncReady& slot, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE, int io_priority = G_PRIORITY_DEFAULT);
+
_IGNORE(g_output_stream_splice_async)
_WRAP_METHOD(gssize splice_finish(const Glib::RefPtr<AsyncResult>& result),