{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.Credentials
(
Credentials(..) ,
IsCredentials ,
toCredentials ,
#if defined(ENABLE_OVERLOADING)
ResolveCredentialsMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
CredentialsGetUnixPidMethodInfo ,
#endif
credentialsGetUnixPid ,
#if defined(ENABLE_OVERLOADING)
CredentialsGetUnixUserMethodInfo ,
#endif
credentialsGetUnixUser ,
#if defined(ENABLE_OVERLOADING)
CredentialsIsSameUserMethodInfo ,
#endif
credentialsIsSameUser ,
credentialsNew ,
#if defined(ENABLE_OVERLOADING)
CredentialsSetNativeMethodInfo ,
#endif
credentialsSetNative ,
#if defined(ENABLE_OVERLOADING)
CredentialsSetUnixUserMethodInfo ,
#endif
credentialsSetUnixUser ,
#if defined(ENABLE_OVERLOADING)
CredentialsToStringMethodInfo ,
#endif
credentialsToString ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
#endif
newtype Credentials = Credentials (SP.ManagedPtr Credentials)
deriving (Credentials -> Credentials -> Bool
(Credentials -> Credentials -> Bool)
-> (Credentials -> Credentials -> Bool) -> Eq Credentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Credentials -> Credentials -> Bool
== :: Credentials -> Credentials -> Bool
$c/= :: Credentials -> Credentials -> Bool
/= :: Credentials -> Credentials -> Bool
Eq)
instance SP.ManagedPtrNewtype Credentials where
toManagedPtr :: Credentials -> ManagedPtr Credentials
toManagedPtr (Credentials ManagedPtr Credentials
p) = ManagedPtr Credentials
p
foreign import ccall "g_credentials_get_type"
c_g_credentials_get_type :: IO B.Types.GType
instance B.Types.TypedObject Credentials where
glibType :: IO GType
glibType = IO GType
c_g_credentials_get_type
instance B.Types.GObject Credentials
class (SP.GObject o, O.IsDescendantOf Credentials o) => IsCredentials o
instance (SP.GObject o, O.IsDescendantOf Credentials o) => IsCredentials o
instance O.HasParentTypes Credentials
type instance O.ParentTypes Credentials = '[GObject.Object.Object]
toCredentials :: (MIO.MonadIO m, IsCredentials o) => o -> m Credentials
toCredentials :: forall (m :: * -> *) o.
(MonadIO m, IsCredentials o) =>
o -> m Credentials
toCredentials = IO Credentials -> m Credentials
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Credentials -> m Credentials)
-> (o -> IO Credentials) -> o -> m Credentials
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Credentials -> Credentials) -> o -> IO Credentials
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Credentials -> Credentials
Credentials
instance B.GValue.IsGValue (Maybe Credentials) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_credentials_get_type
gvalueSet_ :: Ptr GValue -> Maybe Credentials -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Credentials
P.Nothing = Ptr GValue -> Ptr Credentials -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Credentials
forall a. Ptr a
FP.nullPtr :: FP.Ptr Credentials)
gvalueSet_ Ptr GValue
gv (P.Just Credentials
obj) = Credentials -> (Ptr Credentials -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Credentials
obj (Ptr GValue -> Ptr Credentials -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Credentials)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr Credentials)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Credentials)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject Credentials ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveCredentialsMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveCredentialsMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveCredentialsMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveCredentialsMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveCredentialsMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveCredentialsMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveCredentialsMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveCredentialsMethod "isSameUser" o = CredentialsIsSameUserMethodInfo
ResolveCredentialsMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveCredentialsMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveCredentialsMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveCredentialsMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveCredentialsMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveCredentialsMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveCredentialsMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveCredentialsMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveCredentialsMethod "toString" o = CredentialsToStringMethodInfo
ResolveCredentialsMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveCredentialsMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveCredentialsMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveCredentialsMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveCredentialsMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveCredentialsMethod "getUnixPid" o = CredentialsGetUnixPidMethodInfo
ResolveCredentialsMethod "getUnixUser" o = CredentialsGetUnixUserMethodInfo
ResolveCredentialsMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveCredentialsMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveCredentialsMethod "setNative" o = CredentialsSetNativeMethodInfo
ResolveCredentialsMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveCredentialsMethod "setUnixUser" o = CredentialsSetUnixUserMethodInfo
ResolveCredentialsMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCredentialsMethod t Credentials, O.OverloadedMethod info Credentials p) => OL.IsLabel t (Credentials -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveCredentialsMethod t Credentials, O.OverloadedMethod info Credentials p, R.HasField t Credentials p) => R.HasField t Credentials p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveCredentialsMethod t Credentials, O.OverloadedMethodInfo info Credentials) => OL.IsLabel t (O.MethodProxy info Credentials) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Credentials
type instance O.AttributeList Credentials = CredentialsAttributeList
type CredentialsAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Credentials = CredentialsSignalList
type CredentialsSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_credentials_new" g_credentials_new ::
IO (Ptr Credentials)
credentialsNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Credentials
credentialsNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Credentials
credentialsNew = IO Credentials -> m Credentials
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credentials -> m Credentials)
-> IO Credentials -> m Credentials
forall a b. (a -> b) -> a -> b
$ do
result <- IO (Ptr Credentials)
g_credentials_new
checkUnexpectedReturnNULL "credentialsNew" result
result' <- (wrapObject Credentials) result
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_credentials_get_unix_pid" g_credentials_get_unix_pid ::
Ptr Credentials ->
Ptr (Ptr GError) ->
IO Int32
credentialsGetUnixPid ::
(B.CallStack.HasCallStack, MonadIO m, IsCredentials a) =>
a
-> m Int32
credentialsGetUnixPid :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCredentials a) =>
a -> m Int32
credentialsGetUnixPid a
credentials = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
credentials' <- a -> IO (Ptr Credentials)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
credentials
onException (do
result <- propagateGError $ g_credentials_get_unix_pid credentials'
touchManagedPtr credentials
return result
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data CredentialsGetUnixPidMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsCredentials a) => O.OverloadedMethod CredentialsGetUnixPidMethodInfo a signature where
overloadedMethod = credentialsGetUnixPid
instance O.OverloadedMethodInfo CredentialsGetUnixPidMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Credentials.credentialsGetUnixPid",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Credentials.html#v:credentialsGetUnixPid"
})
#endif
foreign import ccall "g_credentials_get_unix_user" g_credentials_get_unix_user ::
Ptr Credentials ->
Ptr (Ptr GError) ->
IO Word32
credentialsGetUnixUser ::
(B.CallStack.HasCallStack, MonadIO m, IsCredentials a) =>
a
-> m Word32
credentialsGetUnixUser :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCredentials a) =>
a -> m Word32
credentialsGetUnixUser a
credentials = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
credentials' <- a -> IO (Ptr Credentials)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
credentials
onException (do
result <- propagateGError $ g_credentials_get_unix_user credentials'
touchManagedPtr credentials
return result
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data CredentialsGetUnixUserMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsCredentials a) => O.OverloadedMethod CredentialsGetUnixUserMethodInfo a signature where
overloadedMethod = credentialsGetUnixUser
instance O.OverloadedMethodInfo CredentialsGetUnixUserMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Credentials.credentialsGetUnixUser",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Credentials.html#v:credentialsGetUnixUser"
})
#endif
foreign import ccall "g_credentials_is_same_user" g_credentials_is_same_user ::
Ptr Credentials ->
Ptr Credentials ->
Ptr (Ptr GError) ->
IO CInt
credentialsIsSameUser ::
(B.CallStack.HasCallStack, MonadIO m, IsCredentials a, IsCredentials b) =>
a
-> b
-> m ()
credentialsIsSameUser :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsCredentials a, IsCredentials b) =>
a -> b -> m ()
credentialsIsSameUser a
credentials b
otherCredentials = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
credentials' <- a -> IO (Ptr Credentials)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
credentials
otherCredentials' <- unsafeManagedPtrCastPtr otherCredentials
onException (do
_ <- propagateGError $ g_credentials_is_same_user credentials' otherCredentials'
touchManagedPtr credentials
touchManagedPtr otherCredentials
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data CredentialsIsSameUserMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsCredentials a, IsCredentials b) => O.OverloadedMethod CredentialsIsSameUserMethodInfo a signature where
overloadedMethod = credentialsIsSameUser
instance O.OverloadedMethodInfo CredentialsIsSameUserMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Credentials.credentialsIsSameUser",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Credentials.html#v:credentialsIsSameUser"
})
#endif
foreign import ccall "g_credentials_set_native" g_credentials_set_native ::
Ptr Credentials ->
CUInt ->
Ptr () ->
IO ()
credentialsSetNative ::
(B.CallStack.HasCallStack, MonadIO m, IsCredentials a) =>
a
-> Gio.Enums.CredentialsType
-> Ptr ()
-> m ()
credentialsSetNative :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCredentials a) =>
a -> CredentialsType -> Ptr () -> m ()
credentialsSetNative a
credentials CredentialsType
nativeType Ptr ()
native = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
credentials' <- a -> IO (Ptr Credentials)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
credentials
let nativeType' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt)
-> (CredentialsType -> Int) -> CredentialsType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CredentialsType -> Int
forall a. Enum a => a -> Int
fromEnum) CredentialsType
nativeType
g_credentials_set_native credentials' nativeType' native
touchManagedPtr credentials
return ()
#if defined(ENABLE_OVERLOADING)
data CredentialsSetNativeMethodInfo
instance (signature ~ (Gio.Enums.CredentialsType -> Ptr () -> m ()), MonadIO m, IsCredentials a) => O.OverloadedMethod CredentialsSetNativeMethodInfo a signature where
overloadedMethod = credentialsSetNative
instance O.OverloadedMethodInfo CredentialsSetNativeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Credentials.credentialsSetNative",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Credentials.html#v:credentialsSetNative"
})
#endif
foreign import ccall "g_credentials_set_unix_user" g_credentials_set_unix_user ::
Ptr Credentials ->
Word32 ->
Ptr (Ptr GError) ->
IO CInt
credentialsSetUnixUser ::
(B.CallStack.HasCallStack, MonadIO m, IsCredentials a) =>
a
-> Word32
-> m ()
credentialsSetUnixUser :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCredentials a) =>
a -> Word32 -> m ()
credentialsSetUnixUser a
credentials Word32
uid = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
credentials' <- a -> IO (Ptr Credentials)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
credentials
onException (do
_ <- propagateGError $ g_credentials_set_unix_user credentials' uid
touchManagedPtr credentials
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data CredentialsSetUnixUserMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsCredentials a) => O.OverloadedMethod CredentialsSetUnixUserMethodInfo a signature where
overloadedMethod = credentialsSetUnixUser
instance O.OverloadedMethodInfo CredentialsSetUnixUserMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Credentials.credentialsSetUnixUser",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Credentials.html#v:credentialsSetUnixUser"
})
#endif
foreign import ccall "g_credentials_to_string" g_credentials_to_string ::
Ptr Credentials ->
IO CString
credentialsToString ::
(B.CallStack.HasCallStack, MonadIO m, IsCredentials a) =>
a
-> m T.Text
credentialsToString :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCredentials a) =>
a -> m Text
credentialsToString a
credentials = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
credentials' <- a -> IO (Ptr Credentials)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
credentials
result <- g_credentials_to_string credentials'
checkUnexpectedReturnNULL "credentialsToString" result
result' <- cstringToText result
freeMem result
touchManagedPtr credentials
return result'
#if defined(ENABLE_OVERLOADING)
data CredentialsToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsCredentials a) => O.OverloadedMethod CredentialsToStringMethodInfo a signature where
overloadedMethod = credentialsToString
instance O.OverloadedMethodInfo CredentialsToStringMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Credentials.credentialsToString",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Credentials.html#v:credentialsToString"
})
#endif