{- |
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.
-}

module GI.Gio.Objects.TlsPassword
    ( 

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


 -- * Methods
-- ** getDescription #method:getDescription#
    TlsPasswordGetDescriptionMethodInfo     ,
    tlsPasswordGetDescription               ,


-- ** getFlags #method:getFlags#
    TlsPasswordGetFlagsMethodInfo           ,
    tlsPasswordGetFlags                     ,


-- ** getWarning #method:getWarning#
    TlsPasswordGetWarningMethodInfo         ,
    tlsPasswordGetWarning                   ,


-- ** new #method:new#
    tlsPasswordNew                          ,


-- ** setDescription #method:setDescription#
    TlsPasswordSetDescriptionMethodInfo     ,
    tlsPasswordSetDescription               ,


-- ** setFlags #method:setFlags#
    TlsPasswordSetFlagsMethodInfo           ,
    tlsPasswordSetFlags                     ,


-- ** setValue #method:setValue#
    TlsPasswordSetValueMethodInfo           ,
    tlsPasswordSetValue                     ,


-- ** setValueFull #method:setValueFull#
    TlsPasswordSetValueFullMethodInfo       ,
    tlsPasswordSetValueFull                 ,


-- ** setWarning #method:setWarning#
    TlsPasswordSetWarningMethodInfo         ,
    tlsPasswordSetWarning                   ,




 -- * Properties
-- ** description #attr:description#
    TlsPasswordDescriptionPropertyInfo      ,
    constructTlsPasswordDescription         ,
    getTlsPasswordDescription               ,
    setTlsPasswordDescription               ,
    tlsPasswordDescription                  ,


-- ** flags #attr:flags#
    TlsPasswordFlagsPropertyInfo            ,
    constructTlsPasswordFlags               ,
    getTlsPasswordFlags                     ,
    setTlsPasswordFlags                     ,
    tlsPasswordFlags                        ,


-- ** warning #attr:warning#
    TlsPasswordWarningPropertyInfo          ,
    constructTlsPasswordWarning             ,
    getTlsPasswordWarning                   ,
    setTlsPasswordWarning                   ,
    tlsPasswordWarning                      ,




    ) 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.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

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 _ = c_g_tls_password_get_type
    

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

toTlsPassword :: IsTlsPassword o => o -> IO TlsPassword
toTlsPassword = unsafeCastTo TlsPassword

noTlsPassword :: Maybe TlsPassword
noTlsPassword = Nothing

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 "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 "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveTlsPasswordMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    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
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

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

getTlsPasswordDescription :: (MonadIO m, IsTlsPassword o) => o -> m T.Text
getTlsPasswordDescription obj = liftIO $ checkUnexpectedNothing "getTlsPasswordDescription" $ getObjectPropertyString obj "description"

setTlsPasswordDescription :: (MonadIO m, IsTlsPassword o) => o -> T.Text -> m ()
setTlsPasswordDescription obj val = liftIO $ setObjectPropertyString obj "description" (Just val)

constructTlsPasswordDescription :: (IsTlsPassword o) => T.Text -> IO (GValueConstruct o)
constructTlsPasswordDescription val = constructObjectPropertyString "description" (Just val)

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

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

getTlsPasswordFlags :: (MonadIO m, IsTlsPassword o) => o -> m [Gio.Flags.TlsPasswordFlags]
getTlsPasswordFlags obj = liftIO $ getObjectPropertyFlags obj "flags"

setTlsPasswordFlags :: (MonadIO m, IsTlsPassword o) => o -> [Gio.Flags.TlsPasswordFlags] -> m ()
setTlsPasswordFlags obj val = liftIO $ setObjectPropertyFlags obj "flags" val

constructTlsPasswordFlags :: (IsTlsPassword o) => [Gio.Flags.TlsPasswordFlags] -> IO (GValueConstruct o)
constructTlsPasswordFlags val = constructObjectPropertyFlags "flags" val

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

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

getTlsPasswordWarning :: (MonadIO m, IsTlsPassword o) => o -> m T.Text
getTlsPasswordWarning obj = liftIO $ checkUnexpectedNothing "getTlsPasswordWarning" $ getObjectPropertyString obj "warning"

setTlsPasswordWarning :: (MonadIO m, IsTlsPassword o) => o -> T.Text -> m ()
setTlsPasswordWarning obj val = liftIO $ setObjectPropertyString obj "warning" (Just val)

constructTlsPasswordWarning :: (IsTlsPassword o) => T.Text -> IO (GValueConstruct o)
constructTlsPasswordWarning val = constructObjectPropertyString "warning" (Just val)

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

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

tlsPasswordDescription :: AttrLabelProxy "description"
tlsPasswordDescription = AttrLabelProxy

tlsPasswordFlags :: AttrLabelProxy "flags"
tlsPasswordFlags = AttrLabelProxy

tlsPasswordWarning :: AttrLabelProxy "warning"
tlsPasswordWarning = AttrLabelProxy

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

-- 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 flags description = liftIO $ do
    let flags' = gflagsToWord flags
    description' <- textToCString description
    result <- g_tls_password_new flags' description'
    checkUnexpectedReturnNULL "tlsPasswordNew" result
    result' <- (wrapObject TlsPassword) result
    freeMem description'
    return result'

-- 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 password = liftIO $ do
    password' <- unsafeManagedPtrCastPtr password
    result <- g_tls_password_get_description password'
    checkUnexpectedReturnNULL "tlsPasswordGetDescription" result
    result' <- cstringToText result
    touchManagedPtr password
    return result'

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

-- 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 password = liftIO $ do
    password' <- unsafeManagedPtrCastPtr password
    result <- g_tls_password_get_flags password'
    let result' = wordToGFlags result
    touchManagedPtr password
    return result'

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

-- 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 password = liftIO $ do
    password' <- unsafeManagedPtrCastPtr password
    result <- g_tls_password_get_warning password'
    checkUnexpectedReturnNULL "tlsPasswordGetWarning" result
    result' <- cstringToText result
    touchManagedPtr password
    return result'

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

-- 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 password description = liftIO $ do
    password' <- unsafeManagedPtrCastPtr password
    description' <- textToCString description
    g_tls_password_set_description password' description'
    touchManagedPtr password
    freeMem description'
    return ()

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

-- 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 password flags = liftIO $ do
    password' <- unsafeManagedPtrCastPtr password
    let flags' = gflagsToWord flags
    g_tls_password_set_flags password' flags'
    touchManagedPtr password
    return ()

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

-- 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 = 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 : []
-- 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"})
    Word8 ->                                -- value : 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 -}
    -> Word8
    {- ^ /@value@/: the new password value -}
    -> Int64
    {- ^ /@length@/: the length of the password, or -1 -}
    -> m ()
tlsPasswordSetValue password value length_ = liftIO $ do
    password' <- unsafeManagedPtrCastPtr password
    g_tls_password_set_value password' value length_
    touchManagedPtr password
    return ()

data TlsPasswordSetValueMethodInfo
instance (signature ~ (Word8 -> Int64 -> m ()), MonadIO m, IsTlsPassword a) => O.MethodInfo TlsPasswordSetValueMethodInfo a signature where
    overloadedMethod _ = tlsPasswordSetValue

-- 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 = 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 : []
-- 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"})
    Word8 ->                                -- value : 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 -}
    -> Word8
    {- ^ /@value@/: the value for the password -}
    -> Int64
    {- ^ /@length@/: the length of the password, or -1 -}
    -> Maybe (GLib.Callbacks.DestroyNotify)
    {- ^ /@destroy@/: a function to use to free the password. -}
    -> m ()
tlsPasswordSetValueFull password value length_ destroy = liftIO $ do
    password' <- unsafeManagedPtrCastPtr password
    ptrdestroy <- callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify))
    maybeDestroy <- case destroy of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jDestroy -> do
            jDestroy' <- GLib.Callbacks.mk_DestroyNotify (GLib.Callbacks.wrap_DestroyNotify (Just ptrdestroy) jDestroy)
            poke ptrdestroy jDestroy'
            return jDestroy'
    g_tls_password_set_value_full password' value length_ maybeDestroy
    touchManagedPtr password
    return ()

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

-- 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 password warning = liftIO $ do
    password' <- unsafeManagedPtrCastPtr password
    warning' <- textToCString warning
    g_tls_password_set_warning password' warning'
    touchManagedPtr password
    freeMem warning'
    return ()

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