glibmm r519 - in trunk: . gio/src



Author: markoa
Date: Thu Jan 17 19:16:07 2008
New Revision: 519
URL: http://svn.gnome.org/viewvc/glibmm?rev=519&view=rev

Log:
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.


Modified:
   trunk/ChangeLog
   trunk/gio/src/fileinfo.ccg
   trunk/gio/src/fileinfo.hg
   trunk/gio/src/fileinputstream.ccg
   trunk/gio/src/fileinputstream.hg
   trunk/gio/src/fileoutputstream.ccg
   trunk/gio/src/fileoutputstream.hg
   trunk/gio/src/inputstream.ccg
   trunk/gio/src/inputstream.hg
   trunk/gio/src/outputstream.ccg
   trunk/gio/src/outputstream.hg

Modified: trunk/gio/src/fileinfo.ccg
==============================================================================
--- trunk/gio/src/fileinfo.ccg	(original)
+++ trunk/gio/src/fileinfo.ccg	Thu Jan 17 19:16:07 2008
@@ -29,4 +29,11 @@
   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

Modified: trunk/gio/src/fileinfo.hg
==============================================================================
--- trunk/gio/src/fileinfo.hg	(original)
+++ trunk/gio/src/fileinfo.hg	Thu Jan 17 19:16:07 2008
@@ -132,8 +132,7 @@
   _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)

Modified: trunk/gio/src/fileinputstream.ccg
==============================================================================
--- trunk/gio/src/fileinputstream.ccg	(original)
+++ trunk/gio/src/fileinputstream.ccg	Thu Jan 17 19:16:07 2008
@@ -50,7 +50,7 @@
 {
 
 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 @@
                                        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 @@
 
 }
 
-
 } // namespace Gio

Modified: trunk/gio/src/fileinputstream.hg
==============================================================================
--- trunk/gio/src/fileinputstream.hg	(original)
+++ trunk/gio/src/fileinputstream.hg	Thu Jan 17 19:16:07 2008
@@ -54,9 +54,6 @@
                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 @@
    * @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),

Modified: trunk/gio/src/fileoutputstream.ccg
==============================================================================
--- trunk/gio/src/fileoutputstream.ccg	(original)
+++ trunk/gio/src/fileoutputstream.ccg	Thu Jan 17 19:16:07 2008
@@ -52,7 +52,7 @@
 {
 
 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 @@
                                         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

Modified: trunk/gio/src/fileoutputstream.hg
==============================================================================
--- trunk/gio/src/fileoutputstream.hg	(original)
+++ trunk/gio/src/fileoutputstream.hg	Thu Jan 17 19:16:07 2008
@@ -61,7 +61,10 @@
                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),

Modified: trunk/gio/src/inputstream.ccg
==============================================================================
--- trunk/gio/src/inputstream.ccg	(original)
+++ trunk/gio/src/inputstream.ccg	Thu Jan 17 19:16:07 2008
@@ -49,7 +49,7 @@
 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 @@
 }
 
 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 @@
 }
 
 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

Modified: trunk/gio/src/inputstream.hg
==============================================================================
--- trunk/gio/src/inputstream.hg	(original)
+++ trunk/gio/src/inputstream.hg	Thu Jan 17 19:16:07 2008
@@ -61,7 +61,7 @@
 
 
   //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 @@
                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 @@
                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),

Modified: trunk/gio/src/outputstream.ccg
==============================================================================
--- trunk/gio/src/outputstream.ccg	(original)
+++ trunk/gio/src/outputstream.ccg	Thu Jan 17 19:16:07 2008
@@ -67,6 +67,23 @@
 }
 
 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 @@
 }
 
 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.

Modified: trunk/gio/src/outputstream.hg
==============================================================================
--- trunk/gio/src/outputstream.hg	(original)
+++ trunk/gio/src/outputstream.hg	Thu Jan 17 19:16:07 2008
@@ -62,16 +62,18 @@
                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),



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