[glibmm] Gio::File: Correct the previous commit.



commit 8903fbdea68d6bc04a9d50a542f076800c6a588f
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Sep 15 15:34:02 2012 +0200

    Gio::File: Correct the previous commit.
    
            * gio/src/file.[hg|ccg]: Do not use {?} with query_file_type()
    	because it cannot cope with also having a default parameter value
    	on an earlier parameter.

 ChangeLog        |    8 ++++++++
 gio/src/file.ccg |    5 +++++
 gio/src/file.hg  |   16 +++++++++++++++-
 3 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d87c525..5e92987 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-09-15  Murray Cumming  <murrayc murrayc com>
 
+	Gio::File: Correct the previous commit.
+
+        * gio/src/file.[hg|ccg]: Do not use {?} with query_file_type()
+	because it cannot cope with also having a default parameter value
+	on an earlier parameter.
+
+2012-09-15  Murray Cumming  <murrayc murrayc com>
+
         Gio::File: Simplify the code by using {?} in _WRAP_METHOD()
 
         * gio/src/file.[hg|ccg]: This relatively new gmmproc syntax lets 
diff --git a/gio/src/file.ccg b/gio/src/file.ccg
index 4958e2d..a915a3a 100644
--- a/gio/src/file.ccg
+++ b/gio/src/file.ccg
@@ -383,6 +383,11 @@ File::replace_readwrite_async(const SlotAsyncReady& slot, const std::string& eta
                        slot_copy);
 }
 
+FileType File::query_file_type(FileQueryInfoFlags flags) const
+{
+  return (FileType)g_file_query_file_type(const_cast<GFile*>(gobj()), (GFileQueryInfoFlags)flags, 0);
+}
+
 Glib::RefPtr<FileInfo> File::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags) const
 {
   GError* gerror = 0;
diff --git a/gio/src/file.hg b/gio/src/file.hg
index 8878e41..f68314d 100644
--- a/gio/src/file.hg
+++ b/gio/src/file.hg
@@ -771,7 +771,21 @@ public:
 
   _WRAP_METHOD(bool query_exists(const Glib::RefPtr<Cancellable>& cancellable{?}) const, g_file_query_exists)
 
-  _WRAP_METHOD(FileType query_file_type(FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable{?}) const, g_file_query_file_type)
+  //We cannot use the {?} format here because we want a default value for flags, but gmmproc then generates a method with a default value for flags when it is not the last parameter.
+  _WRAP_METHOD(FileType query_file_type(FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable) const, g_file_query_file_type)
+
+  /** Utility function to inspect the #GFileType of a file. This is
+   * implemented using query_info() and as such does blocking I/O.
+   *
+   * The primary use case of this method is to check if a file is a regular file,
+   * directory, or symlink.
+   *
+   * @param flags: a set of FileQueryInfoFlags passed to query_info().
+   * @results The FileType of the file, or FILE_TYPE_UNKNOWN if the file does not exist.
+   *
+   * @newin{2,18}
+   */
+   FileType query_file_type(FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE) const;
 
   /** Asynchronously gets the requested information about specified file. The result is a FileInfo object that contains key-value attributes (such as type or size for the file).
    *



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