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

Holds a password used in TLS.

/Since: 2.30/
-}

#define ENABLE_OVERLOADING \
       (!defined(__HADDOCK_VERSION__))

module GI.Gio.Objects.TlsPassword
    ( 

-- * Exported types
    TlsPassword(..)                         ,
    IsTlsPassword                           ,
    toTlsPassword                           ,
    noTlsPassword                           ,


 -- * Methods
-- ** getDescription #method:getDescription#

#if ENABLE_OVERLOADING
    TlsPasswordGetDescriptionMethodInfo     ,
#endif
    tlsPasswordGetDescription               ,


-- ** getFlags #method:getFlags#

#if ENABLE_OVERLOADING
    TlsPasswordGetFlagsMethodInfo           ,
#endif
    tlsPasswordGetFlags                     ,


-- ** getWarning #method:getWarning#

#if ENABLE_OVERLOADING
    TlsPasswordGetWarningMethodInfo         ,
#endif
    tlsPasswordGetWarning                   ,


-- ** new #method:new#

    tlsPasswordNew                          ,


-- ** setDescription #method:setDescription#

#if ENABLE_OVERLOADING
    TlsPasswordSetDescriptionMethodInfo     ,
#endif
    tlsPasswordSetDescription               ,


-- ** setFlags #method:setFlags#

#if ENABLE_OVERLOADING
    TlsPasswordSetFlagsMethodInfo           ,
#endif
    tlsPasswordSetFlags                     ,


-- ** setValue #method:setValue#

#if ENABLE_OVERLOADING
    TlsPasswordSetValueMethodInfo           ,
#endif
    tlsPasswordSetValue                     ,


-- ** setValueFull #method:setValueFull#

#if ENABLE_OVERLOADING
    TlsPasswordSetValueFullMethodInfo       ,
#endif
    tlsPasswordSetValueFull                 ,


-- ** setWarning #method:setWarning#

#if ENABLE_OVERLOADING
    TlsPasswordSetWarningMethodInfo         ,
#endif
    tlsPasswordSetWarning                   ,




 -- * Properties
-- ** description #attr:description#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    TlsPasswordDescriptionPropertyInfo      ,
#endif
    constructTlsPasswordDescription         ,
    getTlsPasswordDescription               ,
    setTlsPasswordDescription               ,
#if ENABLE_OVERLOADING
    tlsPasswordDescription                  ,
#endif


-- ** flags #attr:flags#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    TlsPasswordFlagsPropertyInfo            ,
#endif
    constructTlsPasswordFlags               ,
    getTlsPasswordFlags                     ,
    setTlsPasswordFlags                     ,
#if ENABLE_OVERLOADING
    tlsPasswordFlags                        ,
#endif


-- ** warning #attr:warning#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    TlsPasswordWarningPropertyInfo          ,
#endif
    constructTlsPasswordWarning             ,
    getTlsPasswordWarning                   ,
    setTlsPasswordWarning                   ,
#if ENABLE_OVERLOADING
    tlsPasswordWarning                      ,
#endif




    ) 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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags

-- | Memory-managed wrapper type.
newtype TlsPassword = TlsPassword (ManagedPtr TlsPassword)
foreign import ccall "g_tls_password_get_type"
    c_g_tls_password_get_type :: IO GType

instance GObject TlsPassword where
    gobjectType :: TlsPassword -> IO GType
gobjectType _ = IO GType
c_g_tls_password_get_type
    

-- | Type class for types which can be safely cast to `TlsPassword`, for instance with `toTlsPassword`.
class GObject o => IsTlsPassword o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError TlsPassword a) =>
    IsTlsPassword a
#endif
instance IsTlsPassword TlsPassword
instance GObject.Object.IsObject TlsPassword

-- | Cast to `TlsPassword`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toTlsPassword :: (MonadIO m, IsTlsPassword o) => o -> m TlsPassword
toTlsPassword :: o -> m TlsPassword
toTlsPassword = IO TlsPassword -> m TlsPassword
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TlsPassword -> m TlsPassword)
-> (o -> IO TlsPassword) -> o -> m TlsPassword
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr TlsPassword -> TlsPassword) -> o -> IO TlsPassword
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr TlsPassword -> TlsPassword
TlsPassword

-- | A convenience alias for `Nothing` :: `Maybe` `TlsPassword`.
noTlsPassword :: Maybe TlsPassword
noTlsPassword :: Maybe TlsPassword
noTlsPassword = Maybe TlsPassword
forall a. Maybe a
Nothing

#if ENABLE_OVERLOADING
type family ResolveTlsPasswordMethod (t :: Symbol) (o :: *) :: * where
    ResolveTlsPasswordMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveTlsPasswordMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveTlsPasswordMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveTlsPasswordMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveTlsPasswordMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveTlsPasswordMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveTlsPasswordMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveTlsPasswordMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveTlsPasswordMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveTlsPasswordMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveTlsPasswordMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveTlsPasswordMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveTlsPasswordMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveTlsPasswordMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveTlsPasswordMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveTlsPasswordMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveTlsPasswordMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveTlsPasswordMethod "getDescription" o = TlsPasswordGetDescriptionMethodInfo
    ResolveTlsPasswordMethod "getFlags" o = TlsPasswordGetFlagsMethodInfo
    ResolveTlsPasswordMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveTlsPasswordMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveTlsPasswordMethod "getWarning" o = TlsPasswordGetWarningMethodInfo
    ResolveTlsPasswordMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveTlsPasswordMethod "setDescription" o = TlsPasswordSetDescriptionMethodInfo
    ResolveTlsPasswordMethod "setFlags" o = TlsPasswordSetFlagsMethodInfo
    ResolveTlsPasswordMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveTlsPasswordMethod "setValue" o = TlsPasswordSetValueMethodInfo
    ResolveTlsPasswordMethod "setValueFull" o = TlsPasswordSetValueFullMethodInfo
    ResolveTlsPasswordMethod "setWarning" o = TlsPasswordSetWarningMethodInfo
    ResolveTlsPasswordMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveTlsPasswordMethod t TlsPassword, O.MethodInfo info TlsPassword p) => O.IsLabelProxy t (TlsPassword -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTlsPasswordMethod t TlsPassword, O.MethodInfo info TlsPassword p) => O.IsLabel t (TlsPassword -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- VVV Prop "description"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

{- |
Get the value of the “@description@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' tlsPassword #description
@
-}
getTlsPasswordDescription :: (MonadIO m, IsTlsPassword o) => o -> m T.Text
getTlsPasswordDescription :: o -> m Text
getTlsPasswordDescription obj :: o
obj = IO Text -> m Text
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
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing "getTlsPasswordDescription" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
getObjectPropertyString o
obj "description"

{- |
Set the value of the “@description@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' tlsPassword [ #description 'Data.GI.Base.Attributes.:=' value ]
@
-}
setTlsPasswordDescription :: (MonadIO m, IsTlsPassword o) => o -> T.Text -> m ()
setTlsPasswordDescription :: o -> Text -> m ()
setTlsPasswordDescription obj :: o
obj val :: Text
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> IO ()
forall a. GObject a => a -> String -> Maybe Text -> IO ()
setObjectPropertyString o
obj "description" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

{- |
Construct a `GValueConstruct` with valid value for the “@description@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructTlsPasswordDescription :: (IsTlsPassword o) => T.Text -> IO (GValueConstruct o)
constructTlsPasswordDescription :: Text -> IO (GValueConstruct o)
constructTlsPasswordDescription val :: Text
val = String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
constructObjectPropertyString "description" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

#if ENABLE_OVERLOADING
data TlsPasswordDescriptionPropertyInfo
instance AttrInfo TlsPasswordDescriptionPropertyInfo where
    type AttrAllowedOps TlsPasswordDescriptionPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint TlsPasswordDescriptionPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint TlsPasswordDescriptionPropertyInfo = IsTlsPassword
    type AttrGetType TlsPasswordDescriptionPropertyInfo = T.Text
    type AttrLabel TlsPasswordDescriptionPropertyInfo = "description"
    type AttrOrigin TlsPasswordDescriptionPropertyInfo = TlsPassword
    attrGet _ = getTlsPasswordDescription
    attrSet _ = setTlsPasswordDescription
    attrConstruct _ = constructTlsPasswordDescription
    attrClear _ = undefined
#endif

-- VVV Prop "flags"
   -- Type: TInterface (Name {namespace = "Gio", name = "TlsPasswordFlags"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

{- |
Get the value of the “@flags@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' tlsPassword #flags
@
-}
getTlsPasswordFlags :: (MonadIO m, IsTlsPassword o) => o -> m [Gio.Flags.TlsPasswordFlags]
getTlsPasswordFlags :: o -> m [TlsPasswordFlags]
getTlsPasswordFlags obj :: o
obj = IO [TlsPasswordFlags] -> m [TlsPasswordFlags]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [TlsPasswordFlags] -> m [TlsPasswordFlags])
-> IO [TlsPasswordFlags] -> m [TlsPasswordFlags]
forall a b. (a -> b) -> a -> b
$ o -> String -> IO [TlsPasswordFlags]
forall a b.
(GObject a, IsGFlag b, BoxedFlags b) =>
a -> String -> IO [b]
getObjectPropertyFlags o
obj "flags"

{- |
Set the value of the “@flags@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' tlsPassword [ #flags 'Data.GI.Base.Attributes.:=' value ]
@
-}
setTlsPasswordFlags :: (MonadIO m, IsTlsPassword o) => o -> [Gio.Flags.TlsPasswordFlags] -> m ()
setTlsPasswordFlags :: o -> [TlsPasswordFlags] -> m ()
setTlsPasswordFlags obj :: o
obj val :: [TlsPasswordFlags]
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> [TlsPasswordFlags] -> IO ()
forall a b.
(IsGFlag b, BoxedFlags b, GObject a) =>
a -> String -> [b] -> IO ()
setObjectPropertyFlags o
obj "flags" [TlsPasswordFlags]
val

{- |
Construct a `GValueConstruct` with valid value for the “@flags@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructTlsPasswordFlags :: (IsTlsPassword o) => [Gio.Flags.TlsPasswordFlags] -> IO (GValueConstruct o)
constructTlsPasswordFlags :: [TlsPasswordFlags] -> IO (GValueConstruct o)
constructTlsPasswordFlags val :: [TlsPasswordFlags]
val = String -> [TlsPasswordFlags] -> IO (GValueConstruct o)
forall a o.
(IsGFlag a, BoxedFlags a) =>
String -> [a] -> IO (GValueConstruct o)
constructObjectPropertyFlags "flags" [TlsPasswordFlags]
val

#if ENABLE_OVERLOADING
data TlsPasswordFlagsPropertyInfo
instance AttrInfo TlsPasswordFlagsPropertyInfo where
    type AttrAllowedOps TlsPasswordFlagsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint TlsPasswordFlagsPropertyInfo = (~) [Gio.Flags.TlsPasswordFlags]
    type AttrBaseTypeConstraint TlsPasswordFlagsPropertyInfo = IsTlsPassword
    type AttrGetType TlsPasswordFlagsPropertyInfo = [Gio.Flags.TlsPasswordFlags]
    type AttrLabel TlsPasswordFlagsPropertyInfo = "flags"
    type AttrOrigin TlsPasswordFlagsPropertyInfo = TlsPassword
    attrGet _ = getTlsPasswordFlags
    attrSet _ = setTlsPasswordFlags
    attrConstruct _ = constructTlsPasswordFlags
    attrClear _ = undefined
#endif

-- VVV Prop "warning"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

{- |
Get the value of the “@warning@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' tlsPassword #warning
@
-}
getTlsPasswordWarning :: (MonadIO m, IsTlsPassword o) => o -> m T.Text
getTlsPasswordWarning :: o -> m Text
getTlsPasswordWarning obj :: o
obj = IO Text -> m Text
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
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing "getTlsPasswordWarning" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
getObjectPropertyString o
obj "warning"

{- |
Set the value of the “@warning@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' tlsPassword [ #warning 'Data.GI.Base.Attributes.:=' value ]
@
-}
setTlsPasswordWarning :: (MonadIO m, IsTlsPassword o) => o -> T.Text -> m ()
setTlsPasswordWarning :: o -> Text -> m ()
setTlsPasswordWarning obj :: o
obj val :: Text
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> IO ()
forall a. GObject a => a -> String -> Maybe Text -> IO ()
setObjectPropertyString o
obj "warning" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

{- |
Construct a `GValueConstruct` with valid value for the “@warning@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructTlsPasswordWarning :: (IsTlsPassword o) => T.Text -> IO (GValueConstruct o)
constructTlsPasswordWarning :: Text -> IO (GValueConstruct o)
constructTlsPasswordWarning val :: Text
val = String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
constructObjectPropertyString "warning" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

#if ENABLE_OVERLOADING
data TlsPasswordWarningPropertyInfo
instance AttrInfo TlsPasswordWarningPropertyInfo where
    type AttrAllowedOps TlsPasswordWarningPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint TlsPasswordWarningPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint TlsPasswordWarningPropertyInfo = IsTlsPassword
    type AttrGetType TlsPasswordWarningPropertyInfo = T.Text
    type AttrLabel TlsPasswordWarningPropertyInfo = "warning"
    type AttrOrigin TlsPasswordWarningPropertyInfo = TlsPassword
    attrGet _ = getTlsPasswordWarning
    attrSet _ = setTlsPasswordWarning
    attrConstruct _ = constructTlsPasswordWarning
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList TlsPassword
type instance O.AttributeList TlsPassword = TlsPasswordAttributeList
type TlsPasswordAttributeList = ('[ '("description", TlsPasswordDescriptionPropertyInfo), '("flags", TlsPasswordFlagsPropertyInfo), '("warning", TlsPasswordWarningPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
tlsPasswordDescription :: AttrLabelProxy "description"
tlsPasswordDescription = AttrLabelProxy

tlsPasswordFlags :: AttrLabelProxy "flags"
tlsPasswordFlags = AttrLabelProxy

tlsPasswordWarning :: AttrLabelProxy "warning"
tlsPasswordWarning = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList TlsPassword = TlsPasswordSignalList
type TlsPasswordSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method TlsPassword::new
-- method type : Constructor
-- Args : [Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "TlsPasswordFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the password flags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "description of what the password is for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "TlsPassword"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_password_new" g_tls_password_new :: 
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "TlsPasswordFlags"})
    CString ->                              -- description : TBasicType TUTF8
    IO (Ptr TlsPassword)

{- |
Create a new 'GI.Gio.Objects.TlsPassword.TlsPassword' object.
-}
tlsPasswordNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Gio.Flags.TlsPasswordFlags]
    {- ^ /@flags@/: the password flags -}
    -> T.Text
    {- ^ /@description@/: description of what the password is for -}
    -> m TlsPassword
    {- ^ __Returns:__ The newly allocated password object -}
tlsPasswordNew :: [TlsPasswordFlags] -> Text -> m TlsPassword
tlsPasswordNew flags :: [TlsPasswordFlags]
flags description :: Text
description = IO TlsPassword -> m TlsPassword
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TlsPassword -> m TlsPassword)
-> IO TlsPassword -> m TlsPassword
forall a b. (a -> b) -> a -> b
$ do
    let flags' :: CUInt
flags' = [TlsPasswordFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [TlsPasswordFlags]
flags
    CString
description' <- Text -> IO CString
textToCString Text
description
    Ptr TlsPassword
result <- CUInt -> CString -> IO (Ptr TlsPassword)
g_tls_password_new CUInt
flags' CString
description'
    Text -> Ptr TlsPassword -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "tlsPasswordNew" Ptr TlsPassword
result
    TlsPassword
result' <- ((ManagedPtr TlsPassword -> TlsPassword)
-> Ptr TlsPassword -> IO TlsPassword
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr TlsPassword -> TlsPassword
TlsPassword) Ptr TlsPassword
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
description'
    TlsPassword -> IO TlsPassword
forall (m :: * -> *) a. Monad m => a -> m a
return TlsPassword
result'

#if ENABLE_OVERLOADING
#endif

-- method TlsPassword::get_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "password", argType = TInterface (Name {namespace = "Gio", name = "TlsPassword"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GTlsPassword object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_password_get_description" g_tls_password_get_description :: 
    Ptr TlsPassword ->                      -- password : TInterface (Name {namespace = "Gio", name = "TlsPassword"})
    IO CString

{- |
Get a description string about what the password will be used for.

/Since: 2.30/
-}
tlsPasswordGetDescription ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsPassword a) =>
    a
    {- ^ /@password@/: a 'GI.Gio.Objects.TlsPassword.TlsPassword' object -}
    -> m T.Text
    {- ^ __Returns:__ The description of the password. -}
tlsPasswordGetDescription :: a -> m Text
tlsPasswordGetDescription password :: a
password = IO Text -> m Text
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
    Ptr TlsPassword
password' <- a -> IO (Ptr TlsPassword)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
password
    CString
result <- Ptr TlsPassword -> IO CString
g_tls_password_get_description Ptr TlsPassword
password'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "tlsPasswordGetDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
password
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if ENABLE_OVERLOADING
data TlsPasswordGetDescriptionMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsTlsPassword a) => O.MethodInfo TlsPasswordGetDescriptionMethodInfo a signature where
    overloadedMethod _ = tlsPasswordGetDescription

#endif

-- method TlsPassword::get_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "password", argType = TInterface (Name {namespace = "Gio", name = "TlsPassword"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GTlsPassword object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "TlsPasswordFlags"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_password_get_flags" g_tls_password_get_flags :: 
    Ptr TlsPassword ->                      -- password : TInterface (Name {namespace = "Gio", name = "TlsPassword"})
    IO CUInt

{- |
Get flags about the password.

/Since: 2.30/
-}
tlsPasswordGetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsPassword a) =>
    a
    {- ^ /@password@/: a 'GI.Gio.Objects.TlsPassword.TlsPassword' object -}
    -> m [Gio.Flags.TlsPasswordFlags]
    {- ^ __Returns:__ The flags about the password. -}
tlsPasswordGetFlags :: a -> m [TlsPasswordFlags]
tlsPasswordGetFlags password :: a
password = IO [TlsPasswordFlags] -> m [TlsPasswordFlags]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [TlsPasswordFlags] -> m [TlsPasswordFlags])
-> IO [TlsPasswordFlags] -> m [TlsPasswordFlags]
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsPassword
password' <- a -> IO (Ptr TlsPassword)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
password
    CUInt
result <- Ptr TlsPassword -> IO CUInt
g_tls_password_get_flags Ptr TlsPassword
password'
    let result' :: [TlsPasswordFlags]
result' = CUInt -> [TlsPasswordFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
password
    [TlsPasswordFlags] -> IO [TlsPasswordFlags]
forall (m :: * -> *) a. Monad m => a -> m a
return [TlsPasswordFlags]
result'

#if ENABLE_OVERLOADING
data TlsPasswordGetFlagsMethodInfo
instance (signature ~ (m [Gio.Flags.TlsPasswordFlags]), MonadIO m, IsTlsPassword a) => O.MethodInfo TlsPasswordGetFlagsMethodInfo a signature where
    overloadedMethod _ = tlsPasswordGetFlags

#endif

-- method TlsPassword::get_warning
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "password", argType = TInterface (Name {namespace = "Gio", name = "TlsPassword"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GTlsPassword object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_password_get_warning" g_tls_password_get_warning :: 
    Ptr TlsPassword ->                      -- password : TInterface (Name {namespace = "Gio", name = "TlsPassword"})
    IO CString

{- |
Get a user readable translated warning. Usually this warning is a
representation of the password flags returned from
'GI.Gio.Objects.TlsPassword.tlsPasswordGetFlags'.

/Since: 2.30/
-}
tlsPasswordGetWarning ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsPassword a) =>
    a
    {- ^ /@password@/: a 'GI.Gio.Objects.TlsPassword.TlsPassword' object -}
    -> m T.Text
    {- ^ __Returns:__ The warning. -}
tlsPasswordGetWarning :: a -> m Text
tlsPasswordGetWarning password :: a
password = IO Text -> m Text
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
    Ptr TlsPassword
password' <- a -> IO (Ptr TlsPassword)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
password
    CString
result <- Ptr TlsPassword -> IO CString
g_tls_password_get_warning Ptr TlsPassword
password'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "tlsPasswordGetWarning" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
password
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if ENABLE_OVERLOADING
data TlsPasswordGetWarningMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsTlsPassword a) => O.MethodInfo TlsPasswordGetWarningMethodInfo a signature where
    overloadedMethod _ = tlsPasswordGetWarning

#endif

-- method TlsPassword::set_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "password", argType = TInterface (Name {namespace = "Gio", name = "TlsPassword"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GTlsPassword object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The description of the password", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_password_set_description" g_tls_password_set_description :: 
    Ptr TlsPassword ->                      -- password : TInterface (Name {namespace = "Gio", name = "TlsPassword"})
    CString ->                              -- description : TBasicType TUTF8
    IO ()

{- |
Set a description string about what the password will be used for.

/Since: 2.30/
-}
tlsPasswordSetDescription ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsPassword a) =>
    a
    {- ^ /@password@/: a 'GI.Gio.Objects.TlsPassword.TlsPassword' object -}
    -> T.Text
    {- ^ /@description@/: The description of the password -}
    -> m ()
tlsPasswordSetDescription :: a -> Text -> m ()
tlsPasswordSetDescription password :: a
password description :: Text
description = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsPassword
password' <- a -> IO (Ptr TlsPassword)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
password
    CString
description' <- Text -> IO CString
textToCString Text
description
    Ptr TlsPassword -> CString -> IO ()
g_tls_password_set_description Ptr TlsPassword
password' CString
description'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
password
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
description'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data TlsPasswordSetDescriptionMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsTlsPassword a) => O.MethodInfo TlsPasswordSetDescriptionMethodInfo a signature where
    overloadedMethod _ = tlsPasswordSetDescription

#endif

-- method TlsPassword::set_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "password", argType = TInterface (Name {namespace = "Gio", name = "TlsPassword"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GTlsPassword object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "TlsPasswordFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The flags about the password", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_password_set_flags" g_tls_password_set_flags :: 
    Ptr TlsPassword ->                      -- password : TInterface (Name {namespace = "Gio", name = "TlsPassword"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "TlsPasswordFlags"})
    IO ()

{- |
Set flags about the password.

/Since: 2.30/
-}
tlsPasswordSetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsPassword a) =>
    a
    {- ^ /@password@/: a 'GI.Gio.Objects.TlsPassword.TlsPassword' object -}
    -> [Gio.Flags.TlsPasswordFlags]
    {- ^ /@flags@/: The flags about the password -}
    -> m ()
tlsPasswordSetFlags :: a -> [TlsPasswordFlags] -> m ()
tlsPasswordSetFlags password :: a
password flags :: [TlsPasswordFlags]
flags = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsPassword
password' <- a -> IO (Ptr TlsPassword)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
password
    let flags' :: CUInt
flags' = [TlsPasswordFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [TlsPasswordFlags]
flags
    Ptr TlsPassword -> CUInt -> IO ()
g_tls_password_set_flags Ptr TlsPassword
password' CUInt
flags'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
password
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data TlsPasswordSetFlagsMethodInfo
instance (signature ~ ([Gio.Flags.TlsPasswordFlags] -> m ()), MonadIO m, IsTlsPassword a) => O.MethodInfo TlsPasswordSetFlagsMethodInfo a signature where
    overloadedMethod _ = tlsPasswordSetFlags

#endif

-- method TlsPassword::set_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "password", argType = TInterface (Name {namespace = "Gio", name = "TlsPassword"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GTlsPassword object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TCArray False (-1) 2 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new password value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the password, or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the password, or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_password_set_value" g_tls_password_set_value :: 
    Ptr TlsPassword ->                      -- password : TInterface (Name {namespace = "Gio", name = "TlsPassword"})
    Ptr Word8 ->                            -- value : TCArray False (-1) 2 (TBasicType TUInt8)
    Int64 ->                                -- length : TBasicType TInt64
    IO ()

{- |
Set the value for this password. The /@value@/ will be copied by the password
object.

Specify the /@length@/, for a non-nul-terminated password. Pass -1 as
/@length@/ if using a nul-terminated password, and /@length@/ will be
calculated automatically. (Note that the terminating nul is not
considered part of the password in this case.)

/Since: 2.30/
-}
tlsPasswordSetValue ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsPassword a) =>
    a
    {- ^ /@password@/: a 'GI.Gio.Objects.TlsPassword.TlsPassword' object -}
    -> ByteString
    {- ^ /@value@/: the new password value -}
    -> m ()
tlsPasswordSetValue :: a -> ByteString -> m ()
tlsPasswordSetValue password :: a
password value :: ByteString
value = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let length_ :: Int64
length_ = Int -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int64) -> Int -> Int64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
value
    Ptr TlsPassword
password' <- a -> IO (Ptr TlsPassword)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
password
    Ptr Word8
value' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
value
    Ptr TlsPassword -> Ptr Word8 -> Int64 -> IO ()
g_tls_password_set_value Ptr TlsPassword
password' Ptr Word8
value' Int64
length_
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
password
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
value'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data TlsPasswordSetValueMethodInfo
instance (signature ~ (ByteString -> m ()), MonadIO m, IsTlsPassword a) => O.MethodInfo TlsPasswordSetValueMethodInfo a signature where
    overloadedMethod _ = tlsPasswordSetValue

#endif

-- method TlsPassword::set_value_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "password", argType = TInterface (Name {namespace = "Gio", name = "TlsPassword"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GTlsPassword object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TCArray False (-1) 2 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value for the password", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the password, or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "destroy", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a function to use to free the password.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the password, or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_password_set_value_full" g_tls_password_set_value_full :: 
    Ptr TlsPassword ->                      -- password : TInterface (Name {namespace = "Gio", name = "TlsPassword"})
    Ptr Word8 ->                            -- value : TCArray False (-1) 2 (TBasicType TUInt8)
    Int64 ->                                -- length : TBasicType TInt64
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Provide the value for this password.

The /@value@/ will be owned by the password object, and later freed using
the /@destroy@/ function callback.

Specify the /@length@/, for a non-nul-terminated password. Pass -1 as
/@length@/ if using a nul-terminated password, and /@length@/ will be
calculated automatically. (Note that the terminating nul is not
considered part of the password in this case.)

/Since: 2.30/
-}
tlsPasswordSetValueFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsPassword a) =>
    a
    {- ^ /@password@/: a 'GI.Gio.Objects.TlsPassword.TlsPassword' object -}
    -> ByteString
    {- ^ /@value@/: the value for the password -}
    -> Maybe (GLib.Callbacks.DestroyNotify)
    {- ^ /@destroy@/: a function to use to free the password. -}
    -> m ()
tlsPasswordSetValueFull :: a -> ByteString -> Maybe DestroyNotify -> m ()
tlsPasswordSetValueFull password :: a
password value :: ByteString
value destroy :: Maybe DestroyNotify
destroy = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let length_ :: Int64
length_ = Int -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int64) -> Int -> Int64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
value
    Ptr TlsPassword
password' <- a -> IO (Ptr TlsPassword)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
password
    Ptr Word8
value' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
value
    FunPtr DestroyNotify
maybeDestroy <- case Maybe DestroyNotify
destroy of
        Nothing -> FunPtr DestroyNotify -> IO (FunPtr DestroyNotify)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr DestroyNotify
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just jDestroy :: DestroyNotify
jDestroy -> do
            Ptr (FunPtr DestroyNotify)
ptrdestroy <- IO (Ptr (FunPtr DestroyNotify))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify))
            FunPtr DestroyNotify
jDestroy' <- DestroyNotify -> IO (FunPtr DestroyNotify)
GLib.Callbacks.mk_DestroyNotify (Maybe (Ptr (FunPtr DestroyNotify))
-> DestroyNotify -> DestroyNotify
GLib.Callbacks.wrap_DestroyNotify (Ptr (FunPtr DestroyNotify) -> Maybe (Ptr (FunPtr DestroyNotify))
forall a. a -> Maybe a
Just Ptr (FunPtr DestroyNotify)
ptrdestroy) DestroyNotify
jDestroy)
            Ptr (FunPtr DestroyNotify) -> FunPtr DestroyNotify -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr DestroyNotify)
ptrdestroy FunPtr DestroyNotify
jDestroy'
            FunPtr DestroyNotify -> IO (FunPtr DestroyNotify)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr DestroyNotify
jDestroy'
    Ptr TlsPassword
-> Ptr Word8 -> Int64 -> FunPtr DestroyNotify -> IO ()
g_tls_password_set_value_full Ptr TlsPassword
password' Ptr Word8
value' Int64
length_ FunPtr DestroyNotify
maybeDestroy
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
password
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
value'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data TlsPasswordSetValueFullMethodInfo
instance (signature ~ (ByteString -> Maybe (GLib.Callbacks.DestroyNotify) -> m ()), MonadIO m, IsTlsPassword a) => O.MethodInfo TlsPasswordSetValueFullMethodInfo a signature where
    overloadedMethod _ = tlsPasswordSetValueFull

#endif

-- method TlsPassword::set_warning
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "password", argType = TInterface (Name {namespace = "Gio", name = "TlsPassword"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GTlsPassword object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "warning", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The user readable warning", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_password_set_warning" g_tls_password_set_warning :: 
    Ptr TlsPassword ->                      -- password : TInterface (Name {namespace = "Gio", name = "TlsPassword"})
    CString ->                              -- warning : TBasicType TUTF8
    IO ()

{- |
Set a user readable translated warning. Usually this warning is a
representation of the password flags returned from
'GI.Gio.Objects.TlsPassword.tlsPasswordGetFlags'.

/Since: 2.30/
-}
tlsPasswordSetWarning ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsPassword a) =>
    a
    {- ^ /@password@/: a 'GI.Gio.Objects.TlsPassword.TlsPassword' object -}
    -> T.Text
    {- ^ /@warning@/: The user readable warning -}
    -> m ()
tlsPasswordSetWarning :: a -> Text -> m ()
tlsPasswordSetWarning password :: a
password warning :: Text
warning = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsPassword
password' <- a -> IO (Ptr TlsPassword)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
password
    CString
warning' <- Text -> IO CString
textToCString Text
warning
    Ptr TlsPassword -> CString -> IO ()
g_tls_password_set_warning Ptr TlsPassword
password' CString
warning'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
password
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
warning'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data TlsPasswordSetWarningMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsTlsPassword a) => O.MethodInfo TlsPasswordSetWarningMethodInfo a signature where
    overloadedMethod _ = tlsPasswordSetWarning

#endif