glibmm r560 - in trunk: . gio/giomm gio/src tools/m4



Author: jjongsma
Date: Sat Feb  2 17:41:05 2008
New Revision: 560
URL: http://svn.gnome.org/viewvc/glibmm?rev=560&view=rev

Log:
	* gio/src/gio_vfuncs.defs:
	* gio/src/Makefile_list_of_hg.am_fragment:
	* gio/src/bufferedinputstream.ccg:
	* gio/src/bufferedinputstream.hg: add BufferedInputStream class
	* gio/giomm/slot_async.cc:
	* gio/giomm/slot_async.h: split out the SlotProxy_async_callback so it
	doesn't have to be implemented in every file
	* gio/src/drive.ccg:
	* gio/src/file.ccg:
	* gio/src/file.hg:
	* gio/src/fileenumerator.ccg:
	* gio/src/fileinputstream.ccg:
	* gio/src/fileoutputstream.ccg:
	* gio/src/inputstream.ccg:
	* gio/src/mount.ccg:
	* gio/src/outputstream.ccg:
	* gio/src/volume.ccg: use the common SlotProxy_async_callback function in
	all of these files
	* tools/m4/convert_gio.m4: add conversion for Cancellable
	* gio/giomm/Makefile.am: indenting changes


Added:
   trunk/gio/giomm/slot_async.cc
   trunk/gio/giomm/slot_async.h
   trunk/gio/src/bufferedinputstream.ccg
   trunk/gio/src/bufferedinputstream.hg
Modified:
   trunk/ChangeLog
   trunk/gio/giomm/   (props changed)
   trunk/gio/giomm/Makefile.am
   trunk/gio/src/Makefile_list_of_hg.am_fragment
   trunk/gio/src/drive.ccg
   trunk/gio/src/file.ccg
   trunk/gio/src/file.hg
   trunk/gio/src/fileenumerator.ccg
   trunk/gio/src/fileinputstream.ccg
   trunk/gio/src/fileoutputstream.ccg
   trunk/gio/src/gio_vfuncs.defs
   trunk/gio/src/inputstream.ccg
   trunk/gio/src/mount.ccg
   trunk/gio/src/outputstream.ccg
   trunk/gio/src/volume.ccg
   trunk/tools/m4/convert_gio.m4

Modified: trunk/gio/giomm/Makefile.am
==============================================================================
--- trunk/gio/giomm/Makefile.am	(original)
+++ trunk/gio/giomm/Makefile.am	Sat Feb  2 17:41:05 2008
@@ -13,7 +13,7 @@
 
 sublib_files_extra_posix_cc =
 sublib_files_extra_win32_cc =
-sublib_files_extra_general_cc = init.cc contenttype.cc
+sublib_files_extra_general_cc = init.cc contenttype.cc slot_async.cc
 sublib_files_extra_general_deprecated_cc = 
 
 sublib_files_extra_posix_h =

Added: trunk/gio/giomm/slot_async.cc
==============================================================================
--- (empty file)
+++ trunk/gio/giomm/slot_async.cc	Sat Feb  2 17:41:05 2008
@@ -0,0 +1,47 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include "slot_async.h"
+#include <giomm/asyncresult.h>
+
+namespace Gio
+{
+
+void
+SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data)
+{
+  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
+
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  try
+  {
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
+    (*the_slot)(result);
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  }
+  catch(...)
+  {
+    Glib::exception_handlers_invoke();
+  }
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  delete the_slot;
+}
+
+} //namespace Gio

Added: trunk/gio/giomm/slot_async.h
==============================================================================
--- (empty file)
+++ trunk/gio/giomm/slot_async.h	Sat Feb  2 17:41:05 2008
@@ -0,0 +1,27 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include <gio/gio.h>
+
+namespace Gio
+{
+
+void
+SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data);
+
+} //namespace Gio

Modified: trunk/gio/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- trunk/gio/src/Makefile_list_of_hg.am_fragment	(original)
+++ trunk/gio/src/Makefile_list_of_hg.am_fragment	Sat Feb  2 17:41:05 2008
@@ -6,10 +6,10 @@
 files_posix_hg =
 files_win32_hg =
 files_general_hg = appinfo.hg asyncresult.hg cancellable.hg drive.hg error.hg file.hg fileattributeinfo.hg \
-                   fileattributeinfolist.hg fileenumerator.hg fileicon.hg fileinfo.hg fileinputstream.hg fileoutputstream.hg \
-		   filemonitor.hg filterinputstream.hg \
-                   icon.hg inputstream.hg loadableicon.hg mount.hg mountoperation.hg outputstream.hg \
-		   seekable.hg simpleasyncresult.hg volume.hg volumemonitor.hg
+				   fileattributeinfolist.hg fileenumerator.hg fileicon.hg fileinfo.hg fileinputstream.hg fileoutputstream.hg \
+				   filemonitor.hg filterinputstream.hg \
+				   icon.hg inputstream.hg loadableicon.hg mount.hg mountoperation.hg outputstream.hg \
+				   seekable.hg simpleasyncresult.hg volume.hg volumemonitor.hg bufferedinputstream.hg
 
 include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment
 

Added: trunk/gio/src/bufferedinputstream.ccg
==============================================================================
--- (empty file)
+++ trunk/gio/src/bufferedinputstream.ccg	Sat Feb  2 17:41:05 2008
@@ -0,0 +1,105 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2008 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+#include "slot_async.h"
+
+namespace Gio
+{
+Glib::RefPtr<BufferedInputStream> BufferedInputStream::create_sized(const Glib::RefPtr<InputStream>& base_stream, gsize size)
+{
+    return Glib::RefPtr<Gio::BufferedInputStream>(new BufferedInputStream(base_stream, size));
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+gssize BufferedInputStream::fill(gssize count)
+#else
+gssize BufferedInputStream::fill(gssize count, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  gssize retvalue = g_buffered_input_stream_fill(const_cast<GBufferedInputStream*>(gobj()), count, NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+void BufferedInputStream::fill_async(const SlotAsyncReady& slot,
+                                     gssize count,
+                                     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
+  // and deleted in the callback.
+    SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+    g_buffered_input_stream_fill_async(gobj(),
+            count,
+            io_priority,
+            cancellable->gobj(),
+            &SignalProxy_async_callback,
+            slot_copy);
+}
+
+void BufferedInputStream::fill_async(const SlotAsyncReady& slot,
+                                     gssize count,
+                                     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_buffered_input_stream_fill_async(gobj(),
+            count,
+            io_priority,
+            NULL,
+            &SignalProxy_async_callback,
+            slot_copy);
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+int BufferedInputStream::read_byte()
+#else
+int BufferedInputStream::read_byte(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  int retvalue = g_buffered_input_stream_read_byte(gobj(), NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+
+}
+
+
+}   // namespace Gio

Added: trunk/gio/src/bufferedinputstream.hg
==============================================================================
--- (empty file)
+++ trunk/gio/src/bufferedinputstream.hg	Sat Feb  2 17:41:05 2008
@@ -0,0 +1,90 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2008 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <giomm/filterinputstream.h>
+#include <glibmm/object.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(giomm/private/filterinputstream_p.h)
+
+namespace Gio
+{
+
+class BufferedInputStream : public Gio::FilterInputStream
+{
+  _CLASS_GOBJECT(BufferedInputStream, GBufferedInputStream, G_BUFFERED_INPUT_STREAM, Gio::FilterInputStream, GFilterInputStream)
+protected:
+  _WRAP_CTOR(BufferedInputStream(const Glib::RefPtr<InputStream>& base_stream), g_buffered_input_stream_new)
+  _WRAP_CTOR(BufferedInputStream(const Glib::RefPtr<InputStream>& base_stream, gsize size), g_buffered_input_stream_new_sized)
+public:
+  _WRAP_CREATE(const Glib::RefPtr<InputStream>& base_stream)
+  static Glib::RefPtr<BufferedInputStream> create_sized(const Glib::RefPtr<InputStream>& base_stream, gsize size);
+
+  _WRAP_METHOD(gsize get_buffer_size() const, g_buffered_input_stream_get_buffer_size)
+  _WRAP_METHOD(void set_buffer_size(gsize size), g_buffered_input_stream_set_buffer_size)
+  _WRAP_METHOD(gsize get_available() const, g_buffered_input_stream_get_available)
+  _WRAP_METHOD(gsize peek(void* buffer, gsize offset, gsize count) const, g_buffered_input_stream_peek)
+  _WRAP_METHOD(const void* peek_buffer(gsize& count) const,  g_buffered_input_stream_peek_buffer)
+  _WRAP_METHOD(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable), g_buffered_input_stream_fill, errthrow)
+  /** non-cancellable version of fill()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  gssize fill(gssize count);
+#else
+  gssize fill(gssize count, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+/**
+ * Reads data into @stream's buffer asynchronously, up to @count size.
+ * @io_priority can be used to prioritize reads. For the synchronous version of
+ * this function, see fill().
+ *
+ * @param slot A #GAsyncReadyCallback.
+ * @param count: the number of bytes to read
+ * @param io_priority the I/O priority of the request.
+ * @param cancellable Cancellable object
+ **/
+  void fill_async(const SlotAsyncReady& slot,
+                  gssize count,
+                  const Glib::RefPtr<Cancellable>& cancellable,
+                  int io_priority=G_PRIORITY_DEFAULT);
+
+  /** non-cancellable version of fill_async()
+   */
+  void fill_async(const SlotAsyncReady& slot,
+                  gssize count,
+                  int io_priority=G_PRIORITY_DEFAULT);
+
+  _WRAP_METHOD(gssize fill_finish(const Glib::RefPtr<AsyncResult>& result), g_buffered_input_stream_fill_finish, errthrow)
+
+  _WRAP_METHOD(int read_byte(const Glib::RefPtr<Cancellable>& cancellable), g_buffered_input_stream_read_byte, errthrow)
+  /** non-cancellable version of read_byte
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  int read_byte();
+#else
+  int read_byte(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  protected:
+  _WRAP_VFUNC(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable, GError** error), "fill")
+  // TODO: wrap async vfuncs
+};
+
+} // namespace Gio

Modified: trunk/gio/src/drive.ccg
==============================================================================
--- trunk/gio/src/drive.ccg	(original)
+++ trunk/gio/src/drive.ccg	Sat Feb  2 17:41:05 2008
@@ -20,33 +20,7 @@
 #include <gio/gio.h>
 #include <glibmm/error.h>
 #include <glibmm/exceptionhandler.h>
-
-namespace {
-
-//A generic proxy for AsynReady callbacks, taking a SlotAsyncReady in the data:
-static void
-SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data)
-{
-  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
-
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
-    (*the_slot)(result);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  delete the_slot;
-}
-
-} // anonymous namespace
+#include "slot_async.h"
 
 namespace Gio
 {

Modified: trunk/gio/src/file.ccg
==============================================================================
--- trunk/gio/src/file.ccg	(original)
+++ trunk/gio/src/file.ccg	Sat Feb  2 17:41:05 2008
@@ -22,6 +22,7 @@
 #include <utility>
 #include <glibmm/error.h>
 #include <glibmm/exceptionhandler.h>
+#include "slot_async.h"
 
 namespace
 {
@@ -29,28 +30,6 @@
 typedef std::pair<Gio::File::SlotReadMore*, Gio::SlotAsyncReady*> LoadPartialSlots;
 
 static void
-SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data)
-{
-  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
-
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
-    (*the_slot)(result);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  delete the_slot;
-}
-
-static void
 SignalProxy_file_progress_callback(goffset current_num_bytes,
                                    goffset total_num_bytes,
                                    gpointer data)

Modified: trunk/gio/src/file.hg
==============================================================================
--- trunk/gio/src/file.hg	(original)
+++ trunk/gio/src/file.hg	Sat Feb  2 17:41:05 2008
@@ -388,7 +388,7 @@
   //but I would still like to choose a different word, but can't think of a good one. murrayc. See also create_file().
 
   /** Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.
-   * For more details, see create() which is the synchronous version of this call.
+   * For more details, see create_file() which is the synchronous version of this call.
    *
    * When the operation is finished, @a slot will be called. You can then call create_file_finish() to get the result of the operation.
    * 
@@ -400,7 +400,7 @@
   void create_file_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = G_PRIORITY_DEFAULT);
 
   /** Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.
-   * For more details, see create() which is the synchronous version of this call.
+   * For more details, see create_file() which is the synchronous version of this call.
    *
    * When the operation is finished, @a slot will be called. You can then call create_file_finish() to get the result of the operation.
    * 

Modified: trunk/gio/src/fileenumerator.ccg
==============================================================================
--- trunk/gio/src/fileenumerator.ccg	(original)
+++ trunk/gio/src/fileenumerator.ccg	Sat Feb  2 17:41:05 2008
@@ -20,32 +20,7 @@
 #include <gio/gio.h>
 #include <glibmm/error.h>
 #include <glibmm/exceptionhandler.h>
-
-namespace {
-
-static void
-SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data)
-{
-  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
-
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
-    (*the_slot)(result);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  delete the_slot;
-}
-
-} // anonymous namespace
+#include "slot_async.h"
 
 namespace Gio {
 

Modified: trunk/gio/src/fileinputstream.ccg
==============================================================================
--- trunk/gio/src/fileinputstream.ccg	(original)
+++ trunk/gio/src/fileinputstream.ccg	Sat Feb  2 17:41:05 2008
@@ -18,34 +18,9 @@
  */
 
 #include <gio/gio.h>
+#include "slot_async.h"
 #include <glibmm/exceptionhandler.h>
 
-namespace {
-
-static void
-SignalProxy_query_async_callback(GObject*, GAsyncResult* res, void* data)
-{
-  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
-
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
-    (*the_slot)(result);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  delete the_slot;
-}
-
-} // anonymous namespace
-
 namespace Gio
 {
 
@@ -99,7 +74,7 @@
                                        const_cast<char*>(attributes.c_str()),
                                        io_priority,
                                        cancellable->gobj(),
-                                       &SignalProxy_query_async_callback,
+                                       &SignalProxy_async_callback,
                                        slot_copy);
 }
 
@@ -115,7 +90,7 @@
                                        const_cast<char*>(attributes.c_str()),
                                        io_priority,
                                        NULL,
-                                       &SignalProxy_query_async_callback,
+                                       &SignalProxy_async_callback,
                                        slot_copy);
 }
 

Modified: trunk/gio/src/fileoutputstream.ccg
==============================================================================
--- trunk/gio/src/fileoutputstream.ccg	(original)
+++ trunk/gio/src/fileoutputstream.ccg	Sat Feb  2 17:41:05 2008
@@ -21,32 +21,7 @@
 #include <glib.h>
 #include <glibmm/error.h>
 #include <glibmm/exceptionhandler.h>
-
-namespace {
-
-static void
-SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data)
-{
-  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
-
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
-    (*the_slot)(result);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  delete the_slot;
-}
-
-} // anonymous namespace
+#include "slot_async.h"
 
 namespace Gio
 {

Modified: trunk/gio/src/gio_vfuncs.defs
==============================================================================
--- trunk/gio/src/gio_vfuncs.defs	(original)
+++ trunk/gio/src/gio_vfuncs.defs	Sat Feb  2 17:41:05 2008
@@ -241,3 +241,36 @@
    '("GError**" "error")
   )
 )
+
+; GBufferedInputStream
+
+(define-vfunc fill
+ (of-object "GBufferedInputStream")
+ (return-type "gssize")
+ (parameters
+  '("gssize" "count")
+  '("GCancellable*" "cancellable")
+  '("GError**" "error")
+ )
+)
+
+(define-vfunc fill_async
+ (of-object "GBufferedInputStream")
+ (return-type "void")
+ (parameters
+  '("gssize" "count")
+  '("int" "io_priority")
+  '("GCancellable*" "cancellable")
+  '("GAsyncReadyCallback" "callback")
+  '("gpointer" "user_data")
+ )
+)
+
+(define-vfunc fill_finish
+ (of-object "GBufferedInputStream")
+ (return-type "gssize")
+ (parameters
+  '("GAsyncResult*" "result")
+  '("GError**" "error")
+ )
+)

Modified: trunk/gio/src/inputstream.ccg
==============================================================================
--- trunk/gio/src/inputstream.ccg	(original)
+++ trunk/gio/src/inputstream.ccg	Sat Feb  2 17:41:05 2008
@@ -19,34 +19,7 @@
 
 #include <gio/gio.h>
 #include <giomm/asyncresult.h>
-
-namespace
-{
-
-static void
-SignalProxy_input_stream_async_callback(GObject*, GAsyncResult* res, void* data)
-{
-  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
-
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
-    (*the_slot)(result);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  delete the_slot;
-}
-
-} // anonymous namespace
-
+#include "slot_async.h"
 
 namespace Gio
 {
@@ -141,7 +114,7 @@
                             count,
                             io_priority,
                             cancellable->gobj(),
-                            &SignalProxy_input_stream_async_callback,
+                            &SignalProxy_async_callback,
                             slot_copy);
 }
 
@@ -158,7 +131,7 @@
                             count,
                             io_priority,
                             NULL,
-                            &SignalProxy_input_stream_async_callback,
+                            &SignalProxy_async_callback,
                             slot_copy);
 }
 
@@ -175,7 +148,7 @@
                             count,
                             io_priority,
                             cancellable->gobj(),
-                            &SignalProxy_input_stream_async_callback,
+                            &SignalProxy_async_callback,
                             slot_copy);
 }
 
@@ -191,7 +164,7 @@
                             count,
                             io_priority,
                             NULL,
-                            &SignalProxy_input_stream_async_callback,
+                            &SignalProxy_async_callback,
                             slot_copy);
 }
 
@@ -206,7 +179,7 @@
   g_input_stream_close_async(gobj(),
                              io_priority,
                              cancellable->gobj(),
-                             &SignalProxy_input_stream_async_callback,
+                             &SignalProxy_async_callback,
                              slot_copy);
 }
 
@@ -221,7 +194,7 @@
   g_input_stream_close_async(gobj(),
                              io_priority,
                              NULL,
-                             &SignalProxy_input_stream_async_callback,
+                             &SignalProxy_async_callback,
                              slot_copy);
 }
 

Modified: trunk/gio/src/mount.ccg
==============================================================================
--- trunk/gio/src/mount.ccg	(original)
+++ trunk/gio/src/mount.ccg	Sat Feb  2 17:41:05 2008
@@ -20,33 +20,7 @@
 #include <giomm/drive.h>
 #include <giomm/volume.h>
 #include <gio/gio.h>
-
-namespace
-{
-
-static void
-SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data)
-{
-  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
-
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
-    (*the_slot)(result);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  delete the_slot;
-}
-
-} //anonymous namespace
+#include "slot_async.h"
 
 namespace Gio
 {

Modified: trunk/gio/src/outputstream.ccg
==============================================================================
--- trunk/gio/src/outputstream.ccg	(original)
+++ trunk/gio/src/outputstream.ccg	Sat Feb  2 17:41:05 2008
@@ -20,32 +20,7 @@
 #include <gio/gio.h>
 #include <glibmm/error.h>
 #include <glibmm/exceptionhandler.h>
-
-namespace {
-
-static void
-SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data)
-{
-  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
-
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
-    (*the_slot)(result);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  delete the_slot;
-}
-
-} // anonymous namespace
+#include "slot_async.h"
 
 namespace Gio {
 

Modified: trunk/gio/src/volume.ccg
==============================================================================
--- trunk/gio/src/volume.ccg	(original)
+++ trunk/gio/src/volume.ccg	Sat Feb  2 17:41:05 2008
@@ -23,32 +23,7 @@
 #include <giomm/file.h>
 #include <giomm/drive.h>
 #include <gio/gio.h>
-
-namespace {
-
-static void
-SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data)
-{
-  Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data);
-
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
-    (*the_slot)(result);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  delete the_slot;
-}
-
-} // anonymous namespace
+#include "slot_async.h"
 
 namespace Gio {
 

Modified: trunk/tools/m4/convert_gio.m4
==============================================================================
--- trunk/tools/m4/convert_gio.m4	(original)
+++ trunk/tools/m4/convert_gio.m4	Sat Feb  2 17:41:05 2008
@@ -29,6 +29,7 @@
 # Cancellable
 _CONVERSION(`const Glib::RefPtr<Cancellable>&',`GCancellable*',__CONVERT_CONST_REFPTR_TO_P)
 _CONVERSION(`GCancellable*', `Glib::RefPtr<Cancellable>', `Glib::wrap($3)')
+_CONVERSION(`GCancellable*', `const Glib::RefPtr<Cancellable>&', `Glib::wrap($3)')
 
 
 # Drive



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