{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) This is an opaque structure type. You may not access it directly. -} module GI.Gio.Structs.SettingsSchemaSource ( -- * Exported types SettingsSchemaSource(..) , noSettingsSchemaSource , -- * Methods -- ** settingsSchemaSourceListSchemas settingsSchemaSourceListSchemas , -- ** settingsSchemaSourceLookup settingsSchemaSourceLookup , -- ** settingsSchemaSourceNewFromDirectory settingsSchemaSourceNewFromDirectory , -- ** settingsSchemaSourceRef settingsSchemaSourceRef , -- ** settingsSchemaSourceUnref settingsSchemaSourceUnref , ) 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.Gio.Types import GI.Gio.Callbacks newtype SettingsSchemaSource = SettingsSchemaSource (ForeignPtr SettingsSchemaSource) foreign import ccall "g_settings_schema_source_get_type" c_g_settings_schema_source_get_type :: IO GType instance BoxedObject SettingsSchemaSource where boxedType _ = c_g_settings_schema_source_get_type noSettingsSchemaSource :: Maybe SettingsSchemaSource noSettingsSchemaSource = Nothing -- method SettingsSchemaSource::new_from_directory -- method type : Constructor -- Args : [Arg {argName = "directory", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parent", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "trusted", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "directory", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parent", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "trusted", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "SettingsSchemaSource" -- throws : True -- Skip return : False foreign import ccall "g_settings_schema_source_new_from_directory" g_settings_schema_source_new_from_directory :: CString -> -- directory : TBasicType TUTF8 Ptr SettingsSchemaSource -> -- parent : TInterface "Gio" "SettingsSchemaSource" CInt -> -- trusted : TBasicType TBoolean Ptr (Ptr GError) -> -- error IO (Ptr SettingsSchemaSource) settingsSchemaSourceNewFromDirectory :: (MonadIO m) => T.Text -> -- directory Maybe (SettingsSchemaSource) -> -- parent Bool -> -- trusted m SettingsSchemaSource settingsSchemaSourceNewFromDirectory directory parent trusted = liftIO $ do directory' <- textToCString directory maybeParent <- case parent of Nothing -> return nullPtr Just jParent -> do let jParent' = unsafeManagedPtrGetPtr jParent return jParent' let trusted' = (fromIntegral . fromEnum) trusted onException (do result <- propagateGError $ g_settings_schema_source_new_from_directory directory' maybeParent trusted' checkUnexpectedReturnNULL "g_settings_schema_source_new_from_directory" result result' <- (wrapBoxed SettingsSchemaSource) result whenJust parent touchManagedPtr freeMem directory' return result' ) (do freeMem directory' ) -- method SettingsSchemaSource::list_schemas -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "recursive", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "non_relocatable", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "relocatable", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "recursive", 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_settings_schema_source_list_schemas" g_settings_schema_source_list_schemas :: Ptr SettingsSchemaSource -> -- _obj : TInterface "Gio" "SettingsSchemaSource" CInt -> -- recursive : TBasicType TBoolean Ptr (Ptr CString) -> -- non_relocatable : TCArray True (-1) (-1) (TBasicType TUTF8) Ptr (Ptr CString) -> -- relocatable : TCArray True (-1) (-1) (TBasicType TUTF8) IO () settingsSchemaSourceListSchemas :: (MonadIO m) => SettingsSchemaSource -> -- _obj Bool -> -- recursive m ([T.Text],[T.Text]) settingsSchemaSourceListSchemas _obj recursive = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let recursive' = (fromIntegral . fromEnum) recursive non_relocatable <- allocMem :: IO (Ptr (Ptr CString)) relocatable <- allocMem :: IO (Ptr (Ptr CString)) g_settings_schema_source_list_schemas _obj' recursive' non_relocatable relocatable non_relocatable' <- peek non_relocatable non_relocatable'' <- unpackZeroTerminatedUTF8CArray non_relocatable' mapZeroTerminatedCArray freeMem non_relocatable' freeMem non_relocatable' relocatable' <- peek relocatable relocatable'' <- unpackZeroTerminatedUTF8CArray relocatable' mapZeroTerminatedCArray freeMem relocatable' freeMem relocatable' touchManagedPtr _obj freeMem non_relocatable freeMem relocatable return (non_relocatable'', relocatable'') -- method SettingsSchemaSource::lookup -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "schema_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "recursive", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "schema_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "recursive", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "SettingsSchema" -- throws : False -- Skip return : False foreign import ccall "g_settings_schema_source_lookup" g_settings_schema_source_lookup :: Ptr SettingsSchemaSource -> -- _obj : TInterface "Gio" "SettingsSchemaSource" CString -> -- schema_id : TBasicType TUTF8 CInt -> -- recursive : TBasicType TBoolean IO (Ptr SettingsSchema) settingsSchemaSourceLookup :: (MonadIO m) => SettingsSchemaSource -> -- _obj T.Text -> -- schema_id Bool -> -- recursive m SettingsSchema settingsSchemaSourceLookup _obj schema_id recursive = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj schema_id' <- textToCString schema_id let recursive' = (fromIntegral . fromEnum) recursive result <- g_settings_schema_source_lookup _obj' schema_id' recursive' checkUnexpectedReturnNULL "g_settings_schema_source_lookup" result result' <- (wrapBoxed SettingsSchema) result touchManagedPtr _obj freeMem schema_id' return result' -- method SettingsSchemaSource::ref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "SettingsSchemaSource" -- throws : False -- Skip return : False foreign import ccall "g_settings_schema_source_ref" g_settings_schema_source_ref :: Ptr SettingsSchemaSource -> -- _obj : TInterface "Gio" "SettingsSchemaSource" IO (Ptr SettingsSchemaSource) settingsSchemaSourceRef :: (MonadIO m) => SettingsSchemaSource -> -- _obj m SettingsSchemaSource settingsSchemaSourceRef _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_settings_schema_source_ref _obj' checkUnexpectedReturnNULL "g_settings_schema_source_ref" result result' <- (wrapBoxed SettingsSchemaSource) result touchManagedPtr _obj return result' -- method SettingsSchemaSource::unref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SettingsSchemaSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_settings_schema_source_unref" g_settings_schema_source_unref :: Ptr SettingsSchemaSource -> -- _obj : TInterface "Gio" "SettingsSchemaSource" IO () settingsSchemaSourceUnref :: (MonadIO m) => SettingsSchemaSource -> -- _obj m () settingsSchemaSourceUnref _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_settings_schema_source_unref _obj' touchManagedPtr _obj return ()