-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Binding to the GLIB library for Gtk2Hs. -- -- The GNU Library is a collection of C data structures and utility -- function for dealing with Unicode. This package only binds as much -- functionality as required to support the packages that wrap libraries -- that are themselves based on GLib. @package glib @version 0.11.2 -- | Attributes interface -- -- Attributes of an object can be get and set. Getting the value of an -- object's attribute is straingtforward. As an example consider a -- button widget and an attribute called buttonLabel. -- --
--   value <- get button buttonLabel
--   
-- -- The syntax for setting or updating an attribute is only slightly more -- complex. At the simplest level it is just: -- --
--   set button [ buttonLabel := value ]
--   
-- -- However as the list notation would indicate, you can set or update -- multiple attributes of the same object in one go: -- --
--   set button [ buttonLabel := value, buttonFocusOnClick := False ]
--   
-- -- You are not limited to setting the value of an attribute, you can also -- apply an update function to an attribute's value. That is the function -- receives the current value of the attribute and returns the new value. -- --
--   set spinButton [ spinButtonValue :~ (+1) ]
--   
-- -- There are other variants of these operators, (see AttrOp). -- :=> and :~> and like := and :~ but -- operate in the IO monad rather than being pure. There is also -- ::= and ::~ which take the object as an extra parameter. -- -- Attributes can be read only, write only or both read/write. module System.Glib.Attributes -- | An ordinary attribute. Most attributes have the same get and set -- types. type Attr o a = ReadWriteAttr o a a -- | A read-only attribute. type ReadAttr o a = ReadWriteAttr o a () -- | A write-only attribute. type WriteAttr o b = ReadWriteAttr o () b -- | A generalised attribute with independent get and set types. data ReadWriteAttr o a b -- | A set or update operation on an attribute. data AttrOp o -- | Assign a value to an attribute. (:=) :: ReadWriteAttr o a b -> b -> AttrOp o -- | Apply an update function to an attribute. (:~) :: ReadWriteAttr o a b -> (a -> b) -> AttrOp o -- | Assign the result of an IO action to an attribute. (:=>) :: ReadWriteAttr o a b -> (IO b) -> AttrOp o -- | Apply a IO update function to an attribute. (:~>) :: ReadWriteAttr o a b -> (a -> IO b) -> AttrOp o -- | Assign a value to an attribute with the object as an argument. (::=) :: ReadWriteAttr o a b -> (o -> b) -> AttrOp o -- | Apply an update function to an attribute with the object as an -- argument. (::~) :: ReadWriteAttr o a b -> (o -> a -> b) -> AttrOp o -- | Get an Attr of an object. get :: o -> ReadWriteAttr o a b -> IO a -- | Set a number of properties for some object. set :: o -> [AttrOp o] -> IO () -- | Create a new attribute with a getter and setter function. newNamedAttr :: String -> (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b -- | Create a new read-only attribute. readNamedAttr :: String -> (o -> IO a) -> ReadAttr o a -- | Create a new write-only attribute. writeNamedAttr :: String -> (o -> b -> IO ()) -> WriteAttr o b -- | Create a new attribute with a getter and setter function. newAttr :: (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b -- | Create a new read-only attribute. readAttr :: (o -> IO a) -> ReadAttr o a -- | Create a new write-only attribute. writeAttr :: (o -> b -> IO ()) -> WriteAttr o b instance Show (ReadWriteAttr o a b) -- | This module defines a type class for flags that are marshaled as -- bitflags. module System.Glib.Flags class (Enum a, Bounded a) => Flags a fromFlags :: Flags a => [a] -> Int toFlags :: Flags a => Int -> [a] -- | Defines functions to extract data from a GList and to produce a GList -- from a list of pointers. -- -- module System.Glib.GList type GList = Ptr (()) readGList :: GList -> IO [Ptr a] fromGList :: GList -> IO [Ptr a] toGList :: [Ptr a] -> IO GList withGList :: [Ptr a] -> (GSList -> IO b) -> IO b type GSList = Ptr (()) readGSList :: GSList -> IO [Ptr a] fromGSList :: GSList -> IO [Ptr a] fromGSListRev :: GSList -> IO [Ptr a] toGSList :: [Ptr a] -> IO GSList withGSList :: [Ptr a] -> (GSList -> IO b) -> IO b -- | This module implements only the necessities for the GTK binding. module System.Glib.GType type GType = CUInt -- | Check if an object is of the specific type or derived from it. -- -- typeInstanceIsA :: Ptr () -> GType -> Bool -- | This module implements only the necessities for the GTK binding. -- -- module System.Glib.GValue newtype GValue GValue :: (Ptr (GValue)) -> GValue -- | Clear a GValue. valueInit :: GValue -> GType -> IO () -- | Get the type of the value stored in the GValue valueGetType :: GValue -> IO GType -- | Temporarily allocate a GValue. allocaGValue :: (GValue -> IO b) -> IO b -- | Storable instance for GParameter, used by objectNew module System.Glib.GParameter newtype GParameter GParameter :: (String, GValue) -> GParameter instance Storable GParameter module System.Glib.GTypeConstants invalid :: GType none :: GType uint :: GType int :: GType uint64 :: GType int64 :: GType uchar :: GType char :: GType bool :: GType enum :: GType flags :: GType pointer :: GType float :: GType double :: GType string :: GType object :: GType boxed :: GType -- | This module adds CString-like functions that handle UTF8 strings. module System.Glib.UTFString withUTFString :: String -> (CString -> IO a) -> IO a withUTFStringLen :: String -> (CStringLen -> IO a) -> IO a newUTFString :: String -> IO CString newUTFStringLen :: String -> IO CStringLen peekUTFString :: CString -> IO String peekUTFStringLen :: CStringLen -> IO String maybePeekUTFString :: CString -> IO (Maybe String) readUTFString :: CString -> IO String readCString :: CString -> IO String withUTFStrings :: [String] -> ([CString] -> IO a) -> IO a withUTFStringArray :: [String] -> (Ptr CString -> IO a) -> IO a withUTFStringArray0 :: [String] -> (Ptr CString -> IO a) -> IO a peekUTFStringArray :: Int -> Ptr CString -> IO [String] peekUTFStringArray0 :: Ptr CString -> IO [String] readUTFStringArray0 :: Ptr CString -> IO [String] data UTFCorrection genUTFOfs :: String -> UTFCorrection ofsToUTF :: Int -> UTFCorrection -> Int ofsFromUTF :: Int -> UTFCorrection -> Int instance Show UTFCorrection -- | The base object type for all glib objects module System.Glib.GObject newtype GObject GObject :: (ForeignPtr (GObject)) -> GObject class GObjectClass o toGObject :: GObjectClass o => o -> GObject unsafeCastGObject :: GObjectClass o => GObject -> o mkGObject :: (ForeignPtr GObject -> GObject, FinalizerPtr a) unGObject :: GObject -> ForeignPtr GObject castToGObject :: GObjectClass obj => obj -> obj -- | Decrease the reference counter of an object objectUnref :: FinalizerPtr a -- | Construct a new object (should rairly be used directly) objectNew :: GType -> [(String, GValue)] -> IO (Ptr GObject) -- | Increase the reference counter of an object objectRef :: GObjectClass obj => Ptr obj -> IO () -- | Reference and sink an object. objectRefSink :: GObjectClass obj => Ptr obj -> IO () -- | This function wraps any object that does not derive from Object. It -- should be used whenever a function returns a pointer to an existing -- GObject (as opposed to a function that constructs a new -- object). -- -- makeNewGObject :: GObjectClass obj => (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj -- | This function wraps any object that does not derive from Object. The -- object is NOT reference, hence it should be used when a new object is -- created. Newly created GObjects have a reference count of one, -- hence don't need ref'ing. constructNewGObject :: GObjectClass obj => (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj -- | The type constant to check if an instance is of GObject type. gTypeGObject :: GType -- | Determine if this is an instance of a particular GTK type isA :: GObjectClass o => o -> GType -> Bool type DestroyNotify = FunPtr (((Ptr ()) -> (IO ()))) -- | Many methods in classes derived from GObject take a callback function -- and a destructor function which is called to free that callback -- function when it is no longer required. This constants is an address -- of a functions in C land that will free a function pointer. destroyFunPtr :: DestroyNotify -- | The address of a function freeing a StablePtr. See -- destroyFunPtr. destroyStablePtr :: DestroyNotify type Quark = CUInt -- | Create a unique id based on the given string. quarkFromString :: String -> IO Quark -- | Add an attribute to this object. -- -- objectCreateAttribute :: GObjectClass o => IO (Attr o (Maybe a)) -- | Set the value of an association. objectSetAttribute :: GObjectClass o => Quark -> o -> Maybe a -> IO () -- | Get the value of an association. -- -- objectGetAttributeUnsafe :: GObjectClass o => Quark -> o -> IO (Maybe a) -- | This is used by the implementation of properties and by the -- Graphics.UI.Gtk.TreeList.TreeModel and related modules. module System.Glib.GValueTypes valueSetUInt :: GValue -> Word -> IO () valueGetUInt :: GValue -> IO Word valueSetInt :: GValue -> Int -> IO () valueGetInt :: GValue -> IO Int valueSetUInt64 :: GValue -> Word64 -> IO () valueGetUInt64 :: GValue -> IO Word64 valueSetInt64 :: GValue -> Int64 -> IO () valueGetInt64 :: GValue -> IO Int64 valueSetBool :: GValue -> Bool -> IO () valueGetBool :: GValue -> IO Bool valueSetPointer :: GValue -> (Ptr ()) -> IO () valueGetPointer :: GValue -> IO (Ptr ()) valueSetFloat :: GValue -> Float -> IO () valueGetFloat :: GValue -> IO Float valueSetDouble :: GValue -> Double -> IO () valueGetDouble :: GValue -> IO Double valueSetEnum :: Enum enum => GValue -> enum -> IO () valueGetEnum :: Enum enum => GValue -> IO enum valueSetFlags :: Flags flag => GValue -> [flag] -> IO () valueGetFlags :: Flags flag => GValue -> IO [flag] valueSetString :: GValue -> String -> IO () valueGetString :: GValue -> IO String valueSetMaybeString :: GValue -> Maybe String -> IO () valueGetMaybeString :: GValue -> IO (Maybe String) valueSetBoxed :: (boxed -> (Ptr boxed -> IO ()) -> IO ()) -> GValue -> boxed -> IO () valueGetBoxed :: (Ptr boxed -> IO boxed) -> GValue -> IO boxed valueSetGObject :: GObjectClass gobj => GValue -> gobj -> IO () valueGetGObject :: GObjectClass gobj => GValue -> IO gobj valueSetMaybeGObject :: GObjectClass gobj => GValue -> (Maybe gobj) -> IO () valueGetMaybeGObject :: GObjectClass gobj => GValue -> IO (Maybe gobj) -- | Functions for getting and setting GObject properties module System.Glib.Properties objectSetPropertyInt :: GObjectClass gobj => String -> gobj -> Int -> IO () objectGetPropertyInt :: GObjectClass gobj => String -> gobj -> IO Int objectSetPropertyUInt :: GObjectClass gobj => String -> gobj -> Int -> IO () objectGetPropertyUInt :: GObjectClass gobj => String -> gobj -> IO Int objectSetPropertyInt64 :: GObjectClass gobj => String -> gobj -> Int64 -> IO () objectGetPropertyInt64 :: GObjectClass gobj => String -> gobj -> IO Int64 objectSetPropertyUInt64 :: GObjectClass gobj => String -> gobj -> Word64 -> IO () objectGetPropertyUInt64 :: GObjectClass gobj => String -> gobj -> IO Word64 objectSetPropertyChar :: GObjectClass gobj => String -> gobj -> Char -> IO () objectGetPropertyChar :: GObjectClass gobj => String -> gobj -> IO Char objectSetPropertyBool :: GObjectClass gobj => String -> gobj -> Bool -> IO () objectGetPropertyBool :: GObjectClass gobj => String -> gobj -> IO Bool objectSetPropertyEnum :: (GObjectClass gobj, Enum enum) => GType -> String -> gobj -> enum -> IO () objectGetPropertyEnum :: (GObjectClass gobj, Enum enum) => GType -> String -> gobj -> IO enum objectSetPropertyFlags :: (GObjectClass gobj, Flags flag) => GType -> String -> gobj -> [flag] -> IO () objectGetPropertyFlags :: (GObjectClass gobj, Flags flag) => GType -> String -> gobj -> IO [flag] objectSetPropertyFloat :: GObjectClass gobj => String -> gobj -> Float -> IO () objectGetPropertyFloat :: GObjectClass gobj => String -> gobj -> IO Float objectSetPropertyDouble :: GObjectClass gobj => String -> gobj -> Double -> IO () objectGetPropertyDouble :: GObjectClass gobj => String -> gobj -> IO Double objectSetPropertyString :: GObjectClass gobj => String -> gobj -> String -> IO () objectGetPropertyString :: GObjectClass gobj => String -> gobj -> IO String objectSetPropertyMaybeString :: GObjectClass gobj => String -> gobj -> Maybe String -> IO () objectGetPropertyMaybeString :: GObjectClass gobj => String -> gobj -> IO (Maybe String) objectSetPropertyBoxedOpaque :: GObjectClass gobj => (boxed -> (Ptr boxed -> IO ()) -> IO ()) -> GType -> String -> gobj -> boxed -> IO () objectGetPropertyBoxedOpaque :: GObjectClass gobj => (Ptr boxed -> IO boxed) -> GType -> String -> gobj -> IO boxed objectSetPropertyBoxedStorable :: (GObjectClass gobj, Storable boxed) => GType -> String -> gobj -> boxed -> IO () objectGetPropertyBoxedStorable :: (GObjectClass gobj, Storable boxed) => GType -> String -> gobj -> IO boxed objectSetPropertyGObject :: (GObjectClass gobj, GObjectClass gobj') => GType -> String -> gobj -> gobj' -> IO () objectGetPropertyGObject :: (GObjectClass gobj, GObjectClass gobj') => GType -> String -> gobj -> IO gobj' newAttrFromIntProperty :: GObjectClass gobj => String -> Attr gobj Int readAttrFromIntProperty :: GObjectClass gobj => String -> ReadAttr gobj Int newAttrFromUIntProperty :: GObjectClass gobj => String -> Attr gobj Int newAttrFromCharProperty :: GObjectClass gobj => String -> Attr gobj Char writeAttrFromUIntProperty :: GObjectClass gobj => String -> WriteAttr gobj Int newAttrFromBoolProperty :: GObjectClass gobj => String -> Attr gobj Bool readAttrFromBoolProperty :: GObjectClass gobj => String -> ReadAttr gobj Bool newAttrFromFloatProperty :: GObjectClass gobj => String -> Attr gobj Float newAttrFromDoubleProperty :: GObjectClass gobj => String -> Attr gobj Double newAttrFromEnumProperty :: (GObjectClass gobj, Enum enum) => String -> GType -> Attr gobj enum readAttrFromEnumProperty :: (GObjectClass gobj, Enum enum) => String -> GType -> ReadAttr gobj enum writeAttrFromEnumProperty :: (GObjectClass gobj, Enum enum) => String -> GType -> WriteAttr gobj enum newAttrFromFlagsProperty :: (GObjectClass gobj, Flags flag) => String -> GType -> Attr gobj [flag] newAttrFromStringProperty :: GObjectClass gobj => String -> Attr gobj String readAttrFromStringProperty :: GObjectClass gobj => String -> ReadAttr gobj String writeAttrFromStringProperty :: GObjectClass gobj => String -> WriteAttr gobj String newAttrFromMaybeStringProperty :: GObjectClass gobj => String -> Attr gobj (Maybe String) readAttrFromMaybeStringProperty :: GObjectClass gobj => String -> ReadAttr gobj (Maybe String) writeAttrFromMaybeStringProperty :: GObjectClass gobj => String -> WriteAttr gobj (Maybe String) newAttrFromBoxedOpaqueProperty :: GObjectClass gobj => (Ptr boxed -> IO boxed) -> (boxed -> (Ptr boxed -> IO ()) -> IO ()) -> String -> GType -> Attr gobj boxed readAttrFromBoxedOpaqueProperty :: GObjectClass gobj => (Ptr boxed -> IO boxed) -> String -> GType -> ReadAttr gobj boxed writeAttrFromBoxedOpaqueProperty :: GObjectClass gobj => (boxed -> (Ptr boxed -> IO ()) -> IO ()) -> String -> GType -> WriteAttr gobj boxed newAttrFromBoxedStorableProperty :: (GObjectClass gobj, Storable boxed) => String -> GType -> Attr gobj boxed newAttrFromObjectProperty :: (GObjectClass gobj, GObjectClass gobj', GObjectClass gobj'') => String -> GType -> ReadWriteAttr gobj gobj' gobj'' writeAttrFromObjectProperty :: (GObjectClass gobj, GObjectClass gobj') => String -> GType -> WriteAttr gobj gobj' readAttrFromObjectProperty :: (GObjectClass gobj, GObjectClass gobj') => String -> GType -> ReadAttr gobj gobj' newAttrFromMaybeObjectProperty :: (GObjectClass gobj, GObjectClass gobj', GObjectClass gobj'') => String -> GType -> ReadWriteAttr gobj (Maybe gobj') (Maybe gobj'') writeAttrFromMaybeObjectProperty :: (GObjectClass gobj, GObjectClass gobj') => String -> GType -> WriteAttr gobj (Maybe gobj') readAttrFromMaybeObjectProperty :: (GObjectClass gobj, GObjectClass gobj') => String -> GType -> ReadAttr gobj (Maybe gobj') objectGetPropertyInternal :: GObjectClass gobj => GType -> (GValue -> IO a) -> String -> gobj -> IO a objectSetPropertyInternal :: GObjectClass gobj => GType -> (GValue -> a -> IO ()) -> String -> gobj -> a -> IO () module System.Glib.StoreValue data TMType TMinvalid :: TMType TMuint :: TMType TMint :: TMType TMboolean :: TMType TMenum :: TMType TMflags :: TMType TMfloat :: TMType TMdouble :: TMType TMstring :: TMType TMobject :: TMType -- | A union with information about the currently stored type. -- -- data GenericValue GVuint :: Word -> GenericValue GVint :: Int -> GenericValue GVboolean :: Bool -> GenericValue GVenum :: Int -> GenericValue GVflags :: Int -> GenericValue GVfloat :: Float -> GenericValue GVdouble :: Double -> GenericValue GVstring :: (Maybe String) -> GenericValue GVobject :: GObject -> GenericValue valueSetGenericValue :: GValue -> GenericValue -> IO () valueGetGenericValue :: GValue -> IO GenericValue instance Enum TMType module System.Glib.Signals -- | Perform an action in response to a signal. -- -- Use it like this: -- --
--   on obj sig $ do
--   ...
--   
-- -- or if the signal handler takes any arguments: -- --
--   on obj sig $ \args -> do
--   ...
--   
on :: object -> Signal object callback -> callback -> IO (ConnectId object) -- | Perform an action in response to a signal. -- -- after :: object -> Signal object callback -> callback -> IO (ConnectId object) -- | The type of signal handler ids. If you ever need to disconnect -- a signal handler then you will need to retain the ConnectId you -- got when you registered it. data GObjectClass o => ConnectId o ConnectId :: (CULong) -> o -> ConnectId o -- | Disconnect a signal handler. After disconnecting the handler will no -- longer be invoked when the event occurs. signalDisconnect :: GObjectClass obj => ConnectId obj -> IO () -- | Block a specific signal handler. -- -- signalBlock :: GObjectClass obj => ConnectId obj -> IO () -- | Unblock a specific signal handler. -- -- signalUnblock :: GObjectClass obj => ConnectId obj -> IO () -- | Stops a signal's current emission. -- -- signalStopEmission :: GObjectClass obj => obj -> SignalName -> IO () -- | main event loop, and events module System.Glib.MainLoop type HandlerId = CUInt -- | Sets a function to be called at regular intervals, with the default -- priority priorityDefault. The function is called repeatedly -- until it returns False, after which point the timeout -- function will not be called again. The first call to the function will -- be at the end of the first interval. -- -- Note that timeout functions may be delayed, due to the processing of -- other event sources. Thus they should not be relied on for precise -- timing. After each call to the timeout function, the time of the next -- timeout is recalculated based on the current time and the given -- interval (it does not try to 'catch up' time lost in delays). timeoutAdd :: IO Bool -> Int -> IO HandlerId -- | Sets a function to be called at regular intervals, with the given -- priority. The function is called repeatedly until it returns -- False, after which point the timeout function will not be -- called again. The first call to the function will be at the end of the -- first interval. -- -- Note that timeout functions may be delayed, due to the processing of -- other event sources. Thus they should not be relied on for precise -- timing. After each call to the timeout function, the time of the next -- timeout is recalculated based on the current time and the given -- interval (it does not try to 'catch up' time lost in delays). timeoutAddFull :: IO Bool -> Priority -> Int -> IO HandlerId -- | Remove a previously added timeout handler by its HandlerId. timeoutRemove :: HandlerId -> IO () -- | Add a callback that is called whenever the system is idle. -- -- idleAdd :: IO Bool -> Priority -> IO HandlerId -- | Remove a previously added idle handler by its HandlerId. idleRemove :: HandlerId -> IO () -- | Flags representing a condition to watch for on a file descriptor. -- -- data IOCondition IOIn :: IOCondition IOOut :: IOCondition IOPri :: IOCondition IOErr :: IOCondition IOHup :: IOCondition IOInvalid :: IOCondition -- | Adds the file descriptor into the main event loop with the given -- priority. inputAdd :: FD -> [IOCondition] -> Priority -> IO Bool -> IO HandlerId inputRemove :: HandlerId -> IO () -- | Priorities for installing callbacks. type Priority = Int priorityLow :: Int priorityDefaultIdle :: Int priorityHighIdle :: Int priorityDefault :: Int priorityHigh :: Int -- | A main event loop abstraction. data MainLoop -- | Create a new MainLoop. mainLoopNew :: Maybe MainContext -> Bool -> IO MainLoop -- | Runs a main loop until mainLoopQuit is called on the loop. If -- this is called for the thread of the loop's MainContext, it -- will process events from the loop, otherwise it will simply wait. mainLoopRun :: MainLoop -> IO () -- | Stops a MainLoop from running. Any calls to mainLoopRun for the -- loop will return. mainLoopQuit :: MainLoop -> IO () -- | Checks to see if the main loop is currently being run via mainLoopRun. mainLoopIsRunning :: MainLoop -> IO Bool -- | An opaque datatype representing a set of sources to be handled in a -- main loop. data MainContext -- | Creates a new MainContext. mainContextNew :: IO MainContext -- | The default MainContext. This is the main context used for main -- loop functions when a main loop is not explicitly specified. mainContextDefault :: MainContext -- | Runs a single iteration for the given main loop. This involves -- checking to see if any event sources are ready to be processed, then -- if no events sources are ready and mayBlock is True, -- waiting for a source to become ready, then dispatching the highest -- priority events sources that are ready. Note that even when -- mayBlock is True, it is still possible for -- mainContextIteration to return (0), since the the wait may be -- interrupted for other reasons than an event source becoming ready. mainContextIteration :: MainContext -> Bool -> IO Bool mainContextFindSourceById :: MainContext -> HandlerId -> IO Source newtype Source Source :: (ForeignPtr (Source)) -> Source sourceAttach :: Source -> MainContext -> IO HandlerId sourceSetPriority :: Source -> Priority -> IO () sourceGetPriority :: Source -> IO Priority sourceDestroy :: Source -> IO () sourceIsDestroyed :: Source -> IO Bool instance Eq IOCondition instance Bounded IOCondition instance Flags IOCondition instance Enum IOCondition -- | Error Reporting, glib's system for reporting errors. -- -- GErrors are used by glib to report recoverable runtime errors. -- -- This module provides functions for checking glib/gtk functions that -- report GErrors. It also provides functions for throwing and -- catching GErrors as Haskell exceptions. module System.Glib.GError -- | A GError consists of a domain, code and a human readable message. data GError GError :: !GErrorDomain -> !GErrorCode -> !GErrorMessage -> GError -- | A code used to identify the 'namespace' of the error. Within each -- error domain all the error codes are defined in an enumeration. Each -- gtk/gnome module that uses GErrors has its own error domain. The -- rationale behind using error domains is so that each module can -- organise its own error codes without having to coordinate on a global -- error code list. type GErrorDomain = GQuark -- | A code to identify a specific error within a given -- GErrorDomain. Most of time you will not need to deal with this -- raw code since there is an enumeration type for each error domain. Of -- course which enumeraton to use depends on the error domain, but if you -- use catchGErrorJustDomain or handleGErrorJustDomain, -- this is worked out for you automatically. type GErrorCode = Int -- | A human readable error message. type GErrorMessage = String -- | This will catch any GError exception. The handler function will -- receive the raw GError. This is probably only useful when you want to -- take some action that does not depend on which GError exception has -- occured, otherwise it would be better to use either -- catchGErrorJust or catchGErrorJustDomain. For example: -- --
--   catchGError
--   (do ...
--   ...)
--   (\(GError dom code msg) -> fail msg)
--   
catchGError :: IO a -> (GError -> IO a) -> IO a -- | This will catch just a specific GError exception. If you need to catch -- a range of related errors, catchGErrorJustDomain is probably -- more appropriate. Example: -- --
--   do image <- catchGErrorJust PixbufErrorCorruptImage
--   loadImage
--   (\errorMessage -> do log errorMessage
--   return mssingImagePlaceholder)
--   
catchGErrorJust :: GErrorClass err => err -> IO a -> (GErrorMessage -> IO a) -> IO a -- | Catch all GErrors from a particular error domain. The handler function -- should just deal with one error enumeration type. If you need to catch -- errors from more than one error domain, use this function twice with -- an appropriate handler functions for each. -- --
--   catchGErrorJustDomain
--   loadImage
--   (\err message -> case err of
--   PixbufErrorCorruptImage -> ...
--   PixbufErrorInsufficientMemory -> ...
--   PixbufErrorUnknownType -> ...
--   _ -> ...)
--   
catchGErrorJustDomain :: GErrorClass err => IO a -> (err -> GErrorMessage -> IO a) -> IO a -- | A verson of catchGError with the arguments swapped around. -- --
--   handleGError (\(GError dom code msg) -> ...) $
--   ...
--   
handleGError :: (GError -> IO a) -> IO a -> IO a -- | A verson of handleGErrorJust with the arguments swapped around. handleGErrorJust :: GErrorClass err => err -> (GErrorMessage -> IO a) -> IO a -> IO a -- | A verson of handleGErrorJustDomain with the arguments swapped -- around. handleGErrorJustDomain :: GErrorClass err => (err -> GErrorMessage -> IO a) -> IO a -> IO a -- | Catch all GError exceptions and convert them into a general failure. failOnGError :: IO a -> IO a -- | Use this if you need to explicitly throw a GError or re-throw an -- existing GError that you do not wish to handle. throwGError :: GError -> IO a -- | Each error domain's error enumeration type should be an instance of -- this class. This class helps to hide the raw error and domain codes -- from the user. This interface should be implemented by calling the -- approrpiate {error_domain}_error_quark. It is safe to use a -- pure FFI call for this. -- -- Example for Graphics.UI.Gtk.Gdk.Pixbuf.PixbufError: -- --
--   instance GErrorClass PixbufError where
--   gerrorDomain _ = {#call pure unsafe pixbuf_error_quark#}
--   
class Enum err => GErrorClass err gerrorDomain :: GErrorClass err => err -> GErrorDomain -- | Glib functions which report GErrors take as a parameter a -- GError **error. Use this function to supply such a parameter. -- It checks if an error was reported and if so throws it as a Haskell -- exception. -- -- Example of use: -- --
--   propagateGError $ \gerrorPtr ->
--   {# call g_some_function_that_might_return_an_error #} a b gerrorPtr
--   
propagateGError :: (Ptr (Ptr ()) -> IO a) -> IO a -- | Like propagateGError but instead of throwing the GError as an -- exception handles the error immediately using the supplied error -- handler. -- -- Example of use: -- --
--   checkGError
--   (\gerrorPtr -> {# call g_some_function_that_might_return_an_error #} a b gerrorPtr)
--   (\(GError domain code msg) -> ...)
--   
checkGError :: (Ptr (Ptr ()) -> IO a) -> (GError -> IO a) -> IO a instance Typeable GError instance Storable GError module System.Glib.GDateTime type GTimeValPart = CLong data GTimeVal GTimeVal :: GTimeValPart -> GTimeValPart -> GTimeVal gTimeValSec :: GTimeVal -> GTimeValPart gTimeValUSec :: GTimeVal -> GTimeValPart gGetCurrentTime :: IO GTimeVal gUSleep :: GTimeValPart -> IO () gTimeValAdd :: GTimeVal -> GTimeValPart -> GTimeVal gTimeValFromISO8601 :: String -> Maybe GTimeVal gTimeValToISO8601 :: GTimeVal -> String newtype GDate GDate :: GDateJulianDay -> GDate gDateJulianDay :: GDate -> GDateJulianDay data GDateDay data GDateMonth data GDateYear type GDateJulianDay = CUInt data GDateWeekday gDateValidJulian :: GDateJulianDay -> Bool gDateValidDMY :: GDateDay -> GDateMonth -> GDateYear -> Bool gDateNewJulian :: GDateJulianDay -> Maybe GDate gDateNewDMY :: GDateDay -> GDateMonth -> GDateYear -> Maybe GDate gDateSetDay :: GDate -> GDateDay -> Maybe GDate gDateSetMonth :: GDate -> GDateMonth -> Maybe GDate gDateSetYear :: GDate -> GDateYear -> Maybe GDate gDateNewTimeVal :: GTimeVal -> GDate gDateParse :: String -> IO (Maybe GDate) gDateAddDays :: GDate -> Word -> GDate gDateSubtractDays :: GDate -> Word -> GDate gDateAddMonths :: GDate -> Word -> GDate gDateSubtractMonths :: GDate -> Word -> GDate gDateAddYears :: GDate -> Word -> GDate gDateSubtractYears :: GDate -> Word -> GDate gDateDaysBetween :: GDate -> GDate -> Int gDateCompare :: GDate -> GDate -> Ordering gDateClamp :: GDate -> GDate -> GDate -> GDate gDateDay :: GDate -> GDateDay gDateMonth :: GDate -> GDateMonth gDateYear :: GDate -> GDateYear gDateWeekday :: GDate -> GDateWeekday instance Eq GDateWeekday instance Ord GDateWeekday instance Eq GDate instance Eq GDateYear instance Ord GDateYear instance Eq GDateMonth instance Ord GDateMonth instance Eq GDateDay instance Ord GDateDay instance Eq GTimeVal instance Ord GTimeVal instance Ord GDate instance Bounded GDateWeekday instance Enum GDateWeekday instance Storable GDate instance Bounded GDateYear instance Bounded GDateMonth instance Enum GDateMonth instance Bounded GDateDay instance Storable GTimeVal -- | This module binds GLib-specific utility procedures. module System.Glib.Utils -- | Gets a human-readable name for the application, as set by -- setApplicationName. This name should be localized if possible, -- and is intended for display to the user. Contrast with -- getProgramName, which gets a non-localized name. If -- setApplicationName has not been performed, returns the result -- of getProgramName (which may be Nothing if -- setProgramName has also not been performed). getApplicationName :: IO (Maybe String) -- | Sets a human-readable name for the application. This name should be -- localized if possible, and is intended for display to the user. -- Contrast with setProgramName, which sets a non-localized name. -- setProgramName will be performed automatically by -- initGUI, but setApplicationName will not. -- -- Note that for thread safety reasons, this computation can only be -- performed once. -- -- The application name will be used in contexts such as error messages, -- or when displaying an application's name in the task list. setApplicationName :: String -> IO () -- | Gets the name of the program. This name should not be -- localized, contrast with getApplicationName. If you are using -- GDK or GTK+, the program name is set in initGUI to the last -- component of argv[0]. getProgramName :: IO (Maybe String) -- | Sets the name of the program. This name should not be -- localized, contrast with setApplicationName. Note that for -- thread-safety reasons this computation can only be performed once. setProgramName :: String -> IO () module System.Glib