glibmm r538 - in trunk: . gio/src



Author: murrayc
Date: Wed Jan 23 15:28:56 2008
New Revision: 538
URL: http://svn.gnome.org/viewvc/glibmm?rev=538&view=rev

Log:
2008-01-23  Murray Cumming  <murrayc murrayc com>

* gio/src/error.hg: Renamed Gio::IOError to 
Gio::Error.
* gio/src/fileenumerator.ccg:
* gio/src/fileenumerator.hg: Added method overloads of close() and 
next_file() without the cancellable parameter.

Modified:
   trunk/ChangeLog
   trunk/gio/src/error.hg
   trunk/gio/src/fileenumerator.ccg
   trunk/gio/src/fileenumerator.hg

Modified: trunk/gio/src/error.hg
==============================================================================
--- trunk/gio/src/error.hg	(original)
+++ trunk/gio/src/error.hg	Wed Jan 23 15:28:56 2008
@@ -32,7 +32,7 @@
 
 /** Exception class for giomm errors.
  */
-_WRAP_GERROR(IOError, GIOErrorEnum, G_IO_ERROR, NO_GTYPE)
+_WRAP_GERROR(Error, GIOErrorEnum, G_IO_ERROR, NO_GTYPE)
 
 
 } // namespace Gio

Modified: trunk/gio/src/fileenumerator.ccg
==============================================================================
--- trunk/gio/src/fileenumerator.ccg	(original)
+++ trunk/gio/src/fileenumerator.ccg	Wed Jan 23 15:28:56 2008
@@ -114,5 +114,44 @@
                                 slot_copy);
 }
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<FileInfo> FileEnumerator::next_file()
+#else
+Glib::RefPtr<FileInfo> FileEnumerator::next_file(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_enumerator_next_file(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
+
+  if(retvalue)
+    retvalue->reference(); //The function does not do a ref for us.
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool FileEnumerator::close()
+#else
+bool FileEnumerator::close(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  bool retvalue = g_file_enumerator_close(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

Modified: trunk/gio/src/fileenumerator.hg
==============================================================================
--- trunk/gio/src/fileenumerator.hg	(original)
+++ trunk/gio/src/fileenumerator.hg	Wed Jan 23 15:28:56 2008
@@ -56,10 +56,33 @@
                g_file_enumerator_next_file,
                refreturn, errthrow)
 
+  /** 
+   * @return A FileInfo or an empty RefPtr on error or end of enumerator.
+   */
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  Glib::RefPtr<FileInfo> next_file();
+  #else
+  Glib::RefPtr<FileInfo> next_file(std::auto_ptr<Glib::Error>& error);
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+
   _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable),
                g_file_enumerator_close,
                errthrow)
 
+  /** Releases all resources used by this enumerator, making the
+   * enumerator return IO_ERROR_CLOSED on all calls.
+   * 
+   * This will be automatically called when the last reference
+   * is dropped, but you might want to call this method to make sure resources
+   * are released as early as possible.
+   * @return #<tt>true</tt> on success or an empty RefPtr on error.
+   */
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  bool close();
+  #else
+  bool close(std::auto_ptr<Glib::Error>& error);
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+
 
   /** Request information for a number of files from the enumerator asynchronously. 
    * When all I/O for the operation is finished the callback slot will be called with the requested information.



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