{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Gio.Objects.Credentials ( -- * Exported types Credentials(..) , CredentialsK , toCredentials , noCredentials , -- * Methods -- ** credentialsGetUnixPid credentialsGetUnixPid , -- ** credentialsGetUnixUser credentialsGetUnixUser , -- ** credentialsIsSameUser credentialsIsSameUser , -- ** credentialsNew credentialsNew , -- ** credentialsSetNative credentialsSetNative , -- ** credentialsSetUnixUser credentialsSetUnixUser , -- ** credentialsToString credentialsToString , ) 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 import qualified GI.GObject as GObject newtype Credentials = Credentials (ForeignPtr Credentials) foreign import ccall "g_credentials_get_type" c_g_credentials_get_type :: IO GType type instance ParentTypes Credentials = CredentialsParentTypes type CredentialsParentTypes = '[GObject.Object] instance GObject Credentials where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_g_credentials_get_type class GObject o => CredentialsK o instance (GObject o, IsDescendantOf Credentials o) => CredentialsK o toCredentials :: CredentialsK o => o -> IO Credentials toCredentials = unsafeCastTo Credentials noCredentials :: Maybe Credentials noCredentials = Nothing type instance AttributeList Credentials = CredentialsAttributeList type CredentialsAttributeList = ('[ ] :: [(Symbol, *)]) type instance SignalList Credentials = CredentialsSignalList type CredentialsSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method Credentials::new -- method type : Constructor -- Args : [] -- Lengths : [] -- hInArgs : [] -- returnType : TInterface "Gio" "Credentials" -- throws : False -- Skip return : False foreign import ccall "g_credentials_new" g_credentials_new :: IO (Ptr Credentials) credentialsNew :: (MonadIO m) => m Credentials credentialsNew = liftIO $ do result <- g_credentials_new checkUnexpectedReturnNULL "g_credentials_new" result result' <- (wrapObject Credentials) result return result' -- method Credentials::get_unix_pid -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : True -- Skip return : False foreign import ccall "g_credentials_get_unix_pid" g_credentials_get_unix_pid :: Ptr Credentials -> -- _obj : TInterface "Gio" "Credentials" Ptr (Ptr GError) -> -- error IO Int32 credentialsGetUnixPid :: (MonadIO m, CredentialsK a) => a -> -- _obj m Int32 credentialsGetUnixPid _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj onException (do result <- propagateGError $ g_credentials_get_unix_pid _obj' touchManagedPtr _obj return result ) (do return () ) -- method Credentials::get_unix_user -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUInt32 -- throws : True -- Skip return : False foreign import ccall "g_credentials_get_unix_user" g_credentials_get_unix_user :: Ptr Credentials -> -- _obj : TInterface "Gio" "Credentials" Ptr (Ptr GError) -> -- error IO Word32 credentialsGetUnixUser :: (MonadIO m, CredentialsK a) => a -> -- _obj m Word32 credentialsGetUnixUser _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj onException (do result <- propagateGError $ g_credentials_get_unix_user _obj' touchManagedPtr _obj return result ) (do return () ) -- method Credentials::is_same_user -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "other_credentials", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "other_credentials", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_credentials_is_same_user" g_credentials_is_same_user :: Ptr Credentials -> -- _obj : TInterface "Gio" "Credentials" Ptr Credentials -> -- other_credentials : TInterface "Gio" "Credentials" Ptr (Ptr GError) -> -- error IO CInt credentialsIsSameUser :: (MonadIO m, CredentialsK a, CredentialsK b) => a -> -- _obj b -> -- other_credentials m () credentialsIsSameUser _obj other_credentials = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let other_credentials' = unsafeManagedPtrCastPtr other_credentials onException (do _ <- propagateGError $ g_credentials_is_same_user _obj' other_credentials' touchManagedPtr _obj touchManagedPtr other_credentials return () ) (do return () ) -- method Credentials::set_native -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "native_type", argType = TInterface "Gio" "CredentialsType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "native", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "native_type", argType = TInterface "Gio" "CredentialsType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "native", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_credentials_set_native" g_credentials_set_native :: Ptr Credentials -> -- _obj : TInterface "Gio" "Credentials" CUInt -> -- native_type : TInterface "Gio" "CredentialsType" Ptr () -> -- native : TBasicType TVoid IO () credentialsSetNative :: (MonadIO m, CredentialsK a) => a -> -- _obj CredentialsType -> -- native_type Ptr () -> -- native m () credentialsSetNative _obj native_type native = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let native_type' = (fromIntegral . fromEnum) native_type g_credentials_set_native _obj' native_type' native touchManagedPtr _obj return () -- method Credentials::set_unix_user -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uid", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uid", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_credentials_set_unix_user" g_credentials_set_unix_user :: Ptr Credentials -> -- _obj : TInterface "Gio" "Credentials" Word32 -> -- uid : TBasicType TUInt32 Ptr (Ptr GError) -> -- error IO CInt credentialsSetUnixUser :: (MonadIO m, CredentialsK a) => a -> -- _obj Word32 -> -- uid m () credentialsSetUnixUser _obj uid = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj onException (do _ <- propagateGError $ g_credentials_set_unix_user _obj' uid touchManagedPtr _obj return () ) (do return () ) -- method Credentials::to_string -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Credentials", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "g_credentials_to_string" g_credentials_to_string :: Ptr Credentials -> -- _obj : TInterface "Gio" "Credentials" IO CString credentialsToString :: (MonadIO m, CredentialsK a) => a -> -- _obj m T.Text credentialsToString _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_credentials_to_string _obj' checkUnexpectedReturnNULL "g_credentials_to_string" result result' <- cstringToText result freeMem result touchManagedPtr _obj return result'