packages feed

gio (empty) → 0.11.0

raw patch · 13 files changed

+4107/−0 lines, 13 filesdep +arraydep +basedep +bytestringbuild-type:Customsetup-changed

Dependencies added: array, base, bytestring, containers, glib, haskell98, mtl

Files

+ COPYING view
@@ -0,0 +1,504 @@+		  GNU LESSER GENERAL PUBLIC LICENSE+		       Version 2.1, February 1999++ Copyright (C) 1991, 1999 Free Software Foundation, Inc.+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA+ Everyone is permitted to copy and distribute verbatim copies+ of this license document, but changing it is not allowed.++[This is the first released version of the Lesser GPL.  It also counts+ as the successor of the GNU Library Public License, version 2, hence+ the version number 2.1.]++			    Preamble++  The licenses for most software are designed to take away your+freedom to share and change it.  By contrast, the GNU General Public+Licenses are intended to guarantee your freedom to share and change+free software--to make sure the software is free for all its users.++  This license, the Lesser General Public License, applies to some+specially designated software packages--typically libraries--of the+Free Software Foundation and other authors who decide to use it.  You+can use it too, but we suggest you first think carefully about whether+this license or the ordinary General Public License is the better+strategy to use in any particular case, based on the explanations below.++  When we speak of free software, we are referring to freedom of use,+not price.  Our General Public Licenses are designed to make sure that+you have the freedom to distribute copies of free software (and charge+for this service if you wish); that you receive source code or can get+it if you want it; that you can change the software and use pieces of+it in new free programs; and that you are informed that you can do+these things.++  To protect your rights, we need to make restrictions that forbid+distributors to deny you these rights or to ask you to surrender these+rights.  These restrictions translate to certain responsibilities for+you if you distribute copies of the library or if you modify it.++  For example, if you distribute copies of the library, whether gratis+or for a fee, you must give the recipients all the rights that we gave+you.  You must make sure that they, too, receive or can get the source+code.  If you link other code with the library, you must provide+complete object files to the recipients, so that they can relink them+with the library after making changes to the library and recompiling+it.  And you must show them these terms so they know their rights.++  We protect your rights with a two-step method: (1) we copyright the+library, and (2) we offer you this license, which gives you legal+permission to copy, distribute and/or modify the library.++  To protect each distributor, we want to make it very clear that+there is no warranty for the free library.  Also, if the library is+modified by someone else and passed on, the recipients should know+that what they have is not the original version, so that the original+author's reputation will not be affected by problems that might be+introduced by others.++  Finally, software patents pose a constant threat to the existence of+any free program.  We wish to make sure that a company cannot+effectively restrict the users of a free program by obtaining a+restrictive license from a patent holder.  Therefore, we insist that+any patent license obtained for a version of the library must be+consistent with the full freedom of use specified in this license.++  Most GNU software, including some libraries, is covered by the+ordinary GNU General Public License.  This license, the GNU Lesser+General Public License, applies to certain designated libraries, and+is quite different from the ordinary General Public License.  We use+this license for certain libraries in order to permit linking those+libraries into non-free programs.++  When a program is linked with a library, whether statically or using+a shared library, the combination of the two is legally speaking a+combined work, a derivative of the original library.  The ordinary+General Public License therefore permits such linking only if the+entire combination fits its criteria of freedom.  The Lesser General+Public License permits more lax criteria for linking other code with+the library.++  We call this license the "Lesser" General Public License because it+does Less to protect the user's freedom than the ordinary General+Public License.  It also provides other free software developers Less+of an advantage over competing non-free programs.  These disadvantages+are the reason we use the ordinary General Public License for many+libraries.  However, the Lesser license provides advantages in certain+special circumstances.++  For example, on rare occasions, there may be a special need to+encourage the widest possible use of a certain library, so that it becomes+a de-facto standard.  To achieve this, non-free programs must be+allowed to use the library.  A more frequent case is that a free+library does the same job as widely used non-free libraries.  In this+case, there is little to gain by limiting the free library to free+software only, so we use the Lesser General Public License.++  In other cases, permission to use a particular library in non-free+programs enables a greater number of people to use a large body of+free software.  For example, permission to use the GNU C Library in+non-free programs enables many more people to use the whole GNU+operating system, as well as its variant, the GNU/Linux operating+system.++  Although the Lesser General Public License is Less protective of the+users' freedom, it does ensure that the user of a program that is+linked with the Library has the freedom and the wherewithal to run+that program using a modified version of the Library.++  The precise terms and conditions for copying, distribution and+modification follow.  Pay close attention to the difference between a+"work based on the library" and a "work that uses the library".  The+former contains code derived from the library, whereas the latter must+be combined with the library in order to run.++		  GNU LESSER GENERAL PUBLIC LICENSE+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION++  0. This License Agreement applies to any software library or other+program which contains a notice placed by the copyright holder or+other authorized party saying it may be distributed under the terms of+this Lesser General Public License (also called "this License").+Each licensee is addressed as "you".++  A "library" means a collection of software functions and/or data+prepared so as to be conveniently linked with application programs+(which use some of those functions and data) to form executables.++  The "Library", below, refers to any such software library or work+which has been distributed under these terms.  A "work based on the+Library" means either the Library or any derivative work under+copyright law: that is to say, a work containing the Library or a+portion of it, either verbatim or with modifications and/or translated+straightforwardly into another language.  (Hereinafter, translation is+included without limitation in the term "modification".)++  "Source code" for a work means the preferred form of the work for+making modifications to it.  For a library, complete source code means+all the source code for all modules it contains, plus any associated+interface definition files, plus the scripts used to control compilation+and installation of the library.++  Activities other than copying, distribution and modification are not+covered by this License; they are outside its scope.  The act of+running a program using the Library is not restricted, and output from+such a program is covered only if its contents constitute a work based+on the Library (independent of the use of the Library in a tool for+writing it).  Whether that is true depends on what the Library does+and what the program that uses the Library does.+  +  1. You may copy and distribute verbatim copies of the Library's+complete source code as you receive it, in any medium, provided that+you conspicuously and appropriately publish on each copy an+appropriate copyright notice and disclaimer of warranty; keep intact+all the notices that refer to this License and to the absence of any+warranty; and distribute a copy of this License along with the+Library.++  You may charge a fee for the physical act of transferring a copy,+and you may at your option offer warranty protection in exchange for a+fee.++  2. You may modify your copy or copies of the Library or any portion+of it, thus forming a work based on the Library, and copy and+distribute such modifications or work under the terms of Section 1+above, provided that you also meet all of these conditions:++    a) The modified work must itself be a software library.++    b) You must cause the files modified to carry prominent notices+    stating that you changed the files and the date of any change.++    c) You must cause the whole of the work to be licensed at no+    charge to all third parties under the terms of this License.++    d) If a facility in the modified Library refers to a function or a+    table of data to be supplied by an application program that uses+    the facility, other than as an argument passed when the facility+    is invoked, then you must make a good faith effort to ensure that,+    in the event an application does not supply such function or+    table, the facility still operates, and performs whatever part of+    its purpose remains meaningful.++    (For example, a function in a library to compute square roots has+    a purpose that is entirely well-defined independent of the+    application.  Therefore, Subsection 2d requires that any+    application-supplied function or table used by this function must+    be optional: if the application does not supply it, the square+    root function must still compute square roots.)++These requirements apply to the modified work as a whole.  If+identifiable sections of that work are not derived from the Library,+and can be reasonably considered independent and separate works in+themselves, then this License, and its terms, do not apply to those+sections when you distribute them as separate works.  But when you+distribute the same sections as part of a whole which is a work based+on the Library, the distribution of the whole must be on the terms of+this License, whose permissions for other licensees extend to the+entire whole, and thus to each and every part regardless of who wrote+it.++Thus, it is not the intent of this section to claim rights or contest+your rights to work written entirely by you; rather, the intent is to+exercise the right to control the distribution of derivative or+collective works based on the Library.++In addition, mere aggregation of another work not based on the Library+with the Library (or with a work based on the Library) on a volume of+a storage or distribution medium does not bring the other work under+the scope of this License.++  3. You may opt to apply the terms of the ordinary GNU General Public+License instead of this License to a given copy of the Library.  To do+this, you must alter all the notices that refer to this License, so+that they refer to the ordinary GNU General Public License, version 2,+instead of to this License.  (If a newer version than version 2 of the+ordinary GNU General Public License has appeared, then you can specify+that version instead if you wish.)  Do not make any other change in+these notices.++  Once this change is made in a given copy, it is irreversible for+that copy, so the ordinary GNU General Public License applies to all+subsequent copies and derivative works made from that copy.++  This option is useful when you wish to copy part of the code of+the Library into a program that is not a library.++  4. You may copy and distribute the Library (or a portion or+derivative of it, under Section 2) in object code or executable form+under the terms of Sections 1 and 2 above provided that you accompany+it with the complete corresponding machine-readable source code, which+must be distributed under the terms of Sections 1 and 2 above on a+medium customarily used for software interchange.++  If distribution of object code is made by offering access to copy+from a designated place, then offering equivalent access to copy the+source code from the same place satisfies the requirement to+distribute the source code, even though third parties are not+compelled to copy the source along with the object code.++  5. A program that contains no derivative of any portion of the+Library, but is designed to work with the Library by being compiled or+linked with it, is called a "work that uses the Library".  Such a+work, in isolation, is not a derivative work of the Library, and+therefore falls outside the scope of this License.++  However, linking a "work that uses the Library" with the Library+creates an executable that is a derivative of the Library (because it+contains portions of the Library), rather than a "work that uses the+library".  The executable is therefore covered by this License.+Section 6 states terms for distribution of such executables.++  When a "work that uses the Library" uses material from a header file+that is part of the Library, the object code for the work may be a+derivative work of the Library even though the source code is not.+Whether this is true is especially significant if the work can be+linked without the Library, or if the work is itself a library.  The+threshold for this to be true is not precisely defined by law.++  If such an object file uses only numerical parameters, data+structure layouts and accessors, and small macros and small inline+functions (ten lines or less in length), then the use of the object+file is unrestricted, regardless of whether it is legally a derivative+work.  (Executables containing this object code plus portions of the+Library will still fall under Section 6.)++  Otherwise, if the work is a derivative of the Library, you may+distribute the object code for the work under the terms of Section 6.+Any executables containing that work also fall under Section 6,+whether or not they are linked directly with the Library itself.++  6. As an exception to the Sections above, you may also combine or+link a "work that uses the Library" with the Library to produce a+work containing portions of the Library, and distribute that work+under terms of your choice, provided that the terms permit+modification of the work for the customer's own use and reverse+engineering for debugging such modifications.++  You must give prominent notice with each copy of the work that the+Library is used in it and that the Library and its use are covered by+this License.  You must supply a copy of this License.  If the work+during execution displays copyright notices, you must include the+copyright notice for the Library among them, as well as a reference+directing the user to the copy of this License.  Also, you must do one+of these things:++    a) Accompany the work with the complete corresponding+    machine-readable source code for the Library including whatever+    changes were used in the work (which must be distributed under+    Sections 1 and 2 above); and, if the work is an executable linked+    with the Library, with the complete machine-readable "work that+    uses the Library", as object code and/or source code, so that the+    user can modify the Library and then relink to produce a modified+    executable containing the modified Library.  (It is understood+    that the user who changes the contents of definitions files in the+    Library will not necessarily be able to recompile the application+    to use the modified definitions.)++    b) Use a suitable shared library mechanism for linking with the+    Library.  A suitable mechanism is one that (1) uses at run time a+    copy of the library already present on the user's computer system,+    rather than copying library functions into the executable, and (2)+    will operate properly with a modified version of the library, if+    the user installs one, as long as the modified version is+    interface-compatible with the version that the work was made with.++    c) Accompany the work with a written offer, valid for at+    least three years, to give the same user the materials+    specified in Subsection 6a, above, for a charge no more+    than the cost of performing this distribution.++    d) If distribution of the work is made by offering access to copy+    from a designated place, offer equivalent access to copy the above+    specified materials from the same place.++    e) Verify that the user has already received a copy of these+    materials or that you have already sent this user a copy.++  For an executable, the required form of the "work that uses the+Library" must include any data and utility programs needed for+reproducing the executable from it.  However, as a special exception,+the materials to be distributed need not include anything that is+normally distributed (in either source or binary form) with the major+components (compiler, kernel, and so on) of the operating system on+which the executable runs, unless that component itself accompanies+the executable.++  It may happen that this requirement contradicts the license+restrictions of other proprietary libraries that do not normally+accompany the operating system.  Such a contradiction means you cannot+use both them and the Library together in an executable that you+distribute.++  7. You may place library facilities that are a work based on the+Library side-by-side in a single library together with other library+facilities not covered by this License, and distribute such a combined+library, provided that the separate distribution of the work based on+the Library and of the other library facilities is otherwise+permitted, and provided that you do these two things:++    a) Accompany the combined library with a copy of the same work+    based on the Library, uncombined with any other library+    facilities.  This must be distributed under the terms of the+    Sections above.++    b) Give prominent notice with the combined library of the fact+    that part of it is a work based on the Library, and explaining+    where to find the accompanying uncombined form of the same work.++  8. You may not copy, modify, sublicense, link with, or distribute+the Library except as expressly provided under this License.  Any+attempt otherwise to copy, modify, sublicense, link with, or+distribute the Library is void, and will automatically terminate your+rights under this License.  However, parties who have received copies,+or rights, from you under this License will not have their licenses+terminated so long as such parties remain in full compliance.++  9. You are not required to accept this License, since you have not+signed it.  However, nothing else grants you permission to modify or+distribute the Library or its derivative works.  These actions are+prohibited by law if you do not accept this License.  Therefore, by+modifying or distributing the Library (or any work based on the+Library), you indicate your acceptance of this License to do so, and+all its terms and conditions for copying, distributing or modifying+the Library or works based on it.++  10. Each time you redistribute the Library (or any work based on the+Library), the recipient automatically receives a license from the+original licensor to copy, distribute, link with or modify the Library+subject to these terms and conditions.  You may not impose any further+restrictions on the recipients' exercise of the rights granted herein.+You are not responsible for enforcing compliance by third parties with+this License.++  11. If, as a consequence of a court judgment or allegation of patent+infringement or for any other reason (not limited to patent issues),+conditions are imposed on you (whether by court order, agreement or+otherwise) that contradict the conditions of this License, they do not+excuse you from the conditions of this License.  If you cannot+distribute so as to satisfy simultaneously your obligations under this+License and any other pertinent obligations, then as a consequence you+may not distribute the Library at all.  For example, if a patent+license would not permit royalty-free redistribution of the Library by+all those who receive copies directly or indirectly through you, then+the only way you could satisfy both it and this License would be to+refrain entirely from distribution of the Library.++If any portion of this section is held invalid or unenforceable under any+particular circumstance, the balance of the section is intended to apply,+and the section as a whole is intended to apply in other circumstances.++It is not the purpose of this section to induce you to infringe any+patents or other property right claims or to contest validity of any+such claims; this section has the sole purpose of protecting the+integrity of the free software distribution system which is+implemented by public license practices.  Many people have made+generous contributions to the wide range of software distributed+through that system in reliance on consistent application of that+system; it is up to the author/donor to decide if he or she is willing+to distribute software through any other system and a licensee cannot+impose that choice.++This section is intended to make thoroughly clear what is believed to+be a consequence of the rest of this License.++  12. If the distribution and/or use of the Library is restricted in+certain countries either by patents or by copyrighted interfaces, the+original copyright holder who places the Library under this License may add+an explicit geographical distribution limitation excluding those countries,+so that distribution is permitted only in or among countries not thus+excluded.  In such case, this License incorporates the limitation as if+written in the body of this License.++  13. The Free Software Foundation may publish revised and/or new+versions of the Lesser General Public License from time to time.+Such new versions will be similar in spirit to the present version,+but may differ in detail to address new problems or concerns.++Each version is given a distinguishing version number.  If the Library+specifies a version number of this License which applies to it and+"any later version", you have the option of following the terms and+conditions either of that version or of any later version published by+the Free Software Foundation.  If the Library does not specify a+license version number, you may choose any version ever published by+the Free Software Foundation.++  14. If you wish to incorporate parts of the Library into other free+programs whose distribution conditions are incompatible with these,+write to the author to ask for permission.  For software which is+copyrighted by the Free Software Foundation, write to the Free+Software Foundation; we sometimes make exceptions for this.  Our+decision will be guided by the two goals of preserving the free status+of all derivatives of our free software and of promoting the sharing+and reuse of software generally.++			    NO WARRANTY++  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.++  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH+DAMAGES.++		     END OF TERMS AND CONDITIONS++           How to Apply These Terms to Your New Libraries++  If you develop a new library, and you want it to be of the greatest+possible use to the public, we recommend making it free software that+everyone can redistribute and change.  You can do so by permitting+redistribution under these terms (or, alternatively, under the terms of the+ordinary General Public License).++  To apply these terms, attach the following notices to the library.  It is+safest to attach them to the start of each source file to most effectively+convey the exclusion of warranty; and each file should have at least the+"copyright" line and a pointer to where the full notice is found.++    <one line to give the library's name and a brief idea of what it does.>+    Copyright (C) <year>  <name of author>++    This library is free software; you can redistribute it and/or+    modify it under the terms of the GNU Lesser General Public+    License as published by the Free Software Foundation; either+    version 2.1 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+    Lesser General Public License for more details.++    You should have received a copy of the GNU Lesser General Public+    License along with this library; if not, write to the Free Software+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA++Also add information on how to contact you by electronic and paper mail.++You should also get your employer (if you work as a programmer) or your+school, if any, to sign a "copyright disclaimer" for the library, if+necessary.  Here is a sample; alter the names:++  Yoyodyne, Inc., hereby disclaims all copyright interest in the+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.++  <signature of Ty Coon>, 1 April 1990+  Ty Coon, President of Vice++That's all there is to it!++
+ Gtk2HsSetup.hs view
@@ -0,0 +1,486 @@+{-# LANGUAGE CPP #-}++#define CABAL_VERSION_ENCODE(major, minor, micro) (     \+          ((major) * 10000)                             \+        + ((minor) *   100)                             \+        + ((micro) *     1))++#define CABAL_VERSION_CHECK(major,minor,micro)    \+        (CABAL_VERSION >= CABAL_VERSION_ENCODE(major,minor,micro))++-- now, this is bad, but Cabal doesn't seem to actually pass any information about+-- its version to CPP, so guess the version depending on the version of GHC+#ifdef CABAL_VERSION_MINOR+#ifndef CABAL_VERSION_MAJOR+#define CABAL_VERSION_MAJOR 1+#endif+#ifndef CABAL_VERSION_MICRO+#define CABAL_VERSION_MICRO 0+#endif+#define CABAL_VERSION CABAL_VERSION_ENCODE(     \+        CABAL_VERSION_MAJOR,                    \+        CABAL_VERSION_MINOR,                    \+        CABAL_VERSION_MICRO)+#else+#warning Setup.hs is guessing the version of Cabal. If compilation of Setup.hs fails use -DCABAL_VERSION_MINOR=x for Cabal version 1.x.0 when building (prefixed by --ghc-option= when using the 'cabal' command)+#if (__GLASGOW_HASKELL__ >= 612)+#define CABAL_VERSION CABAL_VERSION_ENCODE(1,8,0)+#else+#define CABAL_VERSION CABAL_VERSION_ENCODE(1,6,0)+#endif+#endif++-- | Build a Gtk2hs package.+--+module Gtk2HsSetup ( gtk2hsUserHooks, getPkgConfigPackages ) where++import Distribution.Simple+import Distribution.Simple.PreProcess+import Distribution.InstalledPackageInfo ( importDirs,+                                           showInstalledPackageInfo,+                                           libraryDirs,+                                           extraLibraries,+                                           extraGHCiLibraries )+import Distribution.Simple.PackageIndex (+#if CABAL_VERSION_CHECK(1,8,0)+  lookupInstalledPackageId+#else+  lookupPackageId+#endif+  )+import Distribution.PackageDescription as PD ( PackageDescription(..),+                                               updatePackageDescription,+                                               BuildInfo(..),+                                               emptyBuildInfo, allBuildInfo,+                                               Library(..),+                                               libModules, hasLibs)+import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..),+                                           InstallDirs(..),+#if CABAL_VERSION_CHECK(1,8,0)+                                           componentPackageDeps,+#else+                                           packageDeps,+#endif+                                           absoluteInstallDirs)+import Distribution.Simple.Compiler  ( Compiler(..) )+import Distribution.Simple.Program (+  Program(..), ConfiguredProgram(..),+  rawSystemProgramConf, rawSystemProgramStdoutConf,+  c2hsProgram, pkgConfigProgram, requireProgram, ghcPkgProgram,+  simpleProgram, lookupProgram, rawSystemProgramStdout, ProgArg)+import Distribution.ModuleName ( ModuleName, components, toFilePath )+import Distribution.Simple.Utils+import Distribution.Simple.Setup (CopyFlags(..), InstallFlags(..), CopyDest(..),+                                  defaultCopyFlags, ConfigFlags(configVerbosity),+                                  fromFlag, toFlag, RegisterFlags(..), flagToMaybe,+                                  fromFlagOrDefault, defaultRegisterFlags)+import Distribution.Simple.BuildPaths ( autogenModulesDir )+import Distribution.Simple.Install ( install )+#if CABAL_VERSION_CHECK(1,8,0)+import Distribution.Simple.Register ( generateRegistrationInfo, registerPackage )+#else+import qualified Distribution.Simple.Register as Register ( register )+#endif+import Distribution.Text ( simpleParse, display )+import System.FilePath+import System.Directory ( doesFileExist )+import Distribution.Version (Version(..))+import Distribution.Verbosity+import Control.Monad (when, unless, filterM)+import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList )+import Data.List (isPrefixOf, isSuffixOf, nub)+import Data.Char (isAlpha)+import qualified Data.Map as M+import qualified Data.Set as S++import Control.Applicative ((<$>))+import System.Directory (getDirectoryContents, doesDirectoryExist)++-- the name of the c2hs pre-compiled header file+precompFile = "precompchs.bin"++gtk2hsUserHooks = simpleUserHooks {+    hookedPrograms = [typeGenProgram, signalGenProgram, c2hsLocal],+    hookedPreProcessors = [("chs", ourC2hs)],+    confHook = \pd cf ->+      confHook simpleUserHooks pd cf >>= return . adjustLocalBuildInfo,+    postConf = \args cf pd lbi -> do+      genSynthezisedFiles (fromFlag (configVerbosity cf)) pd lbi+      postConf simpleUserHooks args cf pd lbi,+    buildHook = \pd lbi uh bf -> fixDeps pd >>= \pd ->+                                 (buildHook simpleUserHooks) pd lbi uh bf,+    copyHook = \pd lbi uh flags -> (copyHook simpleUserHooks) pd lbi uh flags >>+      installCHI pd lbi (fromFlag (copyVerbosity flags)) (fromFlag (copyDest flags)),+    instHook = \pd lbi uh flags ->+#if defined(mingw32_HOST_OS) || defined(__MINGW32__)+      installHook pd lbi uh flags >>+      installCHI pd lbi (fromFlag (installVerbosity flags)) NoCopyDest,+    regHook = registerHook+#else+      instHook simpleUserHooks pd lbi uh flags >>+      installCHI pd lbi (fromFlag (installVerbosity flags)) NoCopyDest+#endif+  }++------------------------------------------------------------------------------+-- Lots of stuff for windows ghci support+------------------------------------------------------------------------------++getDlls :: [FilePath] -> IO [FilePath]+getDlls dirs = filter ((== ".dll") . takeExtension) . concat <$>+    mapM getDirectoryContents dirs++fixLibs :: [FilePath] -> [String] -> [String]+fixLibs dlls = concatMap $ \ lib ->+    case filter (("lib" ++ lib) `isPrefixOf`) dlls of+                dll:_ -> [dropExtension dll]+                _     -> if lib == "z" then [] else [lib]++-- The following code is a big copy-and-paste job from the sources of+-- Cabal 1.8 just to be able to fix a field in the package file. Yuck.++#if CABAL_VERSION_CHECK(1,8,0)+        +installHook :: PackageDescription -> LocalBuildInfo+                   -> UserHooks -> InstallFlags -> IO ()+installHook pkg_descr localbuildinfo _ flags = do+  let copyFlags = defaultCopyFlags {+                      copyDistPref   = installDistPref flags,+                      copyDest       = toFlag NoCopyDest,+                      copyVerbosity  = installVerbosity flags+                  }+  install pkg_descr localbuildinfo copyFlags+  let registerFlags = defaultRegisterFlags {+                          regDistPref  = installDistPref flags,+                          regInPlace   = installInPlace flags,+                          regPackageDB = installPackageDB flags,+                          regVerbosity = installVerbosity flags+                      }+  when (hasLibs pkg_descr) $ register pkg_descr localbuildinfo registerFlags++registerHook :: PackageDescription -> LocalBuildInfo+        -> UserHooks -> RegisterFlags -> IO ()+registerHook pkg_descr localbuildinfo _ flags =+    if hasLibs pkg_descr+    then register pkg_descr localbuildinfo flags+    else setupMessage verbosity+           "Package contains no library to register:" (packageId pkg_descr)+  where verbosity = fromFlag (regVerbosity flags)++register :: PackageDescription -> LocalBuildInfo+         -> RegisterFlags -- ^Install in the user's database?; verbose+         -> IO ()+register pkg@PackageDescription { library       = Just lib  }+         lbi@LocalBuildInfo     { libraryConfig = Just clbi } regFlags+  = do++    installedPkgInfoRaw <- generateRegistrationInfo+                           verbosity pkg lib lbi clbi inplace distPref++    dllsInScope <- getSearchPath >>= (filterM doesDirectoryExist) >>= getDlls+    let libs = fixLibs dllsInScope (extraLibraries installedPkgInfoRaw)+        installedPkgInfo = installedPkgInfoRaw {+                                extraGHCiLibraries = libs }++     -- Three different modes:+    case () of+     _ | modeGenerateRegFile   -> die "Generate Reg File not supported"+       | modeGenerateRegScript -> die "Generate Reg Script not supported"+       | otherwise             -> registerPackage verbosity+                                    installedPkgInfo pkg lbi inplace packageDb++  where+    modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))+    modeGenerateRegScript = fromFlag (regGenScript regFlags)+    inplace   = fromFlag (regInPlace regFlags)+    packageDb = case flagToMaybe (regPackageDB regFlags) of+                    Just db -> db+                    Nothing -> registrationPackageDB (withPackageDB lbi)+    distPref  = fromFlag (regDistPref regFlags)+    verbosity = fromFlag (regVerbosity regFlags)++register _ _ regFlags = notice verbosity "No package to register"+  where+    verbosity = fromFlag (regVerbosity regFlags)++#else+installHook :: PackageDescription -> LocalBuildInfo+                   -> UserHooks -> InstallFlags -> IO ()+installHook pkg_descr localbuildinfo _ flags = do+  let copyFlags = defaultCopyFlags {+                      copyDistPref   = installDistPref flags,+                      copyInPlace    = installInPlace flags,+                      copyUseWrapper = installUseWrapper flags,+                      copyDest       = toFlag NoCopyDest,+                      copyVerbosity  = installVerbosity flags+                  }+  install pkg_descr localbuildinfo copyFlags+  let registerFlags = defaultRegisterFlags {+                          regDistPref  = installDistPref flags,+                          regInPlace   = installInPlace flags,+                          regPackageDB = installPackageDB flags,+                          regVerbosity = installVerbosity flags+                      }+  when (hasLibs pkg_descr) $ register pkg_descr localbuildinfo registerFlags++registerHook :: PackageDescription -> LocalBuildInfo+        -> UserHooks -> RegisterFlags -> IO ()+registerHook pkg_descr localbuildinfo _ flags =+    if hasLibs pkg_descr+    then register pkg_descr localbuildinfo flags+    else setupMessage verbosity+           "Package contains no library to register:" (packageId pkg_descr)+  where verbosity = fromFlag (regVerbosity flags)++register :: PackageDescription -> LocalBuildInfo+         -> RegisterFlags -- ^Install in the user's database?; verbose+         -> IO ()+register pkg_descr lbi regFlags = do+  let verbosity = fromFlag (regVerbosity regFlags)+  warn verbosity "Cannot register ghci libraries with Cabal 1.6 (need 1.8)."+  Register.register pkg_descr lbi regFlags+  +#endif++------------------------------------------------------------------------------+-- This is a hack for Cabal-1.8, It is not needed in Cabal-1.9.1 or later+------------------------------------------------------------------------------++adjustLocalBuildInfo :: LocalBuildInfo -> LocalBuildInfo+adjustLocalBuildInfo lbi =+  let extra = (Just libBi, [])+      libBi = emptyBuildInfo { includeDirs = [ autogenModulesDir lbi+                                             , buildDir lbi ] }+   in lbi { localPkgDescr = updatePackageDescription extra (localPkgDescr lbi) }++------------------------------------------------------------------------------+-- Processing .chs files with our local c2hs.+------------------------------------------------------------------------------++ourC2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor+ourC2hs bi lbi = PreProcessor {+  platformIndependent = False,+  runPreProcessor = runC2HS bi lbi+}++runC2HS :: BuildInfo -> LocalBuildInfo ->+           (FilePath, FilePath) -> (FilePath, FilePath) -> Verbosity -> IO ()+runC2HS bi lbi (inDir, inFile)  (outDir, outFile) verbosity = do+  -- have the header file name if we don't have the precompiled header yet+  header <- case lookup "x-c2hs-header" (customFieldsBI bi) of+    Just h -> return h+    Nothing -> die ("Need x-c2hs-Header definition in the .cabal Library section "+++                    "that sets the C header file to process .chs.pp files.")++  -- c2hs will output files in out dir, removing any leading path of the input file.+  -- Thus, append the dir of the input file to the output dir.+  let (outFileDir, newOutFile) = splitFileName outFile+  let newOutDir = outDir </> outFileDir+  -- additional .chi files might be needed that other packages have installed;+  -- we assume that these are installed in the same place as .hi files+  let chiDirs = [ dir |+#if CABAL_VERSION_CHECK(1,8,0)+                  ipi <- maybe [] (map fst . componentPackageDeps) (libraryConfig lbi),+                  dir <- maybe [] importDirs (lookupInstalledPackageId (installedPkgs lbi) ipi) ]+#else+                  ipi <- packageDeps lbi,+                  dir <- maybe [] importDirs (lookupPackageId (installedPkgs lbi) ipi) ]+#endif+  rawSystemProgramConf verbosity c2hsLocal (withPrograms lbi) $+       map ("--include=" ++) (outDir:chiDirs)+    ++ ["--cppopts=" ++ opt | opt <- getCppOptions bi lbi]+    ++ ["--output-dir=" ++ newOutDir,+        "--output=" ++ newOutFile,+        "--precomp=" ++ buildDir lbi </> precompFile,+        header, inDir </> inFile]++getCppOptions :: BuildInfo -> LocalBuildInfo -> [String]+getCppOptions bi lbi+    = nub $+      ["-I" ++ dir | dir <- PD.includeDirs bi]+   ++ [opt | opt@('-':c:_) <- (PD.cppOptions bi ++ PD.ccOptions bi), c `elem` "DIU"]++installCHI :: PackageDescription -- ^information from the .cabal file+        -> LocalBuildInfo -- ^information from the configure step+        -> Verbosity -> CopyDest -- ^flags sent to copy or install+        -> IO ()+installCHI pkg@PD.PackageDescription { library = Just lib } lbi verbosity copydest = do+  let InstallDirs { libdir = libPref } = absoluteInstallDirs pkg lbi copydest+  -- cannot use the recommended 'findModuleFiles' since it fails if there exists+  -- a modules that does not have a .chi file+  mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi])+                 (map toFilePath+#if CABAL_VERSION_CHECK(1,8,0)+                   (PD.libModules lib)+#else+                   (PD.libModules pkg)+#endif+                 )+  let files = [ f | Just f <- mFiles ]+#if CABAL_VERSION_CHECK(1,8,0)+  installOrdinaryFiles verbosity libPref files+#else+  copyFiles verbosity libPref files+#endif++  +installCHI _ _ _ _ = return ()++------------------------------------------------------------------------------+-- Generating the type hierarchy and signal callback .hs files.+------------------------------------------------------------------------------++typeGenProgram :: Program+typeGenProgram = (simpleProgram "gtk2hsTypeGen")++signalGenProgram :: Program+signalGenProgram = (simpleProgram "gtk2hsHookGenerator")++c2hsLocal :: Program+c2hsLocal = (simpleProgram "gtk2hsC2hs")++genSynthezisedFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()+genSynthezisedFiles verb pd lbi = do++  cPkgs <- getPkgConfigPackages verb lbi pd++  let xList = maybe [] (customFieldsBI . libBuildInfo) (library pd)+              ++customFieldsPD pd+      typeOpts :: String -> [ProgArg]+      typeOpts tag = concat [ map (\val -> '-':'-':drop (length tag) field++'=':val) (words content)+                            | (field,content) <- xList,+                              tag `isPrefixOf` field,+                              field /= (tag++"file")]+              ++ [ "--tag=" ++ tag+                 | PackageIdentifier name (Version (major:minor:_) _) <- cPkgs+                 , let name' = filter isAlpha (display name)+                 , tag <- name'+                        : [ name' ++ "-" ++ show major ++ "." ++ show digit+                          | digit <- [0,2..minor] ]+                 ]++      signalsOpts :: [ProgArg]+      signalsOpts = concat [ map (\val -> '-':'-':drop 10 field++'=':val) (words content)+                        | (field,content) <- xList,+                          "x-signals-" `isPrefixOf` field,+                          field /= "x-signals-file"]++      genFile :: Program -> [ProgArg] -> FilePath -> IO ()+      genFile prog args outFile = do+         res <- rawSystemProgramStdoutConf verb prog (withPrograms lbi) args+         rewriteFile outFile res++  (flip mapM_) (filter (\(tag,_) -> "x-types-" `isPrefixOf` tag && "file" `isSuffixOf` tag) xList) $+    \(fileTag, f) -> do+      let tag = reverse (drop 4 (reverse fileTag))+      info verb ("Ensuring that class hierarchy in "++f++" is up-to-date.")+      genFile typeGenProgram (typeOpts tag) f++  case lookup "x-signals-file" xList of+    Nothing -> return ()+    Just f -> do+      info verb ("Ensuring that callback hooks in "++f++" are up-to-date.")+      genFile signalGenProgram signalsOpts f++--FIXME: Cabal should tell us the selected pkg-config package versions in the+--       LocalBuildInfo or equivalent.+--       In the mean time, ask pkg-config again.++getPkgConfigPackages :: Verbosity -> LocalBuildInfo -> PackageDescription -> IO [PackageId]+getPkgConfigPackages verbosity lbi pkg =+  sequence+    [ do version <- pkgconfig ["--modversion", display pkgname]+         case simpleParse version of+           Nothing -> die $ "parsing output of pkg-config --modversion failed"+           Just v  -> return (PackageIdentifier pkgname v)+    | Dependency pkgname _ <- concatMap pkgconfigDepends (allBuildInfo pkg) ]+  where+    pkgconfig = rawSystemProgramStdoutConf verbosity+                  pkgConfigProgram (withPrograms lbi)++------------------------------------------------------------------------------+-- Dependency calculation amongst .chs files.+------------------------------------------------------------------------------++-- Given all files of the package, find those that end in .chs and extract the+-- .chs files they depend upon. Then return the PackageDescription with these+-- files rearranged so that they are built in a sequence that files that are+-- needed by other files are built first.+fixDeps :: PackageDescription -> IO PackageDescription+fixDeps pd@PD.PackageDescription {+          PD.library = Just lib@PD.Library {+            PD.exposedModules = expMods,+            PD.libBuildInfo = bi@PD.BuildInfo {+              PD.hsSourceDirs = srcDirs,+              PD.otherModules = othMods+            }}} = do+  let findModule m = findFileWithExtension [".chs.pp",".chs"] srcDirs+                       (joinPath (components m))+  mExpFiles <- mapM findModule expMods+  mOthFiles <- mapM findModule othMods++  -- tag all exposed files with True so we throw an error if we need to build+  -- an exposed module before an internal modules (we cannot express this)+  let modDeps = zipWith (ModDep True []) expMods mExpFiles+++                zipWith (ModDep False []) othMods mOthFiles+  modDeps <- mapM extractDeps modDeps+  let (expMods, othMods) = span mdExposed $ sortTopological modDeps+      badOther = map (fromMaybe "<no file>" . mdLocation) $+                 filter (not . mdExposed) expMods+  unless (null badOther) $+    die ("internal chs modules "++intercalate "," badOther+++         " depend on exposed chs modules; cabal needs to build internal modules first")+  return pd { PD.library = Just lib {+    PD.exposedModules = map mdOriginal expMods,+    PD.libBuildInfo = bi { PD.otherModules = map mdOriginal othMods }+  }}++data ModDep = ModDep {+  mdExposed :: Bool,+  mdRequires :: [ModuleName],+  mdOriginal :: ModuleName,+  mdLocation :: Maybe FilePath+}++instance Show ModDep where+  show x = show (mdLocation x)++instance Eq ModDep where+  ModDep { mdOriginal = m1 } == ModDep { mdOriginal = m2 } = m1==m2+instance Ord ModDep where+  compare ModDep { mdOriginal = m1 } ModDep { mdOriginal = m2 } = compare m1 m2++-- Extract the dependencies of this file. This is intentionally rather naive as it+-- ignores CPP conditionals. We just require everything which means that the+-- existance of a .chs module may not depend on some CPP condition.  +extractDeps :: ModDep -> IO ModDep+extractDeps md@ModDep { mdLocation = Nothing } = return md+extractDeps md@ModDep { mdLocation = Just f } = withFileContents f $ \con -> do+  let findImports acc (('{':'#':xs):xxs) = case (dropWhile ((==) ' ') xs) of+        ('i':'m':'p':'o':'r':'t':' ':ys) ->+          case simpleParse (takeWhile ((/=) '#') ys) of+            Just m -> findImports (m:acc) xxs +            Nothing -> die ("cannot parse chs import in "++f++":\n"+++                            "offending line is {#"++xs)+         -- no more imports after the first non-import hook+        _ -> return acc+      findImports acc (_:xxs) = findImports acc xxs+      findImports acc [] = return acc+  mods <- findImports [] (lines con)+  return md { mdRequires = mods }++-- Find a total order of the set of modules that are partially sorted by their+-- dependencies on each other. The function returns the sorted list of modules+-- together with a list of modules that are required but not supplied by this+-- in the input set of modules.+sortTopological :: [ModDep] -> [ModDep]+sortTopological ms = reverse $ fst $ foldl visit ([], S.empty) (map mdOriginal ms)+  where+  set = M.fromList (map (\m -> (mdOriginal m, m)) ms)+  visit (out,visited) m+    | m `S.member` visited = (out,visited)+    | otherwise = case m `M.lookup` set of+        Nothing -> (out, m `S.insert` visited)+        Just md -> (md:out', visited')+          where+            (out',visited') = foldl visit (out, m `S.insert` visited) (mdRequires md)
+ Setup.hs view
@@ -0,0 +1,7 @@+-- Setup file for a Gtk2Hs module. Contains only adjustments specific to this module,+-- all Gtk2Hs-specific boilerplate is stored in Gtk2HsSetup.hs which should be kept+-- identical across all modules.+import Gtk2HsSetup ( gtk2hsUserHooks )+import Distribution.Simple ( defaultMainWithHooks )++main = defaultMainWithHooks gtk2hsUserHooks
+ System/GIO.hs view
@@ -0,0 +1,38 @@+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Peter Gavin+--  Created: 13-Oct-2008+--+--  Copyright (c) 2008 Peter Gavin+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 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+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO (+    module System.GIO.Async.AsyncResult,+    module System.GIO.Async.Cancellable,+    module System.GIO.File.File+    ) where++import System.GIO.Async.AsyncResult+import System.GIO.Async.Cancellable+import System.GIO.File.File+
+ System/GIO/Async/AsyncResult.chs view
@@ -0,0 +1,40 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Peter Gavin+--  Created: 13-Oct-2008+--+--  Copyright (c) 2008 Peter Gavin+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 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+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Async.AsyncResult (+    AsyncResult,+    AsyncResultClass,+    AsyncReadyCallback+    ) where++import System.Glib.FFI++import System.GIO.Base+{#import System.GIO.Types#}+
+ System/GIO/Async/Cancellable.chs view
@@ -0,0 +1,92 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Peter Gavin+--  Created: 13-Oct-2008+--+--  Copyright (c) 2008 Peter Gavin+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 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+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Async.Cancellable (+    Cancellable,+    cancellableNew,+    cancellableIsCancelled,+    cancellableThrowErrorIfCancelled,+    cancellableGetCurrent,+    cancellablePopCurrent,+    cancellablePushCurrent,+    cancellableReset,+    cancellableCancel,+    cancellableCancelled+    ) where++import Control.Monad++import System.Glib.FFI+import System.Glib.GError+{#import System.GIO.Signals#}++import System.GIO.Base+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++cancellableNew :: IO Cancellable+cancellableNew =+    {# call cancellable_new #} >>= takeGObject++cancellableIsCancelled :: Cancellable -> IO Bool+cancellableIsCancelled =+    liftM toBool . {# call cancellable_is_cancelled #}++cancellableThrowErrorIfCancelled :: Cancellable -> IO ()+cancellableThrowErrorIfCancelled cancellable =+    propagateGError $ \gErrorPtr -> do+      {# call cancellable_set_error_if_cancelled #} cancellable gErrorPtr+      return ()++cancellableGetCurrent :: IO (Maybe Cancellable)+cancellableGetCurrent =+    {# call cancellable_get_current #} >>= maybePeek takeGObject++cancellablePopCurrent :: Maybe Cancellable -> IO ()+cancellablePopCurrent cancellable =+    maybeWith withGObject cancellable g_cancellable_pop_current+    where+      _ = {# call cancellable_pop_current #}++cancellablePushCurrent :: Maybe Cancellable -> IO ()+cancellablePushCurrent cancellable =+    maybeWith withGObject cancellable g_cancellable_push_current+    where+      _ = {# call cancellable_push_current #}++cancellableReset :: Cancellable -> IO ()+cancellableReset = {# call cancellable_reset #}++cancellableCancel :: Cancellable -> IO ()+cancellableCancel = {# call cancellable_cancel #}++cancellableCancelled :: Signal Cancellable (IO ())+cancellableCancelled =+    Signal $ connect_NONE__NONE "cancelled"
+ System/GIO/Base.chs view
@@ -0,0 +1,104 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Peter Gavin+--  Created: 13-Oct-2008+--+--  Copyright (c) 2008 Peter Gavin+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 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+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Base where++import Control.Monad++import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GObject++{#import System.GIO.Types#}++type Offset = {# type goffset #}++cToFlags :: (Integral int, Flags flags)+         => int+         -> [flags]+cToFlags = toFlags . fromIntegral+cFromFlags :: (Integral int, Flags flags)+           => [flags]+           -> int+cFromFlags = fromIntegral . fromFlags++cToEnum :: (Integral int, Enum enum)+        => int+        -> enum+cToEnum = toEnum . fromIntegral+cFromEnum :: (Integral int, Enum enum)+           => enum+           -> int+cFromEnum = fromIntegral . fromEnum++withGObject :: GObjectClass objectT+            => objectT+            -> (Ptr objectT -> IO a)+            -> IO a+withGObject object action =+    let objectFPtr = unGObject $ toGObject object+    in withForeignPtr (castForeignPtr objectFPtr) action++peekGObject :: GObjectClass obj+            => Ptr obj+            -> IO obj+peekGObject cObject = do+  do cObjectRef $ castPtr cObject+     takeGObject cObject+foreign import ccall unsafe "&g_object_unref"+  objectFinalizer :: FunPtr (Ptr () -> IO ())+foreign import ccall unsafe "g_object_ref"+  cObjectRef :: Ptr ()+             -> IO (Ptr ())++takeGObject :: GObjectClass obj+            => Ptr obj+            -> IO obj+takeGObject cObject =+    liftM (unsafeCastGObject . GObject . castForeignPtr) $+        do newForeignPtr (castPtr cObject) objectFinalizer++type AsyncReadyCallback = GObject -> AsyncResult -> IO ()+type CAsyncReadyCallback = Ptr GObject -> Ptr AsyncResult -> Ptr () -> IO ()+foreign import ccall "wrapper"+    makeAsyncReadyCallback :: CAsyncReadyCallback+                           -> IO {# type GAsyncReadyCallback #}++marshalAsyncReadyCallback :: AsyncReadyCallback -> IO {# type GAsyncReadyCallback #}+marshalAsyncReadyCallback asyncReadyCallback =+    makeAsyncReadyCallback cAsyncReadyCallback+    where cAsyncReadyCallback :: CAsyncReadyCallback+          cAsyncReadyCallback cObject cAsyncResult cCallback = do+            object <- peekGObject cObject+            asyncResult <- peekGObject cAsyncResult+            asyncReadyCallback object asyncResult+            freeHaskellFunPtr (castPtrToFunPtr cCallback)++{# enum GFileAttributeInfoFlags as FileAttributeInfoFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Read, Show) #}+instance Flags FileAttributeInfoFlags
+ System/GIO/File/File.chs view
@@ -0,0 +1,1354 @@+{-# LANGUAGE CPP, DeriveDataTypeable #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Peter Gavin, Andy Stewart+--  Created: 13-Oct-2008+--+--  Copyright (c) 2008 Peter Gavin+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 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+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.File.File (+-- * Details+--+-- | GFile is a high level abstraction for manipulating files on a virtual file system. GFiles are+-- lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that+-- GFile objects do not represent files, merely an identifier for a file. All file content I/O is+-- implemented as streaming operations (see GInputStream and GOutputStream).+-- +-- To construct a GFile, you can use: 'fileNewForPath' if+-- you have a URI.  'fileNewForCommandlineArg'+-- from a utf8 string gotten from 'fileGetParseName'.+-- +-- One way to think of a GFile is as an abstraction of a pathname. For normal files the system pathname+-- is what is stored internally, but as GFiles are extensible it could also be something else that+-- corresponds to a pathname in a userspace implementation of a filesystem.+-- +-- GFiles make up hierarchies of directories and files that correspond to the files on a+-- filesystem. You can move through the file system with GFile using 'fileGetParent' to get an+-- identifier for the parent directory, 'fileGetChild' to get a child within a directory,+-- 'fileResolveRelativePath' to resolve a relative path between two GFiles. There can be multiple+-- hierarchies, so you may not end up at the same root if you repeatedly call 'fileGetParent' on+-- two different files.+-- +-- All GFiles have a basename (get with 'fileGetBasename'. These names are byte strings that are+-- used to identify the file on the filesystem (relative to its parent directory) and there is no+-- guarantees that they have any particular charset encoding or even make any sense at all. If you want+-- to use filenames in a user interface you should use the display name that you can get by requesting+-- the GFileAttributeStandardDisplayName attribute with 'fileQueryInfo'. This is guaranteed to+-- be in utf8 and can be used in a user interface. But always store the real basename or the GFile to+-- use to actually access the file, because there is no way to go from a display name to the actual+-- name.+-- +-- Using GFile as an identifier has the same weaknesses as using a path in that there may be multiple+-- aliases for the same file. For instance, hard or soft links may cause two different GFiles to refer+-- to the same file. Other possible causes for aliases are: case insensitive filesystems, short and+-- long names on Fat/NTFS, or bind mounts in Linux. If you want to check if two GFiles point to the+-- same file you can query for the GFileAttributeIdFile attribute. Note that GFile does some+-- trivial canonicalization of pathnames passed in, so that trivial differences in the path string used+-- at creation (duplicated slashes, slash at end of path, "." or ".." path segments, etc) does not+-- create different GFiles.+-- +-- Many GFile operations have both synchronous and asynchronous versions to suit your+-- application. Asynchronous versions of synchronous functions simply have _async() appended to their+-- function names. The asynchronous I/O functions call a GAsyncReadyCallback which is then used to+-- finalize the operation, producing a GAsyncResult which is then passed to the function's matching+-- _finish() operation.+-- +-- Some GFile operations do not have synchronous analogs, as they may take a very long time to finish,+-- and blocking may leave an application unusable. Notable cases include: 'fileMountMountable' to+-- mount a mountable file.  'fileUnmountMountableWithOperation' to unmount a mountable+-- file. 'fileEjectMountableWithOperation' to eject a mountable file.+-- +-- One notable feature of GFiles are entity tags, or "etags" for short. Entity tags are somewhat like a+-- more abstract version of the traditional mtime, and can be used to quickly determine if the file has+-- been modified from the version on the file system. See the HTTP 1.1 specification for HTTP Etag+-- headers, which are a very similar concept.++-- * Types.+    FileProgressCallback,+    FileReadMoreCallback,+    FileClass,++-- * Enums+    File(..),+    FileQueryInfoFlags(..),+    FileCreateFlags(..),+    FileCopyFlags(..),+    FileMonitorFlags(..),+    FilesystemPreviewType(..),+    FileType(..),++-- * Methods+    fileFromPath,+    fileFromURI,+    fileFromCommandlineArg,+    fileFromParseName,+    fileEqual,+    fileBasename,+    filePath,+#if GLIB_CHECK_VERSION(2,24,0)+    fileHasParent,+#endif+    fileURI,+    fileParseName,+    fileGetChild,+    fileGetChildForDisplayName,+    fileHasPrefix,+    fileGetRelativePath,+    fileResolveRelativePath,+    fileIsNative,+    fileHasURIScheme,+    fileURIScheme,+    fileRead,+    fileReadAsync,+    fileReadFinish,+    fileAppendTo,+    fileCreate,+    fileReplace,+    fileAppendToAsync,+    fileAppendToFinish,+    fileCreateAsync,+    fileCreateFinish,+    fileReplaceAsync,+    fileReplaceFinish,+    fileQueryInfo,+    fileQueryInfoAsync,+    fileQueryInfoFinish,+    fileQueryExists,+#if GLIB_CHECK_VERSION(2,18,0)+    fileQueryFileType,+#endif+    fileQueryFilesystemInfo,+    fileQueryFilesystemInfoAsync,+    fileQueryFilesystemInfoFinish,+    fileQueryDefaultHandler,+    fileFindEnclosingMount,+    fileFindEnclosingMountAsync,+    fileFindEnclosingMountFinish,+    fileEnumerateChildren,+    fileEnumerateChildrenAsync,+    fileEnumerateChildrenFinish,+    fileSetDisplayName,+    fileSetDisplayNameAsync,+    fileSetDisplayNameFinish,+    fileDelete,+    fileTrash,+    fileCopy,+    fileCopyAsync,+    fileCopyFinish,+    fileMove,+    fileMakeDirectory,+#if GLIB_CHECK_VERSION(2,18,0)+    fileMakeDirectoryWithParents,+#endif+    fileMakeSymbolicLink,+    fileQuerySettableAttributes,+    fileQueryWritableNamespaces+    ) where++import Control.Monad+import qualified Data.ByteString as BS+import Data.Typeable++import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.UTFString+import System.Glib.GObject++{#import System.GIO.Base#}+{#import System.GIO.Types#}+import System.GIO.File.FileAttribute++{# context lib = "gio" prefix = "g" #}++{# enum GFileQueryInfoFlags as FileQueryInfoFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags FileQueryInfoFlags++{# enum GFileCreateFlags as FileCreateFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags FileCreateFlags++{# enum GFileCopyFlags as FileCopyFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags FileCopyFlags++{# enum GFileMonitorFlags as FileMonitorFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags FileMonitorFlags++{# enum GFilesystemPreviewType as FilesystemPreviewType {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}++{# enum GFileType as FileType {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}++type FileProgressCallback = Offset -> Offset -> IO ()+type CFileProgressCallback = {# type goffset #} -> {# type goffset #} -> Ptr () -> IO ()+foreign import ccall "wrapper"+    makeFileProgressCallback :: CFileProgressCallback+                             -> IO {# type GFileProgressCallback #}++marshalFileProgressCallback :: FileProgressCallback -> IO {# type GFileProgressCallback #}+marshalFileProgressCallback fileProgressCallback =+    makeFileProgressCallback cFileProgressCallback+    where cFileProgressCallback :: CFileProgressCallback+          cFileProgressCallback cCurrentNumBytes cTotalNumBytes _ = do+            fileProgressCallback (fromIntegral cCurrentNumBytes)+                                 (fromIntegral cTotalNumBytes)++type FileReadMoreCallback = BS.ByteString -> IO Bool++-- | Constructs a GFile for a given path. This operation never fails, but the returned object might not+-- support any I/O operation if path is malformed.+fileFromPath :: FilePath -> File+fileFromPath path =+    unsafePerformIO $ withUTFString path $ \cPath -> {# call file_new_for_path #} cPath >>= takeGObject++-- | Constructs a GFile for a given URI. This operation never fails, but the returned object might not+-- support any I/O operation if uri is malformed or if the uri type is not supported.+fileFromURI :: String -> File+fileFromURI uri =+    unsafePerformIO $ withUTFString uri $ \cURI -> {# call file_new_for_uri #} cURI >>= takeGObject++-- | Creates a GFile with the given argument from the command line. The value of arg can be either a URI,+-- an absolute path or a relative path resolved relative to the current working directory. This+-- operation never fails, but the returned object might not support any I/O operation if arg points to+-- a malformed path.+fileFromCommandlineArg :: String -> File+fileFromCommandlineArg arg =+    unsafePerformIO $ withUTFString arg $ \cArg -> {# call file_new_for_commandline_arg #} cArg >>= takeGObject++-- | Constructs a GFile with the given 'name (i.e. something given by gFileGetParseName'. This+-- operation never fails, but the returned object might not support any I/O operation if the @parseName@+-- cannot be parsed.+fileFromParseName :: String -> File+fileFromParseName parseName =+    unsafePerformIO $ withUTFString parseName $ \cParseName -> {# call file_parse_name #} cParseName >>= takeGObject++-- | Compare two file descriptors for equality. This test is also used to+--   implement the '(==)' function, that is, comparing two descriptions+--   will compare their content, not the pointers to the two structures.+--+fileEqual :: (FileClass file1, FileClass file2)+          => file1 -> file2 -> Bool+fileEqual file1 file2 =+    unsafePerformIO $ liftM toBool $ {# call file_equal #} (toFile file1) (toFile file2)++instance Eq File where+    (==) = fileEqual++-- | Gets the base name (the last component of the path) for a given GFile.+-- +-- If called for the top level of a system (such as the filesystem root or a uri like sftp://host/) it+-- will return a single directory separator (and on Windows, possibly a drive letter).+-- +-- The base name is a byte string (*not* UTF-8). It has no defined encoding or rules other than it may+-- not contain zero bytes.  If you want to use filenames in a user interface you should use the display+-- name that you can get by requesting the GFileAttributeStandardDisplayName attribute with+-- 'fileQueryInfo'.+-- +-- This call does no blocking i/o.+fileBasename :: FileClass file => file -> String+fileBasename file =+    unsafePerformIO $ {# call file_get_basename #} (toFile file) >>= readUTFString++-- | Gets the local pathname for GFile, if one exists.+-- +-- This call does no blocking i/o.+filePath :: FileClass file => file -> FilePath+filePath file =+    unsafePerformIO $ {# call file_get_path #} (toFile file) >>= readUTFString++-- | Gets the URI for the file.+-- +-- This call does no blocking i/o.+fileURI :: FileClass file => file -> String+fileURI file =+    unsafePerformIO $ {# call file_get_uri #} (toFile file) >>= readUTFString++-- | Gets the parse name of the file. A parse name is a UTF-8 string that describes the file such that+-- one can get the GFile back using 'fileParseName'.+-- +-- This is generally used to show the GFile as a nice full-pathname kind of string in a user interface,+-- like in a location entry.+-- +-- For local files with names that can safely be converted to UTF8 the pathname is used, otherwise the+-- IRI is used (a form of URI that allows UTF8 characters unescaped).+-- +-- This call does no blocking i/o.+fileParseName :: FileClass file => file -> String+fileParseName file =+    unsafePerformIO $ {# call file_get_parse_name #} (toFile file) >>= readUTFString++-- | Gets the parent directory for the file. If the file represents the root directory of the file+-- system, then 'Nothing' will be returned.+-- +-- This call does no blocking i/o.+fileParent :: FileClass file => file -> Maybe File+fileParent file =+    unsafePerformIO $ {# call file_get_parent #} (toFile file) >>= maybePeek takeGObject++#if GLIB_CHECK_VERSION(2,24,0)+-- | Checks if file has a parent, and optionally, if it is parent.+-- +-- If parent is 'Nothing' then this function returns 'True' if file has any parent at all. If parent is+-- non-'Nothing' then 'True' is only returned if file is a child of parent.+fileHasParent :: FileClass file => file -> Maybe File -> Bool +fileHasParent file parent = +    unsafePerformIO $ liftM toBool $+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject parent $ \parentPtr ->+                  g_file_has_parent cFile parentPtr+    where _ = {#call file_has_parent #}+#endif++-- | Gets a child of file with basename equal to name.+-- +-- Note that the file with that specific name might not exist, but you can still have a GFile that+-- points to it. You can use this for instance to create that file.+-- +-- This call does no blocking i/o.+fileGetChild :: FileClass file => file -> String -> File+fileGetChild file name =+    unsafePerformIO $+        withUTFString name $ \cName ->+        {# call file_get_child #} (toFile file) cName >>= takeGObject++-- | Gets the child of file for a given 'name (i.e. a UTF8 version of the name)'. If this function+-- fails, it returns 'Nothing' and error will be set. This is very useful when constructing a GFile for a+-- new file and the user entered the filename in the user interface, for instance when you select a+-- directory and type a filename in the file selector.+-- +-- This call does no blocking i/o.+fileGetChildForDisplayName :: FileClass file => file -> String -> Maybe File+fileGetChildForDisplayName file displayName =+    unsafePerformIO $+        withUTFString displayName $ \cDisplayName ->+        propagateGError ({# call file_get_child_for_display_name #} (toFile file) cDisplayName) >>=+        maybePeek takeGObject++-- | Checks whether file has the prefix specified by prefix. In other word, if the names of inital+-- elements of files pathname match prefix. Only full pathname elements are matched, so a path like+-- /foo is not considered a prefix of /foobar, only of / foo/bar.+-- +-- This call does no i/o, as it works purely on names. As such it can sometimes return 'False' even if+-- file is inside a prefix (from a filesystem point of view), because the prefix of file is an alias of+-- prefix.+fileHasPrefix :: (FileClass file1, FileClass file2) => file1 -> file2 -> Bool+fileHasPrefix file1 file2 =+    unsafePerformIO $+        liftM toBool $ {# call file_has_prefix #} (toFile file1) (toFile file2)++-- | Gets the path for descendant relative to parent.+-- +-- This call does no blocking i/o.+fileGetRelativePath :: (FileClass file1, FileClass file2) => file1 -> file2 -> Maybe FilePath+fileGetRelativePath file1 file2 =+    unsafePerformIO $+        {# call file_get_relative_path #} (toFile file1) (toFile file2) >>=+        maybePeek readUTFString++-- | Resolves a relative path for file to an absolute path.+-- +-- This call does no blocking i/o.+fileResolveRelativePath :: FileClass file => file -> FilePath -> Maybe File+fileResolveRelativePath file relativePath =+    unsafePerformIO $+        withUTFString relativePath $ \cRelativePath ->+        {# call file_resolve_relative_path #} (toFile file) cRelativePath >>=+        maybePeek takeGObject++-- | Checks to see if a file is native to the platform.+-- +-- A native file s one expressed in the platform-native filename format, e.g. \"C:\\Windows\" or+-- \"/usr/bin/\". This does not mean the file is local, as it might be on a locally mounted remote+-- filesystem.+-- +-- On some systems non-native files may be available using the native filesystem via a userspace+-- filesystem (FUSE), in these cases this call will return @False@, but 'fileGetPath' will still+-- return a native path.+-- +-- This call does no blocking i/o.+fileIsNative :: FileClass file => file -> Bool+fileIsNative =+    unsafePerformIO .+        liftM toBool . {# call file_is_native #} . toFile++-- | Checks to see if a 'GFile' has a given URI scheme.+-- +-- This call does no blocking i/o.+fileHasURIScheme :: FileClass file => file -> String -> Bool+fileHasURIScheme file uriScheme =+    unsafePerformIO $+        withUTFString uriScheme $ \cURIScheme ->+        liftM toBool $ {# call file_has_uri_scheme #} (toFile file) cURIScheme++-- | Gets the URI scheme for a GFile. RFC 3986 decodes the scheme as:+-- +-- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]+-- +-- Common schemes include "file", "http", "ftp", etc.+-- +-- This call does no blocking i/o.+fileURIScheme :: FileClass file => file -> String+fileURIScheme file =+    unsafePerformIO $ {# call file_get_uri_scheme #} (toFile file) >>= readUTFString++-- | Opens a file for reading. The result is a GFileInputStream that can be used to read the contents of+-- the file.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+-- +-- If the file does not exist, the GIoErrorNotFound error will be returned. If the file is a+-- directory, the GIoErrorIsDirectory error will be returned. Other errors are possible too, and+-- depend on what kind of filesystem the file is on.+fileRead :: FileClass file => file -> Maybe Cancellable -> IO FileInputStream+fileRead file (Just cancellable) = constructNewGObject mkFileInputStream $+    propagateGError $ {# call file_read #} (toFile file) cancellable+fileRead file Nothing = constructNewGObject mkFileInputStream $+    propagateGError $ {# call file_read #} (toFile file) (Cancellable nullForeignPtr)++-- | Asynchronously opens file for reading.+-- +-- For more details, see 'fileRead' which is the synchronous version of this call.+-- +-- When the operation is finished, callback will be called. You can then call 'fileReadFinish' to+-- get the result of the operation.+fileReadAsync :: FileClass file+              => file+              -> Int+              -> Maybe Cancellable+              -> AsyncReadyCallback+              -> IO ()+fileReadAsync file ioPriority mbCancellable callback =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject mbCancellable $ \cCancellable -> do+          cCallback <- marshalAsyncReadyCallback callback+          g_file_read_async cFile+                            (fromIntegral ioPriority)+                            cCancellable+                            cCallback+                            (castFunPtrToPtr cCallback)+    where _ = {# call file_read_async #}++-- | Finishes an asynchronous file read operation started with 'fileReadAsync'.+fileReadFinish :: FileClass file+               => file+               -> AsyncResult+               -> IO FileInputStream+fileReadFinish file asyncResult =+    propagateGError ({# call file_read_finish #} (toFile file) asyncResult) >>= takeGObject++-- | Gets an output stream for appending data to the file. If the file doesn't already exist it is+-- created.+-- +-- By default files created are generally readable by everyone, but if you pass GFileCreatePrivate+-- in flags the file will be made readable only to the current user, to the level that is supported on+-- the target filesystem.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+-- +-- Some file systems don't allow all file names, and may return an GIoErrorInvalidFilename+-- error. If the file is a directory the GIoErrorIsDirectory error will be returned. Other errors+-- are possible too, and depend on what kind of filesystem the file is on.+fileAppendTo :: FileClass file+             => file+             -> [FileCreateFlags]+             -> Maybe Cancellable+             -> IO FileOutputStream+fileAppendTo file flags cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_append_to cFile (cFromFlags flags) cCancellable) >>=+        takeGObject+    where _ = {# call file_append_to #}++-- | Creates a new file and returns an output stream for writing to it. The file must not already exist.+-- +-- By default files created are generally readable by everyone, but if you pass GFileCreatePrivate+-- in flags the file will be made readable only to the current user, to the level that is supported on+-- the target filesystem.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+-- +-- If a file or directory with this name already exists the GIoErrorExists error will be+-- returned. Some file systems don't allow all file names, and may return an+-- GIoErrorInvalidFilename error, and if the name is to long GIoErrorFilenameTooLong will be+-- returned. Other errors are possible too, and depend on what kind of filesystem the file is on.+fileCreate :: FileClass file+           => file+           -> [FileCreateFlags]+           -> Maybe Cancellable+           -> IO FileOutputStream+fileCreate file flags cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_create cFile (cFromFlags flags) cCancellable) >>=+        takeGObject+    where _ = {# call file_create #}++-- | Returns an output stream for overwriting the file, possibly creating a backup copy of the file+-- first. If the file doesn't exist, it will be created.+-- +-- This will try to replace the file in the safest way possible so that any errors during the writing+-- will not affect an already existing copy of the file. For instance, for local files it may write to+-- a temporary file and then atomically rename over the destination when the stream is closed.+-- +-- By default files created are generally readable by everyone, but if you pass GFileCreatePrivate+-- in flags the file will be made readable only to the current user, to the level that is supported on+-- the target filesystem.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+-- +-- If you pass in a non-'Nothing' etag value, then this value is compared to the current entity tag of the+-- file, and if they differ an GIoErrorWrongEtag error is returned. This generally means that the+-- file has been changed since you last read it. You can get the new etag from+-- 'fileOutputStreamGetEtag' after you've finished writing and closed the GFileOutputStream.+-- When you load a new file you can use 'fileInputStreamQueryInfo' to get the etag of the file.+-- +-- If @makeBackup@ is 'True', this function will attempt to make a backup of the current file before+-- overwriting it. If this fails a GIoErrorCantCreateBackup error will be returned. If you want to+-- replace anyway, try again with @makeBackup@ set to 'False'.+-- +-- If the file is a directory the GIoErrorIsDirectory error will be returned, and if the file is+-- some other form of non-regular file then a GIoErrorNotRegularFile error will be returned. Some+-- file systems don't allow all file names, and may return an GIoErrorInvalidFilename error, and if+-- the name is to long GIoErrorFilenameTooLong will be returned. Other errors are possible too,+-- and depend on what kind of filesystem the file is on.+fileReplace :: FileClass file+            => file+            -> Maybe String+            -> Bool+            -> [FileCreateFlags]+            -> Maybe Cancellable+            -> IO FileOutputStream+fileReplace file etag makeBackup flags cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withUTFString etag $ \cEtag ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_replace cFile+                                        cEtag+                                        (fromBool makeBackup)+                                        (cFromFlags flags) cCancellable) >>=+        takeGObject+    where _ = {# call file_replace #}++-- | Asynchronously opens file for appending.+-- +-- For more details, see 'fileAppendTo' which is the synchronous version of this call.+-- +-- When the operation is finished, callback will be called. You can then call 'fileAppendToFinish'+-- to get the result of the operation.+fileAppendToAsync :: FileClass file+                  => file+                  -> [FileCreateFlags]+                  -> Int+                  -> Maybe Cancellable+                  -> AsyncReadyCallback+                  -> IO ()+fileAppendToAsync file flags ioPriority cancellable callback =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cCallback <- marshalAsyncReadyCallback callback+          g_file_append_to_async cFile+                                 (cFromFlags flags)+                                 (fromIntegral ioPriority)+                                 cCancellable+                                 cCallback+                                 (castFunPtrToPtr cCallback)+    where _ = {# call file_append_to_async #}++-- | Finishes an asynchronous file append operation started with 'fileAppendToAsync'.+fileAppendToFinish :: FileClass file+                   => file+                   -> AsyncResult+                   -> IO FileOutputStream+fileAppendToFinish file asyncResult =+    propagateGError ({# call file_append_to_finish #} (toFile file) asyncResult) >>= takeGObject++-- | Asynchronously creates a new file and returns an output stream for writing to it. The file must not+-- already exist.+-- +-- For more details, see 'fileCreate' which is the synchronous version of this call.+-- +-- When the operation is finished, callback will be called. You can then call 'fileCreateFinish' to+-- get the result of the operation.+fileCreateAsync :: FileClass file+                  => file+                  -> [FileCreateFlags]+                  -> Int+                  -> Maybe Cancellable+                  -> AsyncReadyCallback+                  -> IO ()+fileCreateAsync file flags ioPriority cancellable callback =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cCallback <- marshalAsyncReadyCallback callback+          g_file_create_async cFile+                              (cFromFlags flags)+                              (fromIntegral ioPriority)+                              cCancellable+                              cCallback+                              (castFunPtrToPtr cCallback)+    where _ = {# call file_create_async #}++-- | Finishes an asynchronous file create operation started with 'fileCreateAsync'.+fileCreateFinish :: FileClass file+                   => file+                   -> AsyncResult+                   -> IO FileOutputStream+fileCreateFinish file asyncResult =+    propagateGError ({# call file_create_finish #} (toFile file) asyncResult) >>= takeGObject++-- | Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the+-- file first.+-- +-- For more details, see 'fileReplace' which is the synchronous version of this call.+-- +-- When the operation is finished, callback will be called. You can then call 'fileReplaceFinish'+-- to get the result of the operation.+fileReplaceAsync :: FileClass file+                 => file+                 -> String+                 -> Bool+                 -> [FileCreateFlags]+                 -> Int+                 -> Maybe Cancellable+                 -> AsyncReadyCallback+                 -> IO ()+fileReplaceAsync file etag makeBackup flags ioPriority cancellable callback =+    withGObject (toFile file) $ \cFile ->+        withUTFString etag $ \cEtag ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cCallback <- marshalAsyncReadyCallback callback+          g_file_replace_async cFile+                               cEtag+                               (fromBool makeBackup)+                               (cFromFlags flags)+                               (fromIntegral ioPriority)+                               cCancellable+                               cCallback+                               (castFunPtrToPtr cCallback)+    where _ = {# call file_replace_async #}++-- | Finishes an asynchronous file replace operation started with 'fileReplaceAsync'.+fileReplaceFinish :: FileClass file+                  => file+                  -> AsyncResult+                  -> IO FileOutputStream+fileReplaceFinish file asyncResult =+    propagateGError ({# call file_replace_finish #} (toFile file) asyncResult) >>= takeGObject++-- | Gets the requested information about specified file. The result is a 'GFileInfo' object that contains+-- key-value attributes (such as the type or size of the file).+-- +-- The attribute value is a string that specifies the file attributes that should be gathered. It is+-- not an error if it's not possible to read a particular requested attribute from a file - it just+-- won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The+-- wildcard \"*\" means all attributes, and a wildcard like \"standard::*\" means all attributes in the+-- standard namespace. An example attribute query be \"standard::*,'user'\". The standard attributes+-- are available as defines, like 'GFileAttributeStandardName'.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error 'GIoErrorCancelled' will be+-- returned.+-- +-- For symlinks, normally the information about the target of the symlink is returned, rather than+-- information about the symlink itself. However if you pass 'GFileQueryInfoNofollowSymlinks' in+-- flags the information about the symlink itself will be returned. Also, for symlinks that point to+-- non-existing files the information about the symlink itself will be returned.+-- +-- If the file does not exist, the 'GIoErrorNotFound' error will be returned. Other errors are+-- possible too, and depend on what kind of filesystem the file is on.+fileQueryInfo :: FileClass file+              => file+              -> String+              -> [FileQueryInfoFlags]+              -> Maybe Cancellable+              -> IO FileInfo+fileQueryInfo file attributes flags cancellable =+    withGObject (toFile file) $ \cFile ->+        withUTFString attributes $ \cAttributes ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_query_info cFile cAttributes (cFromFlags flags) cCancellable) >>=+        takeGObject+    where _ = {# call file_query_info #}++-- | Asynchronously gets the requested information about specified file. The+-- result is a 'GFileInfo' object that contains key-value attributes (such as+-- type or size for the file).+--  +-- For more details, see 'fileQueryInfo' which is the synchronous version of+-- this call.+--  +-- When the operation is finished, callback will be called. You can then call+-- 'fileQueryInfoFinish' to get the result of the operation.+fileQueryInfoAsync :: FileClass file+                   => file+                   -> String+                   -> [FileQueryInfoFlags]+                   -> Int+                   -> Maybe Cancellable+                   -> AsyncReadyCallback+                   -> IO ()+fileQueryInfoAsync file attributes flags ioPriority cancellable callback =+    withGObject (toFile file) $ \cFile ->+        withUTFString attributes $ \cAttributes ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cCallback <- marshalAsyncReadyCallback callback+          g_file_query_info_async cFile+                                  cAttributes+                                  (cFromFlags flags)+                                  (fromIntegral ioPriority)+                                  cCancellable+                                  cCallback+                                  (castFunPtrToPtr cCallback)+    where _ = {# call file_query_info_async #}++-- | Finishes an asynchronous file info query. See 'fileQueryInfoAsync'.+fileQueryInfoFinish :: FileClass file+                    => file+                    -> AsyncResult+                    -> IO FileInfo+fileQueryInfoFinish file asyncResult =+    propagateGError ({#call file_query_info_finish #} (toFile file) asyncResult) >>= takeGObject++-- | Utility function to check if a particular file exists. This is implemented using 'fileQueryInfo'+-- and as such does blocking I/O.+-- +-- Note that in many cases it is racy to first check for file existence and then execute something+-- based on the outcome of that, because the file might have been created or removed in between the+-- operations. The general approach to handling that is to not check, but just do the operation and+-- handle the errors as they come.+-- +-- As an example of race-free checking, take the case of reading a file, and if it doesn't exist,+-- creating it. There are two racy versions: read it, and on error create it; and: check if it exists,+-- if not create it. These can both result in two processes creating the file (with perhaps a partially+-- written file as the result). The correct approach is to always try to create the file with+-- 'fileCreate' which will either atomically create the file or fail with a GIoErrorExists error.+-- +-- However, in many cases an existence check is useful in a user interface, for instance to make a menu+-- item sensitive/ insensitive, so that you don't have to fool users that something is possible and+-- then just show and error dialog. If you do this, you should make sure to also handle the errors that+-- can happen due to races when you execute the operation.+fileQueryExists :: FileClass file+                => file+                -> Maybe Cancellable+                -> IO Bool+fileQueryExists file cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable ->+            liftM toBool $ g_file_query_exists cFile cCancellable+    where _ = {# call file_query_exists #}++#if GLIB_CHECK_VERSION(2,18,0)+-- | Utility function to inspect the GFileType of a file. This is implemented using 'fileQueryInfo'+-- 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.+fileQueryFileType :: FileClass file +                    => file +                    -> [FileQueryInfoFlags]+                    -> Maybe Cancellable+                    -> IO FileType+fileQueryFileType file flags cancellable = +    liftM (toEnum . fromIntegral) $+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable ->+        (g_file_query_file_type cFile (cFromFlags flags) cCancellable)+    where _ = {# call file_query_file_type #}+#endif++-- | Similar to 'fileQueryInfo', but obtains information about the filesystem the file is on, rather+-- than the file itself.  For instance the amount of space available and the type of the filesystem.+-- +-- The attribute value is a string that specifies the file attributes that should be gathered. It is+-- not an error if it's not possible to read a particular requested attribute from a file - it just+-- won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The+-- wildcard "*" means all attributes, and a wildcard like "fs:*" means all attributes in the fs+-- namespace. The standard namespace for filesystem attributes is "fs". Common attributes of interest+-- are 'FILEAttributeFilesystemSize (The Total Size Of The Filesystem In Bytes)',+-- 'FILEAttributeFilesystemFree (Number Of Bytes Available)', and GFileAttributeFilesystemType+-- (type of the filesystem).+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+-- +-- If the file does not exist, the GIoErrorNotFound error will be returned. Other errors are+-- possible too, and depend on what kind of filesystem the file is on.+fileQueryFilesystemInfo :: FileClass file+                        => file+                        -> String+                        -> Maybe Cancellable+                        -> IO FileInfo+fileQueryFilesystemInfo file attributes cancellable =+    withGObject (toFile file) $ \cFile ->+        withUTFString attributes $ \cAttributes ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_query_filesystem_info cFile cAttributes cCancellable) >>=+        takeGObject+    where _ = {# call file_query_filesystem_info #}++-- | Asynchronously gets the requested information about the filesystem that the specified file is+-- on. The result is a GFileInfo object that contains key-value attributes (such as type or size for+-- the file).+-- +-- For more details, see 'fileQueryFilesystemInfo' which is the synchronous version of this call.+-- +-- When the operation is finished, callback will be called. You can then call+-- 'fileQueryInfoFinish' to get the result of the operation.+fileQueryFilesystemInfoAsync :: FileClass file+                             => file+                             -> String+                             -> Int+                             -> Maybe Cancellable+                             -> AsyncReadyCallback+                             -> IO ()+fileQueryFilesystemInfoAsync file attributes ioPriority cancellable callback =+    withGObject (toFile file) $ \cFile ->+        withUTFString attributes $ \cAttributes ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cCallback <- marshalAsyncReadyCallback callback+          g_file_query_filesystem_info_async cFile+                                             cAttributes+                                             (fromIntegral ioPriority)+                                             cCancellable+                                             cCallback+                                             (castFunPtrToPtr cCallback)+    where _ = {# call file_query_filesystem_info_async #}++-- | Finishes an asynchronous filesystem info query. See 'fileQueryFilesystemInfoAsync'.+fileQueryFilesystemInfoFinish :: FileClass file+                              => file+                              -> AsyncResult+                              -> IO FileInfo+fileQueryFilesystemInfoFinish file asyncResult =+    propagateGError ({# call file_query_filesystem_info_finish #} (toFile file) asyncResult) >>=+        takeGObject++-- | Returns the GAppInfo that is registered as the default application to handle the file specified by+-- file.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileQueryDefaultHandler :: FileClass file+                        => file+                        -> Maybe Cancellable+                        -> IO AppInfo+fileQueryDefaultHandler file cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_query_default_handler cFile cCancellable) >>=+        takeGObject+    where _ = {# call file_query_default_handler #}++-- | Gets a GMount for the GFile.+-- +-- If the GFileIface for file does not have a mount (e.g. possibly a remote share), error will be set+-- to GIoErrorNotFound and 'Nothing' will be returned.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileFindEnclosingMount :: FileClass file+                       => file+                       -> Maybe Cancellable+                       -> IO Mount+fileFindEnclosingMount file cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_find_enclosing_mount cFile cCancellable) >>=+        takeGObject+    where _ = {# call file_find_enclosing_mount #}++-- | Asynchronously gets the mount for the file.+-- +-- For more details, see 'fileFindEnclosingMount' which is the synchronous version of this call.+-- +-- When the operation is finished, callback will be called. You can then call+-- 'fileFindEnclosingMountFinish' to get the result of the operation.+fileFindEnclosingMountAsync :: FileClass file+                            => file+                            -> Int+                            -> Maybe Cancellable+                            -> AsyncReadyCallback+                            -> IO ()+fileFindEnclosingMountAsync file ioPriority cancellable callback =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cCallback <- marshalAsyncReadyCallback callback+          g_file_find_enclosing_mount_async cFile+                                            (fromIntegral ioPriority)+                                            cCancellable+                                            cCallback+                                            (castFunPtrToPtr cCallback)+    where _ = {# call file_find_enclosing_mount_async #}++-- | Finishes an asynchronous find mount request. See 'fileFindEnclosingMountAsync'.+fileFindEnclosingMountFinish :: FileClass file+                             => file+                             -> AsyncResult+                             -> IO Mount+fileFindEnclosingMountFinish file asyncResult =+    propagateGError ({# call file_find_enclosing_mount_finish #} (toFile file) asyncResult) >>=+        takeGObject++-- | Gets the requested information about the files in a directory. The result is a 'GFileEnumerator'+-- object that will give out 'GFileInfo' objects for all the files in the directory.+-- +-- The attribute value is a string that specifies the file attributes that should be gathered. It is+-- not an error if it's not possible to read a particular requested attribute from a file - it just+-- won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The+-- wildcard \"*\" means all attributes, and a wildcard like \"standard::*\" means all attributes in the+-- standard namespace. An example attribute query be \"standard::*,'user'\". The standard attributes+-- are available as defines, like 'GFileAttributeStandardName'.+-- +-- If cancellable is not @Nothing@, then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error 'GIoErrorCancelled' will be+-- returned.+-- +-- If the file does not exist, the 'GIoErrorNotFound' error will be returned. If the file is not a+-- directory, the 'GFileErrorNotdir' error will be returned. Other errors are possible too.+fileEnumerateChildren :: FileClass file+                      => file+                      -> String+                      -> [FileQueryInfoFlags]+                      -> Maybe Cancellable+                      -> IO FileEnumerator+fileEnumerateChildren file attributes flags cancellable =+    withGObject (toFile file) $ \cFile ->+        withUTFString attributes $ \cAttributes ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_enumerate_children cFile cAttributes (cFromFlags flags) cCancellable) >>=+        takeGObject+    where _ = {# call file_enumerate_children #}++-- | Asynchronously gets the requested information about the files in a directory. The result is a+-- GFileEnumerator object that will give out GFileInfo objects for all the files in the directory.+-- +-- For more details, see 'fileEnumerateChildren' which is the synchronous version of this call.+-- +-- When the operation is finished, callback will be called. You can then call+-- 'fileEnumerateChildrenFinish' to get the result of the operation.+fileEnumerateChildrenAsync :: FileClass file+                           => file+                           -> String+                           -> [FileQueryInfoFlags]+                           -> Int+                           -> Maybe Cancellable+                           -> AsyncReadyCallback+                           -> IO ()+fileEnumerateChildrenAsync file attributes flags ioPriority cancellable callback =+    withGObject (toFile file) $ \cFile ->+        withUTFString attributes $ \cAttributes ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cCallback <- marshalAsyncReadyCallback callback+          g_file_enumerate_children_async cFile+                                          cAttributes+                                          (cFromFlags flags)+                                          (fromIntegral ioPriority)+                                          cCancellable+                                          cCallback+                                          (castFunPtrToPtr cCallback)+    where _ = {# call file_enumerate_children_async #}++-- | Finishes an async enumerate children operation. See 'fileEnumerateChildrenAsync'.+fileEnumerateChildrenFinish :: FileClass file+                             => file+                             -> AsyncResult+                             -> IO FileEnumerator+fileEnumerateChildrenFinish file asyncResult =+    propagateGError ({# call file_enumerate_children_finish #} (toFile file) asyncResult) >>=+        takeGObject++-- | Renames file to the specified display name.+-- +-- The display name is converted from UTF8 to the correct encoding for the target filesystem if+-- possible and the file is renamed to this.+-- +-- If you want to implement a rename operation in the user interface the edit name+-- (GFileAttributeStandardEditName) should be used as the initial value in the rename widget, and+-- then the result after editing should be passed to 'fileSetDisplayName'.+-- +-- On success the resulting converted filename is returned.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileSetDisplayName :: FileClass file+                   => file+                   -> String+                   -> Maybe Cancellable+                   -> IO File+fileSetDisplayName file displayName cancellable =+    withGObject (toFile file) $ \cFile ->+        withUTFString displayName $ \cDisplayName ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_set_display_name cFile cDisplayName cCancellable) >>=+        takeGObject+    where _ = {# call file_set_display_name #}++-- | Asynchronously sets the display name for a given GFile.+-- +-- For more details, see 'fileSetDisplayName' which is the synchronous version of this call.+-- +-- When the operation is finished, callback will be called. You can then call+-- 'fileSetDisplayNameFinish' to get the result of the operation.+fileSetDisplayNameAsync :: FileClass file+                        => file+                        -> String+                        -> Int+                        -> Maybe Cancellable+                        -> AsyncReadyCallback+                        -> IO ()+fileSetDisplayNameAsync file displayName ioPriority cancellable callback =+    withGObject (toFile file) $ \cFile ->+        withUTFString displayName $ \cDisplayName ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cCallback <- marshalAsyncReadyCallback callback+          g_file_set_display_name_async cFile+                                        cDisplayName+                                        (fromIntegral ioPriority)+                                        cCancellable+                                        cCallback+                                        (castFunPtrToPtr cCallback)+    where _ = {# call file_set_display_name_async #}++-- | Finishes setting a display name started with 'fileSetDisplayNameAsync'.+fileSetDisplayNameFinish :: FileClass file+                         => file+                         -> AsyncResult+                         -> IO File+fileSetDisplayNameFinish file asyncResult =+    propagateGError ({# call file_set_display_name_finish #} (toFile file) asyncResult) >>=+        takeGObject++-- | Deletes a file. If the file is a directory, it will only be deleted if it is empty.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileDelete :: FileClass file+           => file+           -> Maybe Cancellable+           -> IO ()+fileDelete file cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_delete cFile cCancellable) >> return ()+    where _ = {# call file_delete #}++-- | Sends file to the "Trashcan", if possible. This is similar to deleting it, but the user can recover+-- it before emptying the trashcan. Not all file systems support trashing, so this call can return the+-- GIoErrorNotSupported error.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileTrash :: FileClass file+           => file+           -> Maybe Cancellable+           -> IO ()+fileTrash file cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable ->+        propagateGError (g_file_trash cFile cCancellable) >> return ()+    where _ = {# call file_trash #}++-- | Copies the file source to the location specified by destination. Can not handle recursive copies of+-- directories.+-- +-- If the flag GFileCopyOverwrite is specified an already existing destination file is overwritten.+-- +-- If the flag GFileCopyNofollowSymlinks is specified then symlinks will be copied as symlinks,+-- otherwise the target of the source symlink will be copied.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+-- +-- If @progressCallback@ is not 'Nothing', then the operation can be monitored by setting this to a+-- GFileProgressCallback function.  @progressCallbackData@ will be passed to this function. It is+-- guaranteed that this callback will be called after all data has been transferred with the total+-- number of bytes copied during the operation.+-- +-- If the source file does not exist then the GIoErrorNotFound error is returned, independent on+-- the status of the destination.+-- +-- If GFileCopyOverwrite is not specified and the target exists, then the error GIoErrorExists is+-- returned.+-- +-- If trying to overwrite a file over a directory the GIoErrorIsDirectory error is returned. If+-- trying to overwrite a directory with a directory the GIoErrorWouldMerge error is returned.+-- +-- If the source is a directory and the target does not exist, or GFileCopyOverwrite is specified+-- and the target is a file, then the GIoErrorWouldRecurse error is returned.+-- +-- If you are interested in copying the GFile object itself (not the on-disk file), see 'fileDup'.+fileCopy :: (FileClass source, FileClass destination)+         => source+         -> destination+         -> [FileCopyFlags]+         -> Maybe Cancellable+         -> Maybe FileProgressCallback+         -> IO Bool+fileCopy source destination flags cancellable progressCallback =+    withGObject (toFile source) $ \cSource ->+        withGObject (toFile destination) $ \cDestination ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cProgressCallback <- maybe (return nullFunPtr) marshalFileProgressCallback progressCallback+          propagateGError $ \cError -> do+            ret <- g_file_copy cSource+                               cDestination+                               (cFromFlags flags)+                               cCancellable+                               cProgressCallback+                               nullPtr+                               cError+            when (cProgressCallback /= nullFunPtr) $+              freeHaskellFunPtr cProgressCallback+            return $ toBool ret+    where _ = {# call file_copy #}++-- | Copies the file source to the location specified by destination asynchronously. For details of the+-- behaviour, see 'fileCopy'.+-- +-- If @progressCallback@ is not 'Nothing', then that function that will be called just like in 'fileCopy',+-- however the callback will run in the main loop, not in the thread that is doing the I/O operation.+-- +-- When the operation is finished, callback will be called. You can then call 'fileCopyFinish' to+-- get the result of the operation.+fileCopyAsync :: (FileClass source, FileClass destination)+              => source+              -> destination+              -> [FileCopyFlags]+              -> Int+              -> Maybe Cancellable+              -> Maybe FileProgressCallback+              -> AsyncReadyCallback+              -> IO ()+fileCopyAsync source destination flags ioPriority cancellable progressCallback callback =+    withGObject (toFile source) $ \cSource ->+        withGObject (toFile destination) $ \cDestination ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cProgressCallback <- maybe (return nullFunPtr) marshalFileProgressCallback progressCallback+          cCallback <- marshalAsyncReadyCallback $ \sourceObject res -> do+                         when (cProgressCallback /= nullFunPtr) $+                           freeHaskellFunPtr cProgressCallback+                         callback sourceObject res+          g_file_copy_async cSource+                            cDestination+                            (cFromFlags flags)+                            (fromIntegral ioPriority)+                            cCancellable+                            cProgressCallback+                            nullPtr+                            cCallback+                            (castFunPtrToPtr cCallback)+    where _ = {# call file_copy_async #}++-- | Finishes copying the file started with 'fileCopyAsync'.+fileCopyFinish :: FileClass file+               => file+               -> AsyncResult+               -> IO Bool+fileCopyFinish file asyncResult =+    liftM toBool $ propagateGError ({# call file_copy_finish #} (toFile file) asyncResult)++-- | Tries to move the file or directory source to the location specified by destination. If native move+-- operations are supported then this is used, otherwise a copy + delete fallback is used. The native+-- implementation may support moving directories (for instance on moves inside the same filesystem),+-- but the fallback code does not.+-- +-- If the flag GFileCopyOverwrite is specified an already existing destination file is overwritten.+-- +-- If the flag GFileCopyNofollowSymlinks is specified then symlinks will be copied as symlinks,+-- otherwise the target of the source symlink will be copied.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+-- +-- If @progressCallback@ is not 'Nothing', then the operation can be monitored by setting this to a+-- GFileProgressCallback function.  @progressCallbackData@ will be passed to this function. It is+-- guaranteed that this callback will be called after all data has been transferred with the total+-- number of bytes copied during the operation.+-- +-- If the source file does not exist then the GIoErrorNotFound error is returned, independent on+-- the status of the destination.+-- +-- If GFileCopyOverwrite is not specified and the target exists, then the error GIoErrorExists is+-- returned.+-- +-- If trying to overwrite a file over a directory the GIoErrorIsDirectory error is returned. If+-- trying to overwrite a directory with a directory the GIoErrorWouldMerge error is returned.+-- +-- If the source is a directory and the target does not exist, or GFileCopyOverwrite is specified+-- and the target is a file, then the GIoErrorWouldRecurse error may be returned (if the native+-- move operation isn't available).+fileMove :: (FileClass source, FileClass destination)+         => source+         -> destination+         -> [FileCopyFlags]+         -> Maybe Cancellable+         -> Maybe FileProgressCallback+         -> IO Bool+fileMove source destination flags cancellable progressCallback =+    withGObject (toFile source) $ \cSource ->+        withGObject (toFile destination) $ \cDestination ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          cProgressCallback <- maybe (return nullFunPtr) marshalFileProgressCallback progressCallback+          propagateGError $ \cError -> do+            ret <- g_file_move cSource+                               cDestination+                               (cFromFlags flags)+                               cCancellable+                               cProgressCallback+                               nullPtr+                               cError+            when (cProgressCallback /= nullFunPtr) $+              freeHaskellFunPtr cProgressCallback+            return $ toBool ret+    where _ = {# call file_move #}++-- | Creates a directory. Note that this will only create a child directory of the immediate parent+-- directory of the path or URI given by the GFile. To recursively create directories, see+-- 'fileMakeDirectoryWithParents'. This function will fail if the parent directory does not+-- exist, setting error to GIoErrorNotFound. If the file system doesn't support creating+-- directories, this function will fail, setting error to GIoErrorNotSupported.+-- +-- For a local GFile the newly created directory will have the default (current) ownership and+-- permissions of the current process.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileMakeDirectory :: FileClass file+                  => file+                  -> Maybe Cancellable+                  -> IO ()+fileMakeDirectory file cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          propagateGError $ g_file_make_directory cFile cCancellable+          return ()+    where _ = {# call file_make_directory #}++#if GLIB_CHECK_VERSION(2,18,0)+-- | Creates a directory and any parent directories that may not exist similar to 'mkdir -p'. If the file+-- system does not support creating directories, this function will fail, setting error to+-- GIoErrorNotSupported.+-- +-- For a local GFile the newly created directories will have the default (current) ownership and+-- permissions of the current process.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileMakeDirectoryWithParents :: FileClass file+                             => file+                             -> Maybe Cancellable+                             -> IO ()+fileMakeDirectoryWithParents file cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          propagateGError $ g_file_make_directory_with_parents cFile cCancellable+          return ()+    where _ = {# call file_make_directory_with_parents #}+#endif++-- | Creates a symbolic link.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileMakeSymbolicLink :: FileClass file+                     => file+                     -> String+                     -> Maybe Cancellable+                     -> IO ()+fileMakeSymbolicLink file symlinkValue cancellable =+    withGObject (toFile file) $ \cFile ->+        withUTFString symlinkValue $ \cSymlinkValue ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          propagateGError $ g_file_make_symbolic_link cFile cSymlinkValue cCancellable+          return ()+    where _ = {# call file_make_symbolic_link #}++{# pointer *FileAttributeInfoList newtype #}+takeFileAttributeInfoList :: Ptr FileAttributeInfoList+                          -> IO [FileAttributeInfo]+takeFileAttributeInfoList ptr =+    do cInfos <- liftM castPtr $ {# get FileAttributeInfoList->infos #} ptr+       cNInfos <- {# get FileAttributeInfoList->n_infos #} ptr+       infos <- peekArray (fromIntegral cNInfos) cInfos+       g_file_attribute_info_list_unref ptr+       return infos+    where _ = {# call file_attribute_info_list_unref #}++-- | Obtain the list of settable attributes for the file.+-- +-- Returns the type and full attribute name of all the attributes that can be set on this file. This+-- doesn't mean setting it will always succeed though, you might get an access failure, or some+-- specific file may not support a specific attribute.+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileQuerySettableAttributes :: FileClass file+                            => file+                            -> Maybe Cancellable+                            -> IO [FileAttributeInfo]+fileQuerySettableAttributes file cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          ptr <- propagateGError $ g_file_query_settable_attributes cFile cCancellable+          infos <- takeFileAttributeInfoList ptr+          return infos+    where _ = {# call file_query_settable_attributes #}++-- | Obtain the list of attribute namespaces where new attributes can be created by a user. An example of+-- this is extended attributes (in the "xattr" namespace).+-- +-- If cancellable is not 'Nothing', then the operation can be cancelled by triggering the cancellable object+-- from another thread. If the operation was cancelled, the error GIoErrorCancelled will be+-- returned.+fileQueryWritableNamespaces :: FileClass file+                            => file+                            -> Maybe Cancellable+                            -> IO [FileAttributeInfo]+fileQueryWritableNamespaces file cancellable =+    withGObject (toFile file) $ \cFile ->+        maybeWith withGObject cancellable $ \cCancellable -> do+          ptr <- propagateGError $ g_file_query_writable_namespaces cFile cCancellable+          infos <- takeFileAttributeInfoList ptr+          return infos+    where _ = {# call file_query_writable_namespaces #}+
+ System/GIO/File/FileAttribute.hsc view
@@ -0,0 +1,285 @@+{-# LANGUAGE CPP #-}++#include <gio/gio.h>++--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Peter Gavin+--  Created: 13-Oct-2008+--+--  Copyright (c) 2008 Peter Gavin+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 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+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.File.FileAttribute (+    FileAttributeType (..),+    FileAttributeInfo (..),+    FileAttributeInfoFlags (..),+    fileAttributeStandardType,+    fileAttributeStandardIsHidden,+    fileAttributeStandardIsBackup,+    fileAttributeStandardIsSymlink,+    fileAttributeStandardIsVirtual,+    fileAttributeStandardName,+    fileAttributeStandardDisplayName,+    fileAttributeStandardEditName,+    fileAttributeStandardCopyName,+    fileAttributeStandardIcon,+    fileAttributeStandardContentType,+    fileAttributeStandardFastContentType,+    fileAttributeStandardSize,+    fileAttributeStandardSymlinkTarget,+    fileAttributeStandardTargetURI,+    fileAttributeStandardSortOrder,+    fileAttributeEtagValue,+    fileAttributeIDFile,+    fileAttributeIDFilesystem,+    fileAttributeAccessCanRead,+    fileAttributeAccessCanWrite,+    fileAttributeAccessCanExecute,+    fileAttributeAccessCanDelete,+    fileAttributeAccessCanTrash,+    fileAttributeAccessCanRename,+    fileAttributeMountableCanMount,+    fileAttributeMountableCanUnmount,+    fileAttributeMountableCanEject,+    fileAttributeMountableUnixDevice,+    fileAttributeMountableHalUDI,+    fileAttributeTimeModified,+    fileAttributeTimeModifiedUSec,+    fileAttributeTimeAccess,+    fileAttributeTimeAccessUSec,+    fileAttributeTimeChanged,+    fileAttributeTimeChangedUSec,+    fileAttributeTimeCreated,+    fileAttributeTimeCreatedUSec,+    fileAttributeUnixDevice,+    fileAttributeUnixInode,+    fileAttributeUnixMode,+    fileAttributeUnixNLink,+    fileAttributeUnixUID,+    fileAttributeUnixGID,+    fileAttributeUnixRDev,+    fileAttributeUnixBlockSize,+    fileAttributeUnixBlocks,+    fileAttributeDosIsArchive,+    fileAttributeDosIsSystem,+    fileAttributeOwnerUser,+    fileAttributeOwnerUserReal,+    fileAttributeOwnerGroup,+    fileAttributeThumbnailPath,+    fileAttributeThumbnailingFailed,+    fileAttributeFilesystemSize,+    fileAttributeFilesystemFree,+    fileAttributeFilesystemType,+    fileAttributeFilesystemReadonly,+    fileAttributeGVfsBackend,+    fileAttributeSELinuxContext,+    fileAttributeTrashItemCount,+    fileAttributeFilesystemUsePreview,+    fileAttributeStandardDescription,+    ) where++import System.Glib.FFI+import System.Glib.UTFString++import System.GIO.Base++data FileAttributeType = FileAttributeTypeInvalid+                       | FileAttributeTypeString+                       | FileAttributeTypeByteString+                       | FileAttributeTypeBool+                       | FileAttributeTypeWord32+                       | FileAttributeTypeInt32+                       | FileAttributeTypeWord64+                       | FileAttributeTypeInt64+                       | FileAttributeTypeObject+                         deriving (Eq, Ord, Bounded, Show, Read)+instance Enum FileAttributeType where+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_INVALID}     = FileAttributeTypeInvalid+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_STRING}      = FileAttributeTypeString+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_BYTE_STRING} = FileAttributeTypeByteString+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_BOOLEAN}     = FileAttributeTypeBool+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_UINT32}      = FileAttributeTypeWord32+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_INT32}       = FileAttributeTypeInt32+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_UINT64}      = FileAttributeTypeWord64+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_INT64}       = FileAttributeTypeInt64+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_OBJECT}      = FileAttributeTypeObject+    +    fromEnum FileAttributeTypeInvalid    = #{const G_FILE_ATTRIBUTE_TYPE_INVALID}+    fromEnum FileAttributeTypeString     = #{const G_FILE_ATTRIBUTE_TYPE_STRING}+    fromEnum FileAttributeTypeByteString = #{const G_FILE_ATTRIBUTE_TYPE_BYTE_STRING}+    fromEnum FileAttributeTypeBool       = #{const G_FILE_ATTRIBUTE_TYPE_BOOLEAN}+    fromEnum FileAttributeTypeWord32     = #{const G_FILE_ATTRIBUTE_TYPE_UINT32}+    fromEnum FileAttributeTypeInt32      = #{const G_FILE_ATTRIBUTE_TYPE_INT32}+    fromEnum FileAttributeTypeWord64     = #{const G_FILE_ATTRIBUTE_TYPE_UINT64}+    fromEnum FileAttributeTypeInt64      = #{const G_FILE_ATTRIBUTE_TYPE_INT64}+    fromEnum FileAttributeTypeObject     = #{const G_FILE_ATTRIBUTE_TYPE_OBJECT}++data FileAttributeInfo =+    FileAttributeInfo+    { fileAttributeInfoName :: String+    , fileAttributeInfoType :: FileAttributeType+    , fileAttributeInfoFlags :: [FileAttributeInfoFlags]+    } deriving (Eq, Read, Show)++instance Storable FileAttributeInfo where+    sizeOf _ = #{size GFileAttributeInfo}+    alignment _ = alignment (undefined :: Ptr ())+    peek ptr = do+      retName <- #{peek GFileAttributeInfo, name} ptr >>= peekUTFString+      retType <- (#{peek GFileAttributeInfo, type} ptr :: IO CInt) >>= return . cToEnum+      retFlags <- (#{peek GFileAttributeInfo, flags} ptr :: IO CInt) >>= return . cToFlags+      return $ FileAttributeInfo+               { fileAttributeInfoName = retName+               , fileAttributeInfoType = retType+               , fileAttributeInfoFlags = retFlags }++    poke _ = error "not implemented"++fileAttributeStandardType,+    fileAttributeStandardIsHidden,+    fileAttributeStandardIsBackup,+    fileAttributeStandardIsSymlink,+    fileAttributeStandardIsVirtual,+    fileAttributeStandardName,+    fileAttributeStandardDisplayName,+    fileAttributeStandardEditName,+    fileAttributeStandardCopyName,+    fileAttributeStandardIcon,+    fileAttributeStandardContentType,+    fileAttributeStandardFastContentType,+    fileAttributeStandardSize,+    fileAttributeStandardSymlinkTarget,+    fileAttributeStandardTargetURI,+    fileAttributeStandardSortOrder,+    fileAttributeEtagValue,+    fileAttributeIDFile,+    fileAttributeIDFilesystem,+    fileAttributeAccessCanRead,+    fileAttributeAccessCanWrite,+    fileAttributeAccessCanExecute,+    fileAttributeAccessCanDelete,+    fileAttributeAccessCanTrash,+    fileAttributeAccessCanRename,+    fileAttributeMountableCanMount,+    fileAttributeMountableCanUnmount,+    fileAttributeMountableCanEject,+    fileAttributeMountableUnixDevice,+    fileAttributeMountableHalUDI,+    fileAttributeTimeModified,+    fileAttributeTimeModifiedUSec,+    fileAttributeTimeAccess,+    fileAttributeTimeAccessUSec,+    fileAttributeTimeChanged,+    fileAttributeTimeChangedUSec,+    fileAttributeTimeCreated,+    fileAttributeTimeCreatedUSec,+    fileAttributeUnixDevice,+    fileAttributeUnixInode,+    fileAttributeUnixMode,+    fileAttributeUnixNLink,+    fileAttributeUnixUID,+    fileAttributeUnixGID,+    fileAttributeUnixRDev,+    fileAttributeUnixBlockSize,+    fileAttributeUnixBlocks,+    fileAttributeDosIsArchive,+    fileAttributeDosIsSystem,+    fileAttributeOwnerUser,+    fileAttributeOwnerUserReal,+    fileAttributeOwnerGroup,+    fileAttributeThumbnailPath,+    fileAttributeThumbnailingFailed,+    fileAttributeFilesystemSize,+    fileAttributeFilesystemFree,+    fileAttributeFilesystemType,+    fileAttributeFilesystemReadonly,+    fileAttributeGVfsBackend,+    fileAttributeSELinuxContext,+    fileAttributeTrashItemCount,+    fileAttributeFilesystemUsePreview,+    fileAttributeStandardDescription+    :: String+fileAttributeStandardType            = #{const_str G_FILE_ATTRIBUTE_STANDARD_TYPE}+fileAttributeStandardIsHidden        = #{const_str G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN}+fileAttributeStandardIsBackup        = #{const_str G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP}+fileAttributeStandardIsSymlink       = #{const_str G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK}+fileAttributeStandardIsVirtual       = #{const_str G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL}+fileAttributeStandardName            = #{const_str G_FILE_ATTRIBUTE_STANDARD_NAME}+fileAttributeStandardDisplayName     = #{const_str G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME}+fileAttributeStandardEditName        = #{const_str G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME}+fileAttributeStandardCopyName        = #{const_str G_FILE_ATTRIBUTE_STANDARD_COPY_NAME}+fileAttributeStandardIcon            = #{const_str G_FILE_ATTRIBUTE_STANDARD_ICON}+fileAttributeStandardContentType     = #{const_str G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE}+fileAttributeStandardFastContentType = #{const_str G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE}+fileAttributeStandardSize            = #{const_str G_FILE_ATTRIBUTE_STANDARD_SIZE}+fileAttributeStandardSymlinkTarget   = #{const_str G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET}+fileAttributeStandardTargetURI       = #{const_str G_FILE_ATTRIBUTE_STANDARD_TARGET_URI}+fileAttributeStandardSortOrder       = #{const_str G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER}+fileAttributeEtagValue               = #{const_str G_FILE_ATTRIBUTE_ETAG_VALUE}+fileAttributeIDFile                  = #{const_str G_FILE_ATTRIBUTE_ID_FILE}+fileAttributeIDFilesystem            = #{const_str G_FILE_ATTRIBUTE_ID_FILESYSTEM}+fileAttributeAccessCanRead           = #{const_str G_FILE_ATTRIBUTE_ACCESS_CAN_READ}+fileAttributeAccessCanWrite          = #{const_str G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE}+fileAttributeAccessCanExecute        = #{const_str G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE}+fileAttributeAccessCanDelete         = #{const_str G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE}+fileAttributeAccessCanTrash          = #{const_str G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH}+fileAttributeAccessCanRename         = #{const_str G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME}+fileAttributeMountableCanMount       = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT}+fileAttributeMountableCanUnmount     = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT}+fileAttributeMountableCanEject       = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT}+fileAttributeMountableUnixDevice     = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE}+fileAttributeMountableHalUDI         = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI}+fileAttributeTimeModified            = #{const_str G_FILE_ATTRIBUTE_TIME_MODIFIED}+fileAttributeTimeModifiedUSec        = #{const_str G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC}+fileAttributeTimeAccess              = #{const_str G_FILE_ATTRIBUTE_TIME_ACCESS}+fileAttributeTimeAccessUSec          = #{const_str G_FILE_ATTRIBUTE_TIME_ACCESS_USEC}+fileAttributeTimeChanged             = #{const_str G_FILE_ATTRIBUTE_TIME_CHANGED}+fileAttributeTimeChangedUSec         = #{const_str G_FILE_ATTRIBUTE_TIME_CHANGED_USEC}+fileAttributeTimeCreated             = #{const_str G_FILE_ATTRIBUTE_TIME_CREATED}+fileAttributeTimeCreatedUSec         = #{const_str G_FILE_ATTRIBUTE_TIME_CREATED_USEC}+fileAttributeUnixDevice              = #{const_str G_FILE_ATTRIBUTE_UNIX_DEVICE}+fileAttributeUnixInode               = #{const_str G_FILE_ATTRIBUTE_UNIX_INODE}+fileAttributeUnixMode                = #{const_str G_FILE_ATTRIBUTE_UNIX_MODE}+fileAttributeUnixNLink               = #{const_str G_FILE_ATTRIBUTE_UNIX_NLINK}+fileAttributeUnixUID                 = #{const_str G_FILE_ATTRIBUTE_UNIX_UID}+fileAttributeUnixGID                 = #{const_str G_FILE_ATTRIBUTE_UNIX_GID}+fileAttributeUnixRDev                = #{const_str G_FILE_ATTRIBUTE_UNIX_RDEV}+fileAttributeUnixBlockSize           = #{const_str G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE}+fileAttributeUnixBlocks              = #{const_str G_FILE_ATTRIBUTE_UNIX_BLOCKS}+fileAttributeDosIsArchive            = #{const_str G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE}+fileAttributeDosIsSystem             = #{const_str G_FILE_ATTRIBUTE_DOS_IS_SYSTEM}+fileAttributeOwnerUser               = #{const_str G_FILE_ATTRIBUTE_OWNER_USER}+fileAttributeOwnerUserReal           = #{const_str G_FILE_ATTRIBUTE_OWNER_USER_REAL}+fileAttributeOwnerGroup              = #{const_str G_FILE_ATTRIBUTE_OWNER_GROUP}+fileAttributeThumbnailPath           = #{const_str G_FILE_ATTRIBUTE_THUMBNAIL_PATH}+fileAttributeThumbnailingFailed      = #{const_str G_FILE_ATTRIBUTE_THUMBNAILING_FAILED}+fileAttributeFilesystemSize          = #{const_str G_FILE_ATTRIBUTE_FILESYSTEM_SIZE}+fileAttributeFilesystemFree          = #{const_str G_FILE_ATTRIBUTE_FILESYSTEM_FREE}+fileAttributeFilesystemType          = #{const_str G_FILE_ATTRIBUTE_FILESYSTEM_TYPE}+fileAttributeFilesystemReadonly      = #{const_str G_FILE_ATTRIBUTE_FILESYSTEM_READONLY}+fileAttributeGVfsBackend             = #{const_str G_FILE_ATTRIBUTE_GVFS_BACKEND}+fileAttributeSELinuxContext          = #{const_str G_FILE_ATTRIBUTE_SELINUX_CONTEXT}+fileAttributeTrashItemCount          = #{const_str G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT}+fileAttributeFilesystemUsePreview    = #{const_str G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW}+fileAttributeStandardDescription     = #{const_str G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION}
+ System/GIO/Signals.chs view
@@ -0,0 +1,75 @@+{-# OPTIONS_HADDOCK hide #-}+-- -*-haskell-*-+-- -------------------- automatically generated file - do not edit ------------+--  Callback installers for the GIMP Toolkit (GTK) Binding for Haskell+--+--  Author : Axel Simon+--+--  Created: 1 July 2000+--+--  Copyright (C) 2000-2005 Axel Simon+--+--  This library is free software; you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public+--  License as published by the Free Software Foundation; either+--  version 2.1 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+--  Lesser General Public License for more details.+--+-- #hide++-- These functions are used to connect signals to widgets. They are auto-+-- matically created through HookGenerator.hs which takes a list of possible+-- function signatures that are included in the GTK sources (gtkmarshal.list).+--+-- The object system in the second version of GTK is based on GObject from+-- GLIB. This base class is rather primitive in that it only implements+-- ref and unref methods (and others that are not interesting to us). If+-- the marshall list mentions OBJECT it refers to an instance of this +-- GObject which is automatically wrapped with a ref and unref call.+-- Structures which are not derived from GObject have to be passed as+-- BOXED which gives the signal connect function a possibility to do the+-- conversion into a proper ForeignPtr type. In special cases the signal+-- connect function use a PTR type which will then be mangled in the+-- user function directly. The latter is needed if a signal delivers a+-- pointer to a string and its length in a separate integer.+--+module System.GIO.Signals (+  module System.Glib.Signals,++  connect_NONE__NONE,+  +  ) where++import Control.Monad	(liftM)++import System.Glib.FFI+import System.Glib.UTFString   (peekUTFString)+import System.Glib.GError      (failOnGError)+{#import System.Glib.Signals#}+{#import System.Glib.GObject#} +++{#context lib="gtk" prefix="gtk" #}+++-- Here are the generators that turn a Haskell function into+-- a C function pointer. The fist Argument is always the widget,+-- the last one is the user g_pointer. Both are ignored.+++connect_NONE__NONE :: +  GObjectClass obj => SignalName ->+  ConnectAfter -> obj ->+  (IO ()) ->+  IO (ConnectId obj)+connect_NONE__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> IO ()+        action _ =+          failOnGError $+          user+
+ System/GIO/Types.chs view
@@ -0,0 +1,1019 @@+{-# OPTIONS_HADDOCK hide #-}+-- -*-haskell-*-+-- -------------------- automatically generated file - do not edit ----------+--  Object hierarchy for the GIMP Toolkit (GTK) Binding for Haskell+--+--  Author : Axel Simon+--+--  Copyright (C) 2001-2005 Axel Simon+--+--  This library is free software; you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public+--  License as published by the Free Software Foundation; either+--  version 2.1 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+--  Lesser General Public License for more details.+--+-- #hide++-- |+-- Maintainer  : gtk2hs-users@lists.sourceforge.net+-- Stability   : provisional+-- Portability : portable (depends on GHC)+--+-- This file reflects the Gtk+ object hierarchy in terms of Haskell classes.+--+-- Note: the mk... functions were originally meant to simply be an alias+-- for the constructor. However, in order to communicate the destructor+-- of an object to objectNew, the mk... functions are now a tuple containing+-- Haskell constructor and the destructor function pointer. This hack avoids+-- changing all modules that simply pass mk... to objectNew.+--+module System.GIO.Types (++  OutputStream(OutputStream), OutputStreamClass,+  toOutputStream, +  mkOutputStream, unOutputStream,+  castToOutputStream, gTypeOutputStream,+  FilterOutputStream(FilterOutputStream), FilterOutputStreamClass,+  toFilterOutputStream, +  mkFilterOutputStream, unFilterOutputStream,+  castToFilterOutputStream, gTypeFilterOutputStream,+  DataOutputStream(DataOutputStream), DataOutputStreamClass,+  toDataOutputStream, +  mkDataOutputStream, unDataOutputStream,+  castToDataOutputStream, gTypeDataOutputStream,+  BufferedOutputStream(BufferedOutputStream), BufferedOutputStreamClass,+  toBufferedOutputStream, +  mkBufferedOutputStream, unBufferedOutputStream,+  castToBufferedOutputStream, gTypeBufferedOutputStream,+  FileOutputStream(FileOutputStream), FileOutputStreamClass,+  toFileOutputStream, +  mkFileOutputStream, unFileOutputStream,+  castToFileOutputStream, gTypeFileOutputStream,+  MemoryOutputStream(MemoryOutputStream), MemoryOutputStreamClass,+  toMemoryOutputStream, +  mkMemoryOutputStream, unMemoryOutputStream,+  castToMemoryOutputStream, gTypeMemoryOutputStream,+  InputStream(InputStream), InputStreamClass,+  toInputStream, +  mkInputStream, unInputStream,+  castToInputStream, gTypeInputStream,+  MemoryInputStream(MemoryInputStream), MemoryInputStreamClass,+  toMemoryInputStream, +  mkMemoryInputStream, unMemoryInputStream,+  castToMemoryInputStream, gTypeMemoryInputStream,+  FilterInputStream(FilterInputStream), FilterInputStreamClass,+  toFilterInputStream, +  mkFilterInputStream, unFilterInputStream,+  castToFilterInputStream, gTypeFilterInputStream,+  BufferedInputStream(BufferedInputStream), BufferedInputStreamClass,+  toBufferedInputStream, +  mkBufferedInputStream, unBufferedInputStream,+  castToBufferedInputStream, gTypeBufferedInputStream,+  DataInputStream(DataInputStream), DataInputStreamClass,+  toDataInputStream, +  mkDataInputStream, unDataInputStream,+  castToDataInputStream, gTypeDataInputStream,+  FileInputStream(FileInputStream), FileInputStreamClass,+  toFileInputStream, +  mkFileInputStream, unFileInputStream,+  castToFileInputStream, gTypeFileInputStream,+  FileMonitor(FileMonitor), FileMonitorClass,+  toFileMonitor, +  mkFileMonitor, unFileMonitor,+  castToFileMonitor, gTypeFileMonitor,+  Vfs(Vfs), VfsClass,+  toVfs, +  mkVfs, unVfs,+  castToVfs, gTypeVfs,+  MountOperation(MountOperation), MountOperationClass,+  toMountOperation, +  mkMountOperation, unMountOperation,+  castToMountOperation, gTypeMountOperation,+  ThemedIcon(ThemedIcon), ThemedIconClass,+  toThemedIcon, +  mkThemedIcon, unThemedIcon,+  castToThemedIcon, gTypeThemedIcon,+  Emblem(Emblem), EmblemClass,+  toEmblem, +  mkEmblem, unEmblem,+  castToEmblem, gTypeEmblem,+  EmblemedIcon(EmblemedIcon), EmblemedIconClass,+  toEmblemedIcon, +  mkEmblemedIcon, unEmblemedIcon,+  castToEmblemedIcon, gTypeEmblemedIcon,+  FileEnumerator(FileEnumerator), FileEnumeratorClass,+  toFileEnumerator, +  mkFileEnumerator, unFileEnumerator,+  castToFileEnumerator, gTypeFileEnumerator,+  FilenameCompleter(FilenameCompleter), FilenameCompleterClass,+  toFilenameCompleter, +  mkFilenameCompleter, unFilenameCompleter,+  castToFilenameCompleter, gTypeFilenameCompleter,+  FileIcon(FileIcon), FileIconClass,+  toFileIcon, +  mkFileIcon, unFileIcon,+  castToFileIcon, gTypeFileIcon,+  VolumeMonitor(VolumeMonitor), VolumeMonitorClass,+  toVolumeMonitor, +  mkVolumeMonitor, unVolumeMonitor,+  castToVolumeMonitor, gTypeVolumeMonitor,+  Cancellable(Cancellable), CancellableClass,+  toCancellable, +  mkCancellable, unCancellable,+  castToCancellable, gTypeCancellable,+  SimpleAsyncResult(SimpleAsyncResult), SimpleAsyncResultClass,+  toSimpleAsyncResult, +  mkSimpleAsyncResult, unSimpleAsyncResult,+  castToSimpleAsyncResult, gTypeSimpleAsyncResult,+  FileInfo(FileInfo), FileInfoClass,+  toFileInfo, +  mkFileInfo, unFileInfo,+  castToFileInfo, gTypeFileInfo,+  AppLaunchContext(AppLaunchContext), AppLaunchContextClass,+  toAppLaunchContext, +  mkAppLaunchContext, unAppLaunchContext,+  castToAppLaunchContext, gTypeAppLaunchContext,+  Icon(Icon), IconClass,+  toIcon, +  mkIcon, unIcon,+  castToIcon, gTypeIcon,+  Seekable(Seekable), SeekableClass,+  toSeekable, +  mkSeekable, unSeekable,+  castToSeekable, gTypeSeekable,+  AppInfo(AppInfo), AppInfoClass,+  toAppInfo, +  mkAppInfo, unAppInfo,+  castToAppInfo, gTypeAppInfo,+  Volume(Volume), VolumeClass,+  toVolume, +  mkVolume, unVolume,+  castToVolume, gTypeVolume,+  AsyncResult(AsyncResult), AsyncResultClass,+  toAsyncResult, +  mkAsyncResult, unAsyncResult,+  castToAsyncResult, gTypeAsyncResult,+  LoadableIcon(LoadableIcon), LoadableIconClass,+  toLoadableIcon, +  mkLoadableIcon, unLoadableIcon,+  castToLoadableIcon, gTypeLoadableIcon,+  Drive(Drive), DriveClass,+  toDrive, +  mkDrive, unDrive,+  castToDrive, gTypeDrive,+  File(File), FileClass,+  toFile, +  mkFile, unFile,+  castToFile, gTypeFile,+  Mount(Mount), MountClass,+  toMount, +  mkMount, unMount,+  castToMount, gTypeMount+  ) where++import Foreign.ForeignPtr (ForeignPtr, castForeignPtr, unsafeForeignPtrToPtr)+import Foreign.C.Types    (CULong, CUInt)+import System.Glib.GType	(GType, typeInstanceIsA)+import System.Glib.GObject++{# context lib="gio" prefix="g" #}++-- The usage of foreignPtrToPtr should be safe as the evaluation will only be+-- forced if the object is used afterwards+--+castTo :: (GObjectClass obj, GObjectClass obj') => GType -> String+                                                -> (obj -> obj')+castTo gtype objTypeName obj =+  case toGObject obj of+    gobj@(GObject objFPtr)+      | typeInstanceIsA ((unsafeForeignPtrToPtr.castForeignPtr) objFPtr) gtype+                  -> unsafeCastGObject gobj+      | otherwise -> error $ "Cannot cast object to " ++ objTypeName+++-- *************************************************************** OutputStream++{#pointer *OutputStream foreign newtype #} deriving (Eq,Ord)++mkOutputStream = (OutputStream, objectUnref)+unOutputStream (OutputStream o) = o++class GObjectClass o => OutputStreamClass o+toOutputStream :: OutputStreamClass o => o -> OutputStream+toOutputStream = unsafeCastGObject . toGObject++instance OutputStreamClass OutputStream+instance GObjectClass OutputStream where+  toGObject = GObject . castForeignPtr . unOutputStream+  unsafeCastGObject = OutputStream . castForeignPtr . unGObject++castToOutputStream :: GObjectClass obj => obj -> OutputStream+castToOutputStream = castTo gTypeOutputStream "OutputStream"++gTypeOutputStream :: GType+gTypeOutputStream =+  {# call fun unsafe g_output_stream_get_type #}++-- ********************************************************* FilterOutputStream++{#pointer *FilterOutputStream foreign newtype #} deriving (Eq,Ord)++mkFilterOutputStream = (FilterOutputStream, objectUnref)+unFilterOutputStream (FilterOutputStream o) = o++class OutputStreamClass o => FilterOutputStreamClass o+toFilterOutputStream :: FilterOutputStreamClass o => o -> FilterOutputStream+toFilterOutputStream = unsafeCastGObject . toGObject++instance FilterOutputStreamClass FilterOutputStream+instance OutputStreamClass FilterOutputStream+instance GObjectClass FilterOutputStream where+  toGObject = GObject . castForeignPtr . unFilterOutputStream+  unsafeCastGObject = FilterOutputStream . castForeignPtr . unGObject++castToFilterOutputStream :: GObjectClass obj => obj -> FilterOutputStream+castToFilterOutputStream = castTo gTypeFilterOutputStream "FilterOutputStream"++gTypeFilterOutputStream :: GType+gTypeFilterOutputStream =+  {# call fun unsafe g_filter_output_stream_get_type #}++-- *********************************************************** DataOutputStream++{#pointer *DataOutputStream foreign newtype #} deriving (Eq,Ord)++mkDataOutputStream = (DataOutputStream, objectUnref)+unDataOutputStream (DataOutputStream o) = o++class FilterOutputStreamClass o => DataOutputStreamClass o+toDataOutputStream :: DataOutputStreamClass o => o -> DataOutputStream+toDataOutputStream = unsafeCastGObject . toGObject++instance DataOutputStreamClass DataOutputStream+instance FilterOutputStreamClass DataOutputStream+instance OutputStreamClass DataOutputStream+instance GObjectClass DataOutputStream where+  toGObject = GObject . castForeignPtr . unDataOutputStream+  unsafeCastGObject = DataOutputStream . castForeignPtr . unGObject++castToDataOutputStream :: GObjectClass obj => obj -> DataOutputStream+castToDataOutputStream = castTo gTypeDataOutputStream "DataOutputStream"++gTypeDataOutputStream :: GType+gTypeDataOutputStream =+  {# call fun unsafe g_data_output_stream_get_type #}++-- ******************************************************* BufferedOutputStream++{#pointer *BufferedOutputStream foreign newtype #} deriving (Eq,Ord)++mkBufferedOutputStream = (BufferedOutputStream, objectUnref)+unBufferedOutputStream (BufferedOutputStream o) = o++class FilterOutputStreamClass o => BufferedOutputStreamClass o+toBufferedOutputStream :: BufferedOutputStreamClass o => o -> BufferedOutputStream+toBufferedOutputStream = unsafeCastGObject . toGObject++instance BufferedOutputStreamClass BufferedOutputStream+instance FilterOutputStreamClass BufferedOutputStream+instance OutputStreamClass BufferedOutputStream+instance GObjectClass BufferedOutputStream where+  toGObject = GObject . castForeignPtr . unBufferedOutputStream+  unsafeCastGObject = BufferedOutputStream . castForeignPtr . unGObject++castToBufferedOutputStream :: GObjectClass obj => obj -> BufferedOutputStream+castToBufferedOutputStream = castTo gTypeBufferedOutputStream "BufferedOutputStream"++gTypeBufferedOutputStream :: GType+gTypeBufferedOutputStream =+  {# call fun unsafe g_buffered_output_stream_get_type #}++-- *********************************************************** FileOutputStream++{#pointer *FileOutputStream foreign newtype #} deriving (Eq,Ord)++mkFileOutputStream = (FileOutputStream, objectUnref)+unFileOutputStream (FileOutputStream o) = o++class OutputStreamClass o => FileOutputStreamClass o+toFileOutputStream :: FileOutputStreamClass o => o -> FileOutputStream+toFileOutputStream = unsafeCastGObject . toGObject++instance FileOutputStreamClass FileOutputStream+instance OutputStreamClass FileOutputStream+instance GObjectClass FileOutputStream where+  toGObject = GObject . castForeignPtr . unFileOutputStream+  unsafeCastGObject = FileOutputStream . castForeignPtr . unGObject++castToFileOutputStream :: GObjectClass obj => obj -> FileOutputStream+castToFileOutputStream = castTo gTypeFileOutputStream "FileOutputStream"++gTypeFileOutputStream :: GType+gTypeFileOutputStream =+  {# call fun unsafe g_file_output_stream_get_type #}++-- ********************************************************* MemoryOutputStream++{#pointer *MemoryOutputStream foreign newtype #} deriving (Eq,Ord)++mkMemoryOutputStream = (MemoryOutputStream, objectUnref)+unMemoryOutputStream (MemoryOutputStream o) = o++class OutputStreamClass o => MemoryOutputStreamClass o+toMemoryOutputStream :: MemoryOutputStreamClass o => o -> MemoryOutputStream+toMemoryOutputStream = unsafeCastGObject . toGObject++instance MemoryOutputStreamClass MemoryOutputStream+instance OutputStreamClass MemoryOutputStream+instance GObjectClass MemoryOutputStream where+  toGObject = GObject . castForeignPtr . unMemoryOutputStream+  unsafeCastGObject = MemoryOutputStream . castForeignPtr . unGObject++castToMemoryOutputStream :: GObjectClass obj => obj -> MemoryOutputStream+castToMemoryOutputStream = castTo gTypeMemoryOutputStream "MemoryOutputStream"++gTypeMemoryOutputStream :: GType+gTypeMemoryOutputStream =+  {# call fun unsafe g_memory_output_stream_get_type #}++-- **************************************************************** InputStream++{#pointer *InputStream foreign newtype #} deriving (Eq,Ord)++mkInputStream = (InputStream, objectUnref)+unInputStream (InputStream o) = o++class GObjectClass o => InputStreamClass o+toInputStream :: InputStreamClass o => o -> InputStream+toInputStream = unsafeCastGObject . toGObject++instance InputStreamClass InputStream+instance GObjectClass InputStream where+  toGObject = GObject . castForeignPtr . unInputStream+  unsafeCastGObject = InputStream . castForeignPtr . unGObject++castToInputStream :: GObjectClass obj => obj -> InputStream+castToInputStream = castTo gTypeInputStream "InputStream"++gTypeInputStream :: GType+gTypeInputStream =+  {# call fun unsafe g_input_stream_get_type #}++-- ********************************************************** MemoryInputStream++{#pointer *MemoryInputStream foreign newtype #} deriving (Eq,Ord)++mkMemoryInputStream = (MemoryInputStream, objectUnref)+unMemoryInputStream (MemoryInputStream o) = o++class InputStreamClass o => MemoryInputStreamClass o+toMemoryInputStream :: MemoryInputStreamClass o => o -> MemoryInputStream+toMemoryInputStream = unsafeCastGObject . toGObject++instance MemoryInputStreamClass MemoryInputStream+instance InputStreamClass MemoryInputStream+instance GObjectClass MemoryInputStream where+  toGObject = GObject . castForeignPtr . unMemoryInputStream+  unsafeCastGObject = MemoryInputStream . castForeignPtr . unGObject++castToMemoryInputStream :: GObjectClass obj => obj -> MemoryInputStream+castToMemoryInputStream = castTo gTypeMemoryInputStream "MemoryInputStream"++gTypeMemoryInputStream :: GType+gTypeMemoryInputStream =+  {# call fun unsafe g_memory_input_stream_get_type #}++-- ********************************************************** FilterInputStream++{#pointer *FilterInputStream foreign newtype #} deriving (Eq,Ord)++mkFilterInputStream = (FilterInputStream, objectUnref)+unFilterInputStream (FilterInputStream o) = o++class InputStreamClass o => FilterInputStreamClass o+toFilterInputStream :: FilterInputStreamClass o => o -> FilterInputStream+toFilterInputStream = unsafeCastGObject . toGObject++instance FilterInputStreamClass FilterInputStream+instance InputStreamClass FilterInputStream+instance GObjectClass FilterInputStream where+  toGObject = GObject . castForeignPtr . unFilterInputStream+  unsafeCastGObject = FilterInputStream . castForeignPtr . unGObject++castToFilterInputStream :: GObjectClass obj => obj -> FilterInputStream+castToFilterInputStream = castTo gTypeFilterInputStream "FilterInputStream"++gTypeFilterInputStream :: GType+gTypeFilterInputStream =+  {# call fun unsafe g_filter_input_stream_get_type #}++-- ******************************************************** BufferedInputStream++{#pointer *BufferedInputStream foreign newtype #} deriving (Eq,Ord)++mkBufferedInputStream = (BufferedInputStream, objectUnref)+unBufferedInputStream (BufferedInputStream o) = o++class FilterInputStreamClass o => BufferedInputStreamClass o+toBufferedInputStream :: BufferedInputStreamClass o => o -> BufferedInputStream+toBufferedInputStream = unsafeCastGObject . toGObject++instance BufferedInputStreamClass BufferedInputStream+instance FilterInputStreamClass BufferedInputStream+instance InputStreamClass BufferedInputStream+instance GObjectClass BufferedInputStream where+  toGObject = GObject . castForeignPtr . unBufferedInputStream+  unsafeCastGObject = BufferedInputStream . castForeignPtr . unGObject++castToBufferedInputStream :: GObjectClass obj => obj -> BufferedInputStream+castToBufferedInputStream = castTo gTypeBufferedInputStream "BufferedInputStream"++gTypeBufferedInputStream :: GType+gTypeBufferedInputStream =+  {# call fun unsafe g_buffered_input_stream_get_type #}++-- ************************************************************ DataInputStream++{#pointer *DataInputStream foreign newtype #} deriving (Eq,Ord)++mkDataInputStream = (DataInputStream, objectUnref)+unDataInputStream (DataInputStream o) = o++class BufferedInputStreamClass o => DataInputStreamClass o+toDataInputStream :: DataInputStreamClass o => o -> DataInputStream+toDataInputStream = unsafeCastGObject . toGObject++instance DataInputStreamClass DataInputStream+instance BufferedInputStreamClass DataInputStream+instance FilterInputStreamClass DataInputStream+instance InputStreamClass DataInputStream+instance GObjectClass DataInputStream where+  toGObject = GObject . castForeignPtr . unDataInputStream+  unsafeCastGObject = DataInputStream . castForeignPtr . unGObject++castToDataInputStream :: GObjectClass obj => obj -> DataInputStream+castToDataInputStream = castTo gTypeDataInputStream "DataInputStream"++gTypeDataInputStream :: GType+gTypeDataInputStream =+  {# call fun unsafe g_data_input_stream_get_type #}++-- ************************************************************ FileInputStream++{#pointer *FileInputStream foreign newtype #} deriving (Eq,Ord)++mkFileInputStream = (FileInputStream, objectUnref)+unFileInputStream (FileInputStream o) = o++class InputStreamClass o => FileInputStreamClass o+toFileInputStream :: FileInputStreamClass o => o -> FileInputStream+toFileInputStream = unsafeCastGObject . toGObject++instance FileInputStreamClass FileInputStream+instance InputStreamClass FileInputStream+instance GObjectClass FileInputStream where+  toGObject = GObject . castForeignPtr . unFileInputStream+  unsafeCastGObject = FileInputStream . castForeignPtr . unGObject++castToFileInputStream :: GObjectClass obj => obj -> FileInputStream+castToFileInputStream = castTo gTypeFileInputStream "FileInputStream"++gTypeFileInputStream :: GType+gTypeFileInputStream =+  {# call fun unsafe g_file_input_stream_get_type #}++-- **************************************************************** FileMonitor++{#pointer *FileMonitor foreign newtype #} deriving (Eq,Ord)++mkFileMonitor = (FileMonitor, objectUnref)+unFileMonitor (FileMonitor o) = o++class GObjectClass o => FileMonitorClass o+toFileMonitor :: FileMonitorClass o => o -> FileMonitor+toFileMonitor = unsafeCastGObject . toGObject++instance FileMonitorClass FileMonitor+instance GObjectClass FileMonitor where+  toGObject = GObject . castForeignPtr . unFileMonitor+  unsafeCastGObject = FileMonitor . castForeignPtr . unGObject++castToFileMonitor :: GObjectClass obj => obj -> FileMonitor+castToFileMonitor = castTo gTypeFileMonitor "FileMonitor"++gTypeFileMonitor :: GType+gTypeFileMonitor =+  {# call fun unsafe g_file_monitor_get_type #}++-- ************************************************************************ Vfs++{#pointer *Vfs foreign newtype #} deriving (Eq,Ord)++mkVfs = (Vfs, objectUnref)+unVfs (Vfs o) = o++class GObjectClass o => VfsClass o+toVfs :: VfsClass o => o -> Vfs+toVfs = unsafeCastGObject . toGObject++instance VfsClass Vfs+instance GObjectClass Vfs where+  toGObject = GObject . castForeignPtr . unVfs+  unsafeCastGObject = Vfs . castForeignPtr . unGObject++castToVfs :: GObjectClass obj => obj -> Vfs+castToVfs = castTo gTypeVfs "Vfs"++gTypeVfs :: GType+gTypeVfs =+  {# call fun unsafe g_vfs_get_type #}++-- ************************************************************* MountOperation++{#pointer *MountOperation foreign newtype #} deriving (Eq,Ord)++mkMountOperation = (MountOperation, objectUnref)+unMountOperation (MountOperation o) = o++class GObjectClass o => MountOperationClass o+toMountOperation :: MountOperationClass o => o -> MountOperation+toMountOperation = unsafeCastGObject . toGObject++instance MountOperationClass MountOperation+instance GObjectClass MountOperation where+  toGObject = GObject . castForeignPtr . unMountOperation+  unsafeCastGObject = MountOperation . castForeignPtr . unGObject++castToMountOperation :: GObjectClass obj => obj -> MountOperation+castToMountOperation = castTo gTypeMountOperation "MountOperation"++gTypeMountOperation :: GType+gTypeMountOperation =+  {# call fun unsafe g_mount_operation_get_type #}++-- ***************************************************************** ThemedIcon++{#pointer *ThemedIcon foreign newtype #} deriving (Eq,Ord)++mkThemedIcon = (ThemedIcon, objectUnref)+unThemedIcon (ThemedIcon o) = o++class GObjectClass o => ThemedIconClass o+toThemedIcon :: ThemedIconClass o => o -> ThemedIcon+toThemedIcon = unsafeCastGObject . toGObject++instance ThemedIconClass ThemedIcon+instance GObjectClass ThemedIcon where+  toGObject = GObject . castForeignPtr . unThemedIcon+  unsafeCastGObject = ThemedIcon . castForeignPtr . unGObject++castToThemedIcon :: GObjectClass obj => obj -> ThemedIcon+castToThemedIcon = castTo gTypeThemedIcon "ThemedIcon"++gTypeThemedIcon :: GType+gTypeThemedIcon =+  {# call fun unsafe g_themed_icon_get_type #}++-- ********************************************************************* Emblem++{#pointer *Emblem foreign newtype #} deriving (Eq,Ord)++mkEmblem = (Emblem, objectUnref)+unEmblem (Emblem o) = o++class GObjectClass o => EmblemClass o+toEmblem :: EmblemClass o => o -> Emblem+toEmblem = unsafeCastGObject . toGObject++instance EmblemClass Emblem+instance GObjectClass Emblem where+  toGObject = GObject . castForeignPtr . unEmblem+  unsafeCastGObject = Emblem . castForeignPtr . unGObject++castToEmblem :: GObjectClass obj => obj -> Emblem+castToEmblem = castTo gTypeEmblem "Emblem"++gTypeEmblem :: GType+gTypeEmblem =+  {# call fun unsafe g_emblem_get_type #}++-- *************************************************************** EmblemedIcon++{#pointer *EmblemedIcon foreign newtype #} deriving (Eq,Ord)++mkEmblemedIcon = (EmblemedIcon, objectUnref)+unEmblemedIcon (EmblemedIcon o) = o++class GObjectClass o => EmblemedIconClass o+toEmblemedIcon :: EmblemedIconClass o => o -> EmblemedIcon+toEmblemedIcon = unsafeCastGObject . toGObject++instance EmblemedIconClass EmblemedIcon+instance GObjectClass EmblemedIcon where+  toGObject = GObject . castForeignPtr . unEmblemedIcon+  unsafeCastGObject = EmblemedIcon . castForeignPtr . unGObject++castToEmblemedIcon :: GObjectClass obj => obj -> EmblemedIcon+castToEmblemedIcon = castTo gTypeEmblemedIcon "EmblemedIcon"++gTypeEmblemedIcon :: GType+gTypeEmblemedIcon =+  {# call fun unsafe g_emblemed_icon_get_type #}++-- ************************************************************* FileEnumerator++{#pointer *FileEnumerator foreign newtype #} deriving (Eq,Ord)++mkFileEnumerator = (FileEnumerator, objectUnref)+unFileEnumerator (FileEnumerator o) = o++class GObjectClass o => FileEnumeratorClass o+toFileEnumerator :: FileEnumeratorClass o => o -> FileEnumerator+toFileEnumerator = unsafeCastGObject . toGObject++instance FileEnumeratorClass FileEnumerator+instance GObjectClass FileEnumerator where+  toGObject = GObject . castForeignPtr . unFileEnumerator+  unsafeCastGObject = FileEnumerator . castForeignPtr . unGObject++castToFileEnumerator :: GObjectClass obj => obj -> FileEnumerator+castToFileEnumerator = castTo gTypeFileEnumerator "FileEnumerator"++gTypeFileEnumerator :: GType+gTypeFileEnumerator =+  {# call fun unsafe g_file_enumerator_get_type #}++-- ********************************************************** FilenameCompleter++{#pointer *FilenameCompleter foreign newtype #} deriving (Eq,Ord)++mkFilenameCompleter = (FilenameCompleter, objectUnref)+unFilenameCompleter (FilenameCompleter o) = o++class GObjectClass o => FilenameCompleterClass o+toFilenameCompleter :: FilenameCompleterClass o => o -> FilenameCompleter+toFilenameCompleter = unsafeCastGObject . toGObject++instance FilenameCompleterClass FilenameCompleter+instance GObjectClass FilenameCompleter where+  toGObject = GObject . castForeignPtr . unFilenameCompleter+  unsafeCastGObject = FilenameCompleter . castForeignPtr . unGObject++castToFilenameCompleter :: GObjectClass obj => obj -> FilenameCompleter+castToFilenameCompleter = castTo gTypeFilenameCompleter "FilenameCompleter"++gTypeFilenameCompleter :: GType+gTypeFilenameCompleter =+  {# call fun unsafe g_filename_completer_get_type #}++-- ******************************************************************* FileIcon++{#pointer *FileIcon foreign newtype #} deriving (Eq,Ord)++mkFileIcon = (FileIcon, objectUnref)+unFileIcon (FileIcon o) = o++class GObjectClass o => FileIconClass o+toFileIcon :: FileIconClass o => o -> FileIcon+toFileIcon = unsafeCastGObject . toGObject++instance FileIconClass FileIcon+instance GObjectClass FileIcon where+  toGObject = GObject . castForeignPtr . unFileIcon+  unsafeCastGObject = FileIcon . castForeignPtr . unGObject++castToFileIcon :: GObjectClass obj => obj -> FileIcon+castToFileIcon = castTo gTypeFileIcon "FileIcon"++gTypeFileIcon :: GType+gTypeFileIcon =+  {# call fun unsafe g_file_icon_get_type #}++-- ************************************************************** VolumeMonitor++{#pointer *VolumeMonitor foreign newtype #} deriving (Eq,Ord)++mkVolumeMonitor = (VolumeMonitor, objectUnref)+unVolumeMonitor (VolumeMonitor o) = o++class GObjectClass o => VolumeMonitorClass o+toVolumeMonitor :: VolumeMonitorClass o => o -> VolumeMonitor+toVolumeMonitor = unsafeCastGObject . toGObject++instance VolumeMonitorClass VolumeMonitor+instance GObjectClass VolumeMonitor where+  toGObject = GObject . castForeignPtr . unVolumeMonitor+  unsafeCastGObject = VolumeMonitor . castForeignPtr . unGObject++castToVolumeMonitor :: GObjectClass obj => obj -> VolumeMonitor+castToVolumeMonitor = castTo gTypeVolumeMonitor "VolumeMonitor"++gTypeVolumeMonitor :: GType+gTypeVolumeMonitor =+  {# call fun unsafe g_volume_monitor_get_type #}++-- **************************************************************** Cancellable++{#pointer *Cancellable foreign newtype #} deriving (Eq,Ord)++mkCancellable = (Cancellable, objectUnref)+unCancellable (Cancellable o) = o++class GObjectClass o => CancellableClass o+toCancellable :: CancellableClass o => o -> Cancellable+toCancellable = unsafeCastGObject . toGObject++instance CancellableClass Cancellable+instance GObjectClass Cancellable where+  toGObject = GObject . castForeignPtr . unCancellable+  unsafeCastGObject = Cancellable . castForeignPtr . unGObject++castToCancellable :: GObjectClass obj => obj -> Cancellable+castToCancellable = castTo gTypeCancellable "Cancellable"++gTypeCancellable :: GType+gTypeCancellable =+  {# call fun unsafe g_cancellable_get_type #}++-- ********************************************************** SimpleAsyncResult++{#pointer *SimpleAsyncResult foreign newtype #} deriving (Eq,Ord)++mkSimpleAsyncResult = (SimpleAsyncResult, objectUnref)+unSimpleAsyncResult (SimpleAsyncResult o) = o++class GObjectClass o => SimpleAsyncResultClass o+toSimpleAsyncResult :: SimpleAsyncResultClass o => o -> SimpleAsyncResult+toSimpleAsyncResult = unsafeCastGObject . toGObject++instance SimpleAsyncResultClass SimpleAsyncResult+instance GObjectClass SimpleAsyncResult where+  toGObject = GObject . castForeignPtr . unSimpleAsyncResult+  unsafeCastGObject = SimpleAsyncResult . castForeignPtr . unGObject++castToSimpleAsyncResult :: GObjectClass obj => obj -> SimpleAsyncResult+castToSimpleAsyncResult = castTo gTypeSimpleAsyncResult "SimpleAsyncResult"++gTypeSimpleAsyncResult :: GType+gTypeSimpleAsyncResult =+  {# call fun unsafe g_async_result_get_type #}++-- ******************************************************************* FileInfo++{#pointer *FileInfo foreign newtype #} deriving (Eq,Ord)++mkFileInfo = (FileInfo, objectUnref)+unFileInfo (FileInfo o) = o++class GObjectClass o => FileInfoClass o+toFileInfo :: FileInfoClass o => o -> FileInfo+toFileInfo = unsafeCastGObject . toGObject++instance FileInfoClass FileInfo+instance GObjectClass FileInfo where+  toGObject = GObject . castForeignPtr . unFileInfo+  unsafeCastGObject = FileInfo . castForeignPtr . unGObject++castToFileInfo :: GObjectClass obj => obj -> FileInfo+castToFileInfo = castTo gTypeFileInfo "FileInfo"++gTypeFileInfo :: GType+gTypeFileInfo =+  {# call fun unsafe g_file_info_get_type #}++-- *********************************************************** AppLaunchContext++{#pointer *AppLaunchContext foreign newtype #} deriving (Eq,Ord)++mkAppLaunchContext = (AppLaunchContext, objectUnref)+unAppLaunchContext (AppLaunchContext o) = o++class FileInfoClass o => AppLaunchContextClass o+toAppLaunchContext :: AppLaunchContextClass o => o -> AppLaunchContext+toAppLaunchContext = unsafeCastGObject . toGObject++instance AppLaunchContextClass AppLaunchContext+instance FileInfoClass AppLaunchContext+instance GObjectClass AppLaunchContext where+  toGObject = GObject . castForeignPtr . unAppLaunchContext+  unsafeCastGObject = AppLaunchContext . castForeignPtr . unGObject++castToAppLaunchContext :: GObjectClass obj => obj -> AppLaunchContext+castToAppLaunchContext = castTo gTypeAppLaunchContext "AppLaunchContext"++gTypeAppLaunchContext :: GType+gTypeAppLaunchContext =+  {# call fun unsafe g_app_launch_context_get_type #}++-- *********************************************************************** Icon++{#pointer *Icon foreign newtype #} deriving (Eq,Ord)++mkIcon = (Icon, objectUnref)+unIcon (Icon o) = o++class GObjectClass o => IconClass o+toIcon :: IconClass o => o -> Icon+toIcon = unsafeCastGObject . toGObject++instance IconClass Icon+instance GObjectClass Icon where+  toGObject = GObject . castForeignPtr . unIcon+  unsafeCastGObject = Icon . castForeignPtr . unGObject++castToIcon :: GObjectClass obj => obj -> Icon+castToIcon = castTo gTypeIcon "Icon"++gTypeIcon :: GType+gTypeIcon =+  {# call fun unsafe g_icon_get_type #}++-- ******************************************************************* Seekable++{#pointer *Seekable foreign newtype #} deriving (Eq,Ord)++mkSeekable = (Seekable, objectUnref)+unSeekable (Seekable o) = o++class GObjectClass o => SeekableClass o+toSeekable :: SeekableClass o => o -> Seekable+toSeekable = unsafeCastGObject . toGObject++instance SeekableClass Seekable+instance GObjectClass Seekable where+  toGObject = GObject . castForeignPtr . unSeekable+  unsafeCastGObject = Seekable . castForeignPtr . unGObject++castToSeekable :: GObjectClass obj => obj -> Seekable+castToSeekable = castTo gTypeSeekable "Seekable"++gTypeSeekable :: GType+gTypeSeekable =+  {# call fun unsafe g_seekable_get_type #}++-- ******************************************************************** AppInfo++{#pointer *AppInfo foreign newtype #} deriving (Eq,Ord)++mkAppInfo = (AppInfo, objectUnref)+unAppInfo (AppInfo o) = o++class GObjectClass o => AppInfoClass o+toAppInfo :: AppInfoClass o => o -> AppInfo+toAppInfo = unsafeCastGObject . toGObject++instance AppInfoClass AppInfo+instance GObjectClass AppInfo where+  toGObject = GObject . castForeignPtr . unAppInfo+  unsafeCastGObject = AppInfo . castForeignPtr . unGObject++castToAppInfo :: GObjectClass obj => obj -> AppInfo+castToAppInfo = castTo gTypeAppInfo "AppInfo"++gTypeAppInfo :: GType+gTypeAppInfo =+  {# call fun unsafe g_app_info_get_type #}++-- ********************************************************************* Volume++{#pointer *Volume foreign newtype #} deriving (Eq,Ord)++mkVolume = (Volume, objectUnref)+unVolume (Volume o) = o++class GObjectClass o => VolumeClass o+toVolume :: VolumeClass o => o -> Volume+toVolume = unsafeCastGObject . toGObject++instance VolumeClass Volume+instance GObjectClass Volume where+  toGObject = GObject . castForeignPtr . unVolume+  unsafeCastGObject = Volume . castForeignPtr . unGObject++castToVolume :: GObjectClass obj => obj -> Volume+castToVolume = castTo gTypeVolume "Volume"++gTypeVolume :: GType+gTypeVolume =+  {# call fun unsafe g_volume_get_type #}++-- **************************************************************** AsyncResult++{#pointer *AsyncResult foreign newtype #} deriving (Eq,Ord)++mkAsyncResult = (AsyncResult, objectUnref)+unAsyncResult (AsyncResult o) = o++class GObjectClass o => AsyncResultClass o+toAsyncResult :: AsyncResultClass o => o -> AsyncResult+toAsyncResult = unsafeCastGObject . toGObject++instance AsyncResultClass AsyncResult+instance GObjectClass AsyncResult where+  toGObject = GObject . castForeignPtr . unAsyncResult+  unsafeCastGObject = AsyncResult . castForeignPtr . unGObject++castToAsyncResult :: GObjectClass obj => obj -> AsyncResult+castToAsyncResult = castTo gTypeAsyncResult "AsyncResult"++gTypeAsyncResult :: GType+gTypeAsyncResult =+  {# call fun unsafe g_async_result_get_type #}++-- *************************************************************** LoadableIcon++{#pointer *LoadableIcon foreign newtype #} deriving (Eq,Ord)++mkLoadableIcon = (LoadableIcon, objectUnref)+unLoadableIcon (LoadableIcon o) = o++class GObjectClass o => LoadableIconClass o+toLoadableIcon :: LoadableIconClass o => o -> LoadableIcon+toLoadableIcon = unsafeCastGObject . toGObject++instance LoadableIconClass LoadableIcon+instance GObjectClass LoadableIcon where+  toGObject = GObject . castForeignPtr . unLoadableIcon+  unsafeCastGObject = LoadableIcon . castForeignPtr . unGObject++castToLoadableIcon :: GObjectClass obj => obj -> LoadableIcon+castToLoadableIcon = castTo gTypeLoadableIcon "LoadableIcon"++gTypeLoadableIcon :: GType+gTypeLoadableIcon =+  {# call fun unsafe g_loadable_icon_get_type #}++-- ********************************************************************** Drive++{#pointer *Drive foreign newtype #} deriving (Eq,Ord)++mkDrive = (Drive, objectUnref)+unDrive (Drive o) = o++class GObjectClass o => DriveClass o+toDrive :: DriveClass o => o -> Drive+toDrive = unsafeCastGObject . toGObject++instance DriveClass Drive+instance GObjectClass Drive where+  toGObject = GObject . castForeignPtr . unDrive+  unsafeCastGObject = Drive . castForeignPtr . unGObject++castToDrive :: GObjectClass obj => obj -> Drive+castToDrive = castTo gTypeDrive "Drive"++gTypeDrive :: GType+gTypeDrive =+  {# call fun unsafe g_drive_get_type #}++-- *********************************************************************** File++{#pointer *File foreign newtype #}++mkFile = (File, objectUnref)+unFile (File o) = o++class GObjectClass o => FileClass o+toFile :: FileClass o => o -> File+toFile = unsafeCastGObject . toGObject++instance FileClass File+instance GObjectClass File where+  toGObject = GObject . castForeignPtr . unFile+  unsafeCastGObject = File . castForeignPtr . unGObject++castToFile :: GObjectClass obj => obj -> File+castToFile = castTo gTypeFile "File"++gTypeFile :: GType+gTypeFile =+  {# call fun unsafe g_file_get_type #}++-- ********************************************************************** Mount++{#pointer *Mount foreign newtype #} deriving (Eq,Ord)++mkMount = (Mount, objectUnref)+unMount (Mount o) = o++class GObjectClass o => MountClass o+toMount :: MountClass o => o -> Mount+toMount = unsafeCastGObject . toGObject++instance MountClass Mount+instance GObjectClass Mount where+  toGObject = GObject . castForeignPtr . unMount+  unsafeCastGObject = Mount . castForeignPtr . unGObject++castToMount :: GObjectClass obj => obj -> Mount+castToMount = castTo gTypeMount "Mount"++gTypeMount :: GType+gTypeMount =+  {# call fun unsafe g_mount_get_type #}+
+ gio.cabal view
@@ -0,0 +1,58 @@+Name:           gio+Version:        0.11.0+License:        GPL+License-file:   COPYING+Copyright:      (c) 2001-2010 The Gtk2Hs Team+Author:         Peter Gavin, Andy Stewart+Maintainer:     gtk2hs-users@sourceforge.net+Build-Type:     Custom+Cabal-Version:  >= 1.6+Stability:      stable+homepage:       http://www.haskell.org/gtk2hs/+bug-reports:    http://hackage.haskell.org/trac/gtk2hs/+Synopsis:       Binding to the GIO.+Description:    GIO is striving to provide a modern, easy-to-use VFS API that sits at the right level in the library stack. +                The goal is to overcome the shortcomings of GnomeVFS and provide an API that is +                so good that developers prefer it over raw POSIX calls. +                Among other things that means using GObject. +                It also means not cloning the POSIX API, but providing higher-level, document-centric interfaces.+Category:       System+Tested-With:    GHC == 6.12.1+Extra-Source-Files: Gtk2HsSetup.hs+                    marshal.list++x-Types-File:   System/GIO/Types.chs+x-Types-Tag:    gio+x-Types-ModName: System.GIO.Types+x-Types-Import: System.Glib.GObject+x-Types-Lib:    gio+x-Types-Prefix: g++Source-Repository head+  type:         darcs+  location:     http://code.haskell.org/gtk2hs/+  subdir:       gio++Library+        build-depends:  base >= 4 && < 5, array, containers, haskell98, mtl, bytestring,+                        glib >= 0.11 && < 0.12+        build-tools:    gtk2hsC2hs, gtk2hsHookGenerator, gtk2hsTypeGen++        exposed-modules:+          System.GIO+          System.GIO.Base+          System.GIO.Async.AsyncResult+          System.GIO.Async.Cancellable+          System.GIO.File.FileAttribute+          System.GIO.File.File+          System.GIO.Types		  +        other-modules:+          System.GIO.Signals++        extensions:     ForeignFunctionInterface+		+        x-Signals-File:  System/GIO/Signals.chs+        x-Signals-Modname: System.GIO.Signals+        x-Signals-Types: marshal.list+        x-c2hs-Header:  gio/gio.h+        pkgconfig-depends: gio-2.0 >= 2.16.4
+ marshal.list view
@@ -0,0 +1,45 @@+# see glib-genmarshal(1) for a detailed description of the file format,+# possible parameter types are:+#   VOID        indicates   no   return   type,  or  no  extra+#               parameters. if VOID is used as  the  parameter+#               list, no additional parameters may be present.+#   BOOLEAN     for boolean types (gboolean)+#   CHAR        for signed char types (gchar)+#   UCHAR       for unsigned char types (guchar)+#   INT         for signed integer types (gint)+#   UINT        for unsigned integer types (guint)+#   LONG        for signed long integer types (glong)+#   ULONG       for unsigned long integer types (gulong)+#   ENUM        for enumeration types (gint)+#   FLAGS       for flag enumeration types (guint)+#   FLOAT       for single-precision float types (gfloat)+#   DOUBLE      for double-precision float types (gdouble)+#   STRING      for string types (gchar*)+#   BOXED       for boxed (anonymous but reference counted) types (GBoxed*)+#   POINTER     for anonymous pointer types (gpointer)+#   NONE        deprecated alias for VOID+#   BOOL        deprecated alias for BOOLEAN++#+# One discrepancy from Gtk+ is that for signals that may pass NULL for an object+# reference, the Haskell signal should be passed a 'Maybe GObject'.+# We therefore have two variants that are marshalled as a maybe type:+#+#   OBJECT      for GObject or derived types (GObject*)+#   MOBJECT      for GObject or derived types (GObject*) that may be NULL++# Furthermore, some objects needs to be destroyed synchronously from the main loop of+# Gtk rather than during GC. These objects need to be marshalled using TOBJECT (for thread-safe+# object). It doesn't hurt to use TOBJECT for an object that doesn't need it, except for the+# some performance. As a rule of thumb, use TOBJECT for all libraries that build on package+# 'gtk' and use OBJECT for all packages that only need packages 'glib', 'pango', 'cairo',+# 'gio'. Again both variants exist. Note that the same names will be generated for OBJECT and+# TOBJECT, so you have to remove the OBJECT handler if you need both.+#+#   TOBJECT      for GObject or derived types (GObject*)+#   MTOBJECT      for GObject or derived types (GObject*) that may be NULL++# If you add a new signal type, please check that it actually works!+# If it is a Boxed type check that the reference counting is right.++NONE:NONE