{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

A `GOptionContext` struct defines which options
are accepted by the commandline option parser. The struct has only private
fields and should not be directly accessed.
-}

module GI.GLib.Structs.OptionContext
    ( 

-- * Exported types
    OptionContext(..)                       ,
    noOptionContext                         ,


 -- * Methods
-- ** optionContextAddGroup
    optionContextAddGroup                   ,


-- ** optionContextAddMainEntries
    optionContextAddMainEntries             ,


-- ** optionContextFree
    optionContextFree                       ,


-- ** optionContextGetDescription
    optionContextGetDescription             ,


-- ** optionContextGetHelp
    optionContextGetHelp                    ,


-- ** optionContextGetHelpEnabled
    optionContextGetHelpEnabled             ,


-- ** optionContextGetIgnoreUnknownOptions
    optionContextGetIgnoreUnknownOptions    ,


-- ** optionContextGetMainGroup
    optionContextGetMainGroup               ,


-- ** optionContextGetStrictPosix
    optionContextGetStrictPosix             ,


-- ** optionContextGetSummary
    optionContextGetSummary                 ,


-- ** optionContextParseStrv
    optionContextParseStrv                  ,


-- ** optionContextSetDescription
    optionContextSetDescription             ,


-- ** optionContextSetHelpEnabled
    optionContextSetHelpEnabled             ,


-- ** optionContextSetIgnoreUnknownOptions
    optionContextSetIgnoreUnknownOptions    ,


-- ** optionContextSetMainGroup
    optionContextSetMainGroup               ,


-- ** optionContextSetStrictPosix
    optionContextSetStrictPosix             ,


-- ** optionContextSetSummary
    optionContextSetSummary                 ,


-- ** optionContextSetTranslateFunc
    optionContextSetTranslateFunc           ,


-- ** optionContextSetTranslationDomain
    optionContextSetTranslationDomain       ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.GLib.Types
import GI.GLib.Callbacks

newtype OptionContext = OptionContext (ForeignPtr OptionContext)
noOptionContext :: Maybe OptionContext
noOptionContext = Nothing

-- method OptionContext::add_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TInterface "GLib" "OptionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TInterface "GLib" "OptionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_add_group" g_option_context_add_group :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    Ptr OptionGroup ->                      -- group : TInterface "GLib" "OptionGroup"
    IO ()


optionContextAddGroup ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    OptionGroup ->                          -- group
    m ()
optionContextAddGroup _obj group = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    group' <- copyBoxed group
    g_option_context_add_group _obj' group'
    touchManagedPtr _obj
    touchManagedPtr group
    return ()

-- method OptionContext::add_main_entries
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "entries", argType = TInterface "GLib" "OptionEntry", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "translation_domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "entries", argType = TInterface "GLib" "OptionEntry", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "translation_domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_add_main_entries" g_option_context_add_main_entries :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    Ptr OptionEntry ->                      -- entries : TInterface "GLib" "OptionEntry"
    CString ->                              -- translation_domain : TBasicType TUTF8
    IO ()


optionContextAddMainEntries ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    OptionEntry ->                          -- entries
    Maybe (T.Text) ->                       -- translation_domain
    m ()
optionContextAddMainEntries _obj entries translation_domain = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let entries' = unsafeManagedPtrGetPtr entries
    maybeTranslation_domain <- case translation_domain of
        Nothing -> return nullPtr
        Just jTranslation_domain -> do
            jTranslation_domain' <- textToCString jTranslation_domain
            return jTranslation_domain'
    g_option_context_add_main_entries _obj' entries' maybeTranslation_domain
    touchManagedPtr _obj
    touchManagedPtr entries
    freeMem maybeTranslation_domain
    return ()

-- method OptionContext::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_free" g_option_context_free :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    IO ()


optionContextFree ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    m ()
optionContextFree _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_option_context_free _obj'
    touchManagedPtr _obj
    return ()

-- method OptionContext::get_description
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_get_description" g_option_context_get_description :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    IO CString


optionContextGetDescription ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    m T.Text
optionContextGetDescription _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_option_context_get_description _obj'
    checkUnexpectedReturnNULL "g_option_context_get_description" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method OptionContext::get_help
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "main_help", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TInterface "GLib" "OptionGroup", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "main_help", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TInterface "GLib" "OptionGroup", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_get_help" g_option_context_get_help :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    CInt ->                                 -- main_help : TBasicType TBoolean
    Ptr OptionGroup ->                      -- group : TInterface "GLib" "OptionGroup"
    IO CString


optionContextGetHelp ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    Bool ->                                 -- main_help
    Maybe (OptionGroup) ->                  -- group
    m T.Text
optionContextGetHelp _obj main_help group = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let main_help' = (fromIntegral . fromEnum) main_help
    maybeGroup <- case group of
        Nothing -> return nullPtr
        Just jGroup -> do
            let jGroup' = unsafeManagedPtrGetPtr jGroup
            return jGroup'
    result <- g_option_context_get_help _obj' main_help' maybeGroup
    checkUnexpectedReturnNULL "g_option_context_get_help" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    whenJust group touchManagedPtr
    return result'

-- method OptionContext::get_help_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_get_help_enabled" g_option_context_get_help_enabled :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    IO CInt


optionContextGetHelpEnabled ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    m Bool
optionContextGetHelpEnabled _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_option_context_get_help_enabled _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method OptionContext::get_ignore_unknown_options
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_get_ignore_unknown_options" g_option_context_get_ignore_unknown_options :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    IO CInt


optionContextGetIgnoreUnknownOptions ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    m Bool
optionContextGetIgnoreUnknownOptions _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_option_context_get_ignore_unknown_options _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method OptionContext::get_main_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "OptionGroup"
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_get_main_group" g_option_context_get_main_group :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    IO (Ptr OptionGroup)


optionContextGetMainGroup ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    m OptionGroup
optionContextGetMainGroup _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_option_context_get_main_group _obj'
    checkUnexpectedReturnNULL "g_option_context_get_main_group" result
    result' <- (newBoxed OptionGroup) result
    touchManagedPtr _obj
    return result'

-- method OptionContext::get_strict_posix
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_get_strict_posix" g_option_context_get_strict_posix :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    IO CInt


optionContextGetStrictPosix ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    m Bool
optionContextGetStrictPosix _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_option_context_get_strict_posix _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method OptionContext::get_summary
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_get_summary" g_option_context_get_summary :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    IO CString


optionContextGetSummary ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    m T.Text
optionContextGetSummary _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_option_context_get_summary _obj'
    checkUnexpectedReturnNULL "g_option_context_get_summary" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- XXX Could not generate method OptionContext::parse
-- Error was : Bad introspection data: "argument \"argc\" is not of nullable type (TBasicType TInt32), but it is marked as such."
-- method OptionContext::parse_strv
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "arguments", argType = TCArray False (-1) (-1) (TBasicType TUTF8), direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "arguments", argType = TCArray False (-1) (-1) (TBasicType TUTF8), direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_option_context_parse_strv" g_option_context_parse_strv :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    Ptr (Ptr CString) ->                    -- arguments : TCArray False (-1) (-1) (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO CInt


optionContextParseStrv ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    Ptr CString ->                          -- arguments
    m ((Ptr CString))
optionContextParseStrv _obj arguments = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    arguments' <- allocMem :: IO (Ptr (Ptr CString))
    poke arguments' arguments
    onException (do
        _ <- propagateGError $ g_option_context_parse_strv _obj' arguments'
        arguments'' <- peek arguments'
        touchManagedPtr _obj
        freeMem arguments'
        return arguments''
     ) (do
        freeMem arguments'
     )

-- method OptionContext::set_description
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_set_description" g_option_context_set_description :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    CString ->                              -- description : TBasicType TUTF8
    IO ()


optionContextSetDescription ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    Maybe (T.Text) ->                       -- description
    m ()
optionContextSetDescription _obj description = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    maybeDescription <- case description of
        Nothing -> return nullPtr
        Just jDescription -> do
            jDescription' <- textToCString jDescription
            return jDescription'
    g_option_context_set_description _obj' maybeDescription
    touchManagedPtr _obj
    freeMem maybeDescription
    return ()

-- method OptionContext::set_help_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "help_enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "help_enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_set_help_enabled" g_option_context_set_help_enabled :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    CInt ->                                 -- help_enabled : TBasicType TBoolean
    IO ()


optionContextSetHelpEnabled ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    Bool ->                                 -- help_enabled
    m ()
optionContextSetHelpEnabled _obj help_enabled = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let help_enabled' = (fromIntegral . fromEnum) help_enabled
    g_option_context_set_help_enabled _obj' help_enabled'
    touchManagedPtr _obj
    return ()

-- method OptionContext::set_ignore_unknown_options
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ignore_unknown", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ignore_unknown", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_set_ignore_unknown_options" g_option_context_set_ignore_unknown_options :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    CInt ->                                 -- ignore_unknown : TBasicType TBoolean
    IO ()


optionContextSetIgnoreUnknownOptions ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    Bool ->                                 -- ignore_unknown
    m ()
optionContextSetIgnoreUnknownOptions _obj ignore_unknown = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let ignore_unknown' = (fromIntegral . fromEnum) ignore_unknown
    g_option_context_set_ignore_unknown_options _obj' ignore_unknown'
    touchManagedPtr _obj
    return ()

-- method OptionContext::set_main_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TInterface "GLib" "OptionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TInterface "GLib" "OptionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_set_main_group" g_option_context_set_main_group :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    Ptr OptionGroup ->                      -- group : TInterface "GLib" "OptionGroup"
    IO ()


optionContextSetMainGroup ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    OptionGroup ->                          -- group
    m ()
optionContextSetMainGroup _obj group = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    group' <- copyBoxed group
    g_option_context_set_main_group _obj' group'
    touchManagedPtr _obj
    touchManagedPtr group
    return ()

-- method OptionContext::set_strict_posix
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "strict_posix", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "strict_posix", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_set_strict_posix" g_option_context_set_strict_posix :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    CInt ->                                 -- strict_posix : TBasicType TBoolean
    IO ()


optionContextSetStrictPosix ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    Bool ->                                 -- strict_posix
    m ()
optionContextSetStrictPosix _obj strict_posix = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let strict_posix' = (fromIntegral . fromEnum) strict_posix
    g_option_context_set_strict_posix _obj' strict_posix'
    touchManagedPtr _obj
    return ()

-- method OptionContext::set_summary
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "summary", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "summary", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_set_summary" g_option_context_set_summary :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    CString ->                              -- summary : TBasicType TUTF8
    IO ()


optionContextSetSummary ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    Maybe (T.Text) ->                       -- summary
    m ()
optionContextSetSummary _obj summary = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    maybeSummary <- case summary of
        Nothing -> return nullPtr
        Just jSummary -> do
            jSummary' <- textToCString jSummary
            return jSummary'
    g_option_context_set_summary _obj' maybeSummary
    touchManagedPtr _obj
    freeMem maybeSummary
    return ()

-- method OptionContext::set_translate_func
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "GLib" "TranslateFunc", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destroy_notify", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "GLib" "TranslateFunc", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_set_translate_func" g_option_context_set_translate_func :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    FunPtr TranslateFuncC ->                -- func : TInterface "GLib" "TranslateFunc"
    Ptr () ->                               -- data : TBasicType TVoid
    FunPtr DestroyNotifyC ->                -- destroy_notify : TInterface "GLib" "DestroyNotify"
    IO ()


optionContextSetTranslateFunc ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    Maybe (TranslateFunc) ->                -- func
    m ()
optionContextSetTranslateFunc _obj func = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    maybeFunc <- case func of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jFunc -> do
            jFunc' <- mkTranslateFunc (translateFuncWrapper Nothing jFunc)
            return jFunc'
    let data_ = castFunPtrToPtr maybeFunc
    let destroy_notify = safeFreeFunPtrPtr
    g_option_context_set_translate_func _obj' maybeFunc data_ destroy_notify
    touchManagedPtr _obj
    return ()

-- method OptionContext::set_translation_domain
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_option_context_set_translation_domain" g_option_context_set_translation_domain :: 
    Ptr OptionContext ->                    -- _obj : TInterface "GLib" "OptionContext"
    CString ->                              -- domain : TBasicType TUTF8
    IO ()


optionContextSetTranslationDomain ::
    (MonadIO m) =>
    OptionContext ->                        -- _obj
    T.Text ->                               -- domain
    m ()
optionContextSetTranslationDomain _obj domain = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    domain' <- textToCString domain
    g_option_context_set_translation_domain _obj' domain'
    touchManagedPtr _obj
    freeMem domain'
    return ()