{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- General User Profile Settings
-- 
-- /Since: 1.8/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.NM.Objects.SettingUser
    ( 

-- * Exported types
    SettingUser(..)                         ,
    IsSettingUser                           ,
    toSettingUser                           ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [compare]("GI.NM.Objects.Setting#g:method:compare"), [diff]("GI.NM.Objects.Setting#g:method:diff"), [duplicate]("GI.NM.Objects.Setting#g:method:duplicate"), [enumerateValues]("GI.NM.Objects.Setting#g:method:enumerateValues"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [optionClearByName]("GI.NM.Objects.Setting#g:method:optionClearByName"), [optionGet]("GI.NM.Objects.Setting#g:method:optionGet"), [optionGetAllNames]("GI.NM.Objects.Setting#g:method:optionGetAllNames"), [optionGetBoolean]("GI.NM.Objects.Setting#g:method:optionGetBoolean"), [optionGetUint32]("GI.NM.Objects.Setting#g:method:optionGetUint32"), [optionSet]("GI.NM.Objects.Setting#g:method:optionSet"), [optionSetBoolean]("GI.NM.Objects.Setting#g:method:optionSetBoolean"), [optionSetUint32]("GI.NM.Objects.Setting#g:method:optionSetUint32"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [toString]("GI.NM.Objects.Setting#g:method:toString"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [verify]("GI.NM.Objects.Setting#g:method:verify"), [verifySecrets]("GI.NM.Objects.Setting#g:method:verifySecrets"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.NM.Objects.SettingUser#g:method:getData"), [getDbusPropertyType]("GI.NM.Objects.Setting#g:method:getDbusPropertyType"), [getKeys]("GI.NM.Objects.SettingUser#g:method:getKeys"), [getName]("GI.NM.Objects.Setting#g:method:getName"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getSecretFlags]("GI.NM.Objects.Setting#g:method:getSecretFlags").
-- 
-- ==== Setters
-- [setData]("GI.NM.Objects.SettingUser#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setSecretFlags]("GI.NM.Objects.Setting#g:method:setSecretFlags").

#if defined(ENABLE_OVERLOADING)
    ResolveSettingUserMethod                ,
#endif

-- ** checkKey #method:checkKey#

    settingUserCheckKey                     ,


-- ** checkVal #method:checkVal#

    settingUserCheckVal                     ,


-- ** getData #method:getData#

#if defined(ENABLE_OVERLOADING)
    SettingUserGetDataMethodInfo            ,
#endif
    settingUserGetData                      ,


-- ** getKeys #method:getKeys#

#if defined(ENABLE_OVERLOADING)
    SettingUserGetKeysMethodInfo            ,
#endif
    settingUserGetKeys                      ,


-- ** new #method:new#

    settingUserNew                          ,


-- ** setData #method:setData#

#if defined(ENABLE_OVERLOADING)
    SettingUserSetDataMethodInfo            ,
#endif
    settingUserSetData                      ,




 -- * Properties


-- ** data #attr:data#
-- | A dictionary of key\/value pairs with user data. This data is ignored by NetworkManager
-- and can be used at the users discretion. The keys only support a strict ascii format,
-- but the values can be arbitrary UTF8 strings up to a certain length.
-- 
-- /Since: 1.8/

#if defined(ENABLE_OVERLOADING)
    SettingUserDataPropertyInfo             ,
#endif
    clearSettingUserData                    ,
    constructSettingUserData                ,
    getSettingUserData                      ,
    setSettingUserData                      ,
#if defined(ENABLE_OVERLOADING)
    settingUserData                         ,
#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.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

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.NM.Callbacks as NM.Callbacks
import {-# SOURCE #-} qualified GI.NM.Enums as NM.Enums
import {-# SOURCE #-} qualified GI.NM.Flags as NM.Flags
import {-# SOURCE #-} qualified GI.NM.Interfaces.Connection as NM.Connection
import {-# SOURCE #-} qualified GI.NM.Objects.Setting as NM.Setting
import {-# SOURCE #-} qualified GI.NM.Objects.Setting8021x as NM.Setting8021x
import {-# SOURCE #-} qualified GI.NM.Objects.SettingAdsl as NM.SettingAdsl
import {-# SOURCE #-} qualified GI.NM.Objects.SettingBluetooth as NM.SettingBluetooth
import {-# SOURCE #-} qualified GI.NM.Objects.SettingBond as NM.SettingBond
import {-# SOURCE #-} qualified GI.NM.Objects.SettingBridge as NM.SettingBridge
import {-# SOURCE #-} qualified GI.NM.Objects.SettingBridgePort as NM.SettingBridgePort
import {-# SOURCE #-} qualified GI.NM.Objects.SettingCdma as NM.SettingCdma
import {-# SOURCE #-} qualified GI.NM.Objects.SettingConnection as NM.SettingConnection
import {-# SOURCE #-} qualified GI.NM.Objects.SettingDcb as NM.SettingDcb
import {-# SOURCE #-} qualified GI.NM.Objects.SettingDummy as NM.SettingDummy
import {-# SOURCE #-} qualified GI.NM.Objects.SettingGeneric as NM.SettingGeneric
import {-# SOURCE #-} qualified GI.NM.Objects.SettingGsm as NM.SettingGsm
import {-# SOURCE #-} qualified GI.NM.Objects.SettingIP4Config as NM.SettingIP4Config
import {-# SOURCE #-} qualified GI.NM.Objects.SettingIP6Config as NM.SettingIP6Config
import {-# SOURCE #-} qualified GI.NM.Objects.SettingIPConfig as NM.SettingIPConfig
import {-# SOURCE #-} qualified GI.NM.Objects.SettingIPTunnel as NM.SettingIPTunnel
import {-# SOURCE #-} qualified GI.NM.Objects.SettingInfiniband as NM.SettingInfiniband
import {-# SOURCE #-} qualified GI.NM.Objects.SettingMacsec as NM.SettingMacsec
import {-# SOURCE #-} qualified GI.NM.Objects.SettingMacvlan as NM.SettingMacvlan
import {-# SOURCE #-} qualified GI.NM.Objects.SettingOlpcMesh as NM.SettingOlpcMesh
import {-# SOURCE #-} qualified GI.NM.Objects.SettingOvsBridge as NM.SettingOvsBridge
import {-# SOURCE #-} qualified GI.NM.Objects.SettingOvsInterface as NM.SettingOvsInterface
import {-# SOURCE #-} qualified GI.NM.Objects.SettingOvsPatch as NM.SettingOvsPatch
import {-# SOURCE #-} qualified GI.NM.Objects.SettingOvsPort as NM.SettingOvsPort
import {-# SOURCE #-} qualified GI.NM.Objects.SettingPpp as NM.SettingPpp
import {-# SOURCE #-} qualified GI.NM.Objects.SettingPppoe as NM.SettingPppoe
import {-# SOURCE #-} qualified GI.NM.Objects.SettingProxy as NM.SettingProxy
import {-# SOURCE #-} qualified GI.NM.Objects.SettingSerial as NM.SettingSerial
import {-# SOURCE #-} qualified GI.NM.Objects.SettingTCConfig as NM.SettingTCConfig
import {-# SOURCE #-} qualified GI.NM.Objects.SettingTeam as NM.SettingTeam
import {-# SOURCE #-} qualified GI.NM.Objects.SettingTeamPort as NM.SettingTeamPort
import {-# SOURCE #-} qualified GI.NM.Objects.SettingTun as NM.SettingTun
import {-# SOURCE #-} qualified GI.NM.Objects.SettingVlan as NM.SettingVlan
import {-# SOURCE #-} qualified GI.NM.Objects.SettingVpn as NM.SettingVpn
import {-# SOURCE #-} qualified GI.NM.Objects.SettingVxlan as NM.SettingVxlan
import {-# SOURCE #-} qualified GI.NM.Objects.SettingWimax as NM.SettingWimax
import {-# SOURCE #-} qualified GI.NM.Objects.SettingWired as NM.SettingWired
import {-# SOURCE #-} qualified GI.NM.Objects.SettingWireless as NM.SettingWireless
import {-# SOURCE #-} qualified GI.NM.Objects.SettingWirelessSecurity as NM.SettingWirelessSecurity
import {-# SOURCE #-} qualified GI.NM.Structs.BridgeVlan as NM.BridgeVlan
import {-# SOURCE #-} qualified GI.NM.Structs.IPAddress as NM.IPAddress
import {-# SOURCE #-} qualified GI.NM.Structs.IPRoute as NM.IPRoute
import {-# SOURCE #-} qualified GI.NM.Structs.IPRoutingRule as NM.IPRoutingRule
import {-# SOURCE #-} qualified GI.NM.Structs.Range as NM.Range
import {-# SOURCE #-} qualified GI.NM.Structs.TCAction as NM.TCAction
import {-# SOURCE #-} qualified GI.NM.Structs.TCQdisc as NM.TCQdisc
import {-# SOURCE #-} qualified GI.NM.Structs.TCTfilter as NM.TCTfilter
import {-# SOURCE #-} qualified GI.NM.Structs.TeamLinkWatcher as NM.TeamLinkWatcher
import {-# SOURCE #-} qualified GI.NM.Structs.VariantAttributeSpec as NM.VariantAttributeSpec

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.NM.Objects.Setting as NM.Setting

#endif

-- | Memory-managed wrapper type.
newtype SettingUser = SettingUser (SP.ManagedPtr SettingUser)
    deriving (SettingUser -> SettingUser -> Bool
(SettingUser -> SettingUser -> Bool)
-> (SettingUser -> SettingUser -> Bool) -> Eq SettingUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SettingUser -> SettingUser -> Bool
== :: SettingUser -> SettingUser -> Bool
$c/= :: SettingUser -> SettingUser -> Bool
/= :: SettingUser -> SettingUser -> Bool
Eq)

instance SP.ManagedPtrNewtype SettingUser where
    toManagedPtr :: SettingUser -> ManagedPtr SettingUser
toManagedPtr (SettingUser ManagedPtr SettingUser
p) = ManagedPtr SettingUser
p

foreign import ccall "nm_setting_user_get_type"
    c_nm_setting_user_get_type :: IO B.Types.GType

instance B.Types.TypedObject SettingUser where
    glibType :: IO GType
glibType = IO GType
c_nm_setting_user_get_type

instance B.Types.GObject SettingUser

-- | Type class for types which can be safely cast to t'SettingUser', for instance with `toSettingUser`.
class (SP.GObject o, O.IsDescendantOf SettingUser o) => IsSettingUser o
instance (SP.GObject o, O.IsDescendantOf SettingUser o) => IsSettingUser o

instance O.HasParentTypes SettingUser
type instance O.ParentTypes SettingUser = '[NM.Setting.Setting, GObject.Object.Object]

-- | Cast to t'SettingUser', for types for which this is known to be safe. For general casts, use 'Data.GI.Base.ManagedPtr.castTo'.
toSettingUser :: (MIO.MonadIO m, IsSettingUser o) => o -> m SettingUser
toSettingUser :: forall (m :: * -> *) o.
(MonadIO m, IsSettingUser o) =>
o -> m SettingUser
toSettingUser = IO SettingUser -> m SettingUser
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO SettingUser -> m SettingUser)
-> (o -> IO SettingUser) -> o -> m SettingUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr SettingUser -> SettingUser) -> o -> IO SettingUser
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr SettingUser -> SettingUser
SettingUser

-- | Convert t'SettingUser' to and from t'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe SettingUser) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_nm_setting_user_get_type
    gvalueSet_ :: Ptr GValue -> Maybe SettingUser -> IO ()
gvalueSet_ Ptr GValue
gv Maybe SettingUser
P.Nothing = Ptr GValue -> Ptr SettingUser -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr SettingUser
forall a. Ptr a
FP.nullPtr :: FP.Ptr SettingUser)
    gvalueSet_ Ptr GValue
gv (P.Just SettingUser
obj) = SettingUser -> (Ptr SettingUser -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SettingUser
obj (Ptr GValue -> Ptr SettingUser -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe SettingUser)
gvalueGet_ Ptr GValue
gv = do
        Ptr SettingUser
ptr <- Ptr GValue -> IO (Ptr SettingUser)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr SettingUser)
        if Ptr SettingUser
ptr Ptr SettingUser -> Ptr SettingUser -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr SettingUser
forall a. Ptr a
FP.nullPtr
        then SettingUser -> Maybe SettingUser
forall a. a -> Maybe a
P.Just (SettingUser -> Maybe SettingUser)
-> IO SettingUser -> IO (Maybe SettingUser)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr SettingUser -> SettingUser)
-> Ptr SettingUser -> IO SettingUser
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr SettingUser -> SettingUser
SettingUser Ptr SettingUser
ptr
        else Maybe SettingUser -> IO (Maybe SettingUser)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe SettingUser
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveSettingUserMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveSettingUserMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSettingUserMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSettingUserMethod "compare" o = NM.Setting.SettingCompareMethodInfo
    ResolveSettingUserMethod "diff" o = NM.Setting.SettingDiffMethodInfo
    ResolveSettingUserMethod "duplicate" o = NM.Setting.SettingDuplicateMethodInfo
    ResolveSettingUserMethod "enumerateValues" o = NM.Setting.SettingEnumerateValuesMethodInfo
    ResolveSettingUserMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSettingUserMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSettingUserMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSettingUserMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSettingUserMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSettingUserMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSettingUserMethod "optionClearByName" o = NM.Setting.SettingOptionClearByNameMethodInfo
    ResolveSettingUserMethod "optionGet" o = NM.Setting.SettingOptionGetMethodInfo
    ResolveSettingUserMethod "optionGetAllNames" o = NM.Setting.SettingOptionGetAllNamesMethodInfo
    ResolveSettingUserMethod "optionGetBoolean" o = NM.Setting.SettingOptionGetBooleanMethodInfo
    ResolveSettingUserMethod "optionGetUint32" o = NM.Setting.SettingOptionGetUint32MethodInfo
    ResolveSettingUserMethod "optionSet" o = NM.Setting.SettingOptionSetMethodInfo
    ResolveSettingUserMethod "optionSetBoolean" o = NM.Setting.SettingOptionSetBooleanMethodInfo
    ResolveSettingUserMethod "optionSetUint32" o = NM.Setting.SettingOptionSetUint32MethodInfo
    ResolveSettingUserMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSettingUserMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSettingUserMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSettingUserMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSettingUserMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSettingUserMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSettingUserMethod "toString" o = NM.Setting.SettingToStringMethodInfo
    ResolveSettingUserMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSettingUserMethod "verify" o = NM.Setting.SettingVerifyMethodInfo
    ResolveSettingUserMethod "verifySecrets" o = NM.Setting.SettingVerifySecretsMethodInfo
    ResolveSettingUserMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSettingUserMethod "getData" o = SettingUserGetDataMethodInfo
    ResolveSettingUserMethod "getDbusPropertyType" o = NM.Setting.SettingGetDbusPropertyTypeMethodInfo
    ResolveSettingUserMethod "getKeys" o = SettingUserGetKeysMethodInfo
    ResolveSettingUserMethod "getName" o = NM.Setting.SettingGetNameMethodInfo
    ResolveSettingUserMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSettingUserMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSettingUserMethod "getSecretFlags" o = NM.Setting.SettingGetSecretFlagsMethodInfo
    ResolveSettingUserMethod "setData" o = SettingUserSetDataMethodInfo
    ResolveSettingUserMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveSettingUserMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSettingUserMethod "setSecretFlags" o = NM.Setting.SettingSetSecretFlagsMethodInfo
    ResolveSettingUserMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSettingUserMethod t SettingUser, O.OverloadedMethod info SettingUser p) => OL.IsLabel t (SettingUser -> 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 ~ ResolveSettingUserMethod t SettingUser, O.OverloadedMethod info SettingUser p, R.HasField t SettingUser p) => R.HasField t SettingUser p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveSettingUserMethod t SettingUser, O.OverloadedMethodInfo info SettingUser) => OL.IsLabel t (O.MethodProxy info SettingUser) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- VVV Prop "data"
   -- Type: TGHash (TBasicType TUTF8) (TBasicType TUTF8)
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@data@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' settingUser #data
-- @
getSettingUserData :: (MonadIO m, IsSettingUser o) => o -> m (Maybe (Map.Map T.Text T.Text))
getSettingUserData :: forall (m :: * -> *) o.
(MonadIO m, IsSettingUser o) =>
o -> m (Maybe (Map Text Text))
getSettingUserData o
obj = IO (Maybe (Map Text Text)) -> m (Maybe (Map Text Text))
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe (Map Text Text)) -> m (Maybe (Map Text Text)))
-> IO (Maybe (Map Text Text)) -> m (Maybe (Map Text Text))
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe (Map Text Text))
forall a b. GObject a => a -> String -> IO b
B.Properties.getObjectPropertyHash o
obj String
"data"

-- | Set the value of the “@data@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' settingUser [ #data 'Data.GI.Base.Attributes.:=' value ]
-- @
setSettingUserData :: (MonadIO m, IsSettingUser o) => o -> Map.Map T.Text T.Text -> m ()
setSettingUserData :: forall (m :: * -> *) o.
(MonadIO m, IsSettingUser o) =>
o -> Map Text Text -> m ()
setSettingUserData o
obj Map Text Text
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    o -> String -> Maybe (Map Text Text) -> IO ()
forall a b. GObject a => a -> String -> b -> IO ()
B.Properties.setObjectPropertyHash o
obj String
"data" (Map Text Text -> Maybe (Map Text Text)
forall a. a -> Maybe a
Just Map Text Text
val)

-- | Construct a t'GValueConstruct' with valid value for the “@data@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSettingUserData :: (IsSettingUser o, MIO.MonadIO m) => Map.Map T.Text T.Text -> m (GValueConstruct o)
constructSettingUserData :: forall o (m :: * -> *).
(IsSettingUser o, MonadIO m) =>
Map Text Text -> m (GValueConstruct o)
constructSettingUserData Map Text Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe (Map Text Text) -> IO (GValueConstruct o)
forall b o. String -> b -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyHash String
"data" (Map Text Text -> Maybe (Map Text Text)
forall a. a -> Maybe a
P.Just Map Text Text
val)

-- | Set the value of the “@data@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #data
-- @
clearSettingUserData :: (MonadIO m, IsSettingUser o) => o -> m ()
clearSettingUserData :: forall (m :: * -> *) o. (MonadIO m, IsSettingUser o) => o -> m ()
clearSettingUserData o
obj = 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
$ o -> String -> Maybe (Map Text Text) -> IO ()
forall a b. GObject a => a -> String -> b -> IO ()
B.Properties.setObjectPropertyHash o
obj String
"data" (Maybe (Map Text Text)
forall a. Maybe a
Nothing :: Maybe (Map.Map T.Text T.Text))

#if defined(ENABLE_OVERLOADING)
data SettingUserDataPropertyInfo
instance AttrInfo SettingUserDataPropertyInfo where
    type AttrAllowedOps SettingUserDataPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint SettingUserDataPropertyInfo = IsSettingUser
    type AttrSetTypeConstraint SettingUserDataPropertyInfo = (~) (Map.Map T.Text T.Text)
    type AttrTransferTypeConstraint SettingUserDataPropertyInfo = (~) (Map.Map T.Text T.Text)
    type AttrTransferType SettingUserDataPropertyInfo = Map.Map T.Text T.Text
    type AttrGetType SettingUserDataPropertyInfo = (Maybe (Map.Map T.Text T.Text))
    type AttrLabel SettingUserDataPropertyInfo = "data"
    type AttrOrigin SettingUserDataPropertyInfo = SettingUser
    attrGet = getSettingUserData
    attrSet = setSettingUserData
    attrTransfer _ v = do
        return v
    attrConstruct = constructSettingUserData
    attrClear = clearSettingUserData
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.NM.Objects.SettingUser.data"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-nm-1.0.1/docs/GI-NM-Objects-SettingUser.html#g:attr:data"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SettingUser
type instance O.AttributeList SettingUser = SettingUserAttributeList
type SettingUserAttributeList = ('[ '("data", SettingUserDataPropertyInfo), '("name", NM.Setting.SettingNamePropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
settingUserData :: AttrLabelProxy "data"
settingUserData = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SettingUser = SettingUserSignalList
type SettingUserSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method SettingUser::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "NM" , name = "SettingUser" })
-- throws : False
-- Skip return : False

foreign import ccall "nm_setting_user_new" nm_setting_user_new :: 
    IO (Ptr SettingUser)

-- | Creates a new t'GI.NM.Objects.SettingUser.SettingUser' object with default values.
-- 
-- /Since: 1.8/
settingUserNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m SettingUser
    -- ^ __Returns:__ the new empty t'GI.NM.Objects.SettingUser.SettingUser' object
settingUserNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m SettingUser
settingUserNew  = IO SettingUser -> m SettingUser
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SettingUser -> m SettingUser)
-> IO SettingUser -> m SettingUser
forall a b. (a -> b) -> a -> b
$ do
    Ptr SettingUser
result <- IO (Ptr SettingUser)
nm_setting_user_new
    Text -> Ptr SettingUser -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"settingUserNew" Ptr SettingUser
result
    SettingUser
result' <- ((ManagedPtr SettingUser -> SettingUser)
-> Ptr SettingUser -> IO SettingUser
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SettingUser -> SettingUser
SettingUser) Ptr SettingUser
result
    SettingUser -> IO SettingUser
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return SettingUser
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method SettingUser::get_data
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "setting"
--           , argType =
--               TInterface Name { namespace = "NM" , name = "SettingUser" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #NMSettingUser instance"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the key to lookup" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "nm_setting_user_get_data" nm_setting_user_get_data :: 
    Ptr SettingUser ->                      -- setting : TInterface (Name {namespace = "NM", name = "SettingUser"})
    CString ->                              -- key : TBasicType TUTF8
    IO CString

-- | /No description available in the introspection data./
-- 
-- /Since: 1.8/
settingUserGetData ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettingUser a) =>
    a
    -- ^ /@setting@/: the t'GI.NM.Objects.SettingUser.SettingUser' instance
    -> T.Text
    -- ^ /@key@/: the key to lookup
    -> m T.Text
    -- ^ __Returns:__ the value associated with /@key@/ or 'P.Nothing' if no such
    --   value exists.
settingUserGetData :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSettingUser a) =>
a -> Text -> m Text
settingUserGetData a
setting Text
key = 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
    Ptr SettingUser
setting' <- a -> IO (Ptr SettingUser)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
setting
    CString
key' <- Text -> IO CString
textToCString Text
key
    CString
result <- Ptr SettingUser -> CString -> IO CString
nm_setting_user_get_data Ptr SettingUser
setting' CString
key'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"settingUserGetData" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
setting
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
key'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data SettingUserGetDataMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m, IsSettingUser a) => O.OverloadedMethod SettingUserGetDataMethodInfo a signature where
    overloadedMethod = settingUserGetData

instance O.OverloadedMethodInfo SettingUserGetDataMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.NM.Objects.SettingUser.settingUserGetData",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-nm-1.0.1/docs/GI-NM-Objects-SettingUser.html#v:settingUserGetData"
        })


#endif

-- method SettingUser::get_keys
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "setting"
--           , argType =
--               TInterface Name { namespace = "NM" , name = "SettingUser" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #NMSettingUser" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_len"
--           , argType = TBasicType TUInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the length of the returned array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "out_len"
--              , argType = TBasicType TUInt
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the length of the returned array"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TCArray False (-1) 1 (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "nm_setting_user_get_keys" nm_setting_user_get_keys :: 
    Ptr SettingUser ->                      -- setting : TInterface (Name {namespace = "NM", name = "SettingUser"})
    Ptr Word32 ->                           -- out_len : TBasicType TUInt
    IO (Ptr CString)

-- | /No description available in the introspection data./
-- 
-- /Since: 1.8/
settingUserGetKeys ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettingUser a) =>
    a
    -- ^ /@setting@/: the t'GI.NM.Objects.SettingUser.SettingUser'
    -> m [T.Text]
    -- ^ __Returns:__ a
    --   'P.Nothing'-terminated array containing each key from the table.
settingUserGetKeys :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSettingUser a) =>
a -> m [Text]
settingUserGetKeys a
setting = 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
    Ptr SettingUser
setting' <- a -> IO (Ptr SettingUser)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
setting
    Ptr Word32
outLen <- IO (Ptr Word32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    Ptr CString
result <- Ptr SettingUser -> Ptr Word32 -> IO (Ptr CString)
nm_setting_user_get_keys Ptr SettingUser
setting' Ptr Word32
outLen
    Word32
outLen' <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
outLen
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"settingUserGetKeys" Ptr CString
result
    [Text]
result' <- (Word32 -> Ptr CString -> IO [Text]
forall a.
(HasCallStack, Integral a) =>
a -> Ptr CString -> IO [Text]
unpackUTF8CArrayWithLength Word32
outLen') Ptr CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
setting
    Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
outLen
    [Text] -> IO [Text]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'

#if defined(ENABLE_OVERLOADING)
data SettingUserGetKeysMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsSettingUser a) => O.OverloadedMethod SettingUserGetKeysMethodInfo a signature where
    overloadedMethod = settingUserGetKeys

instance O.OverloadedMethodInfo SettingUserGetKeysMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.NM.Objects.SettingUser.settingUserGetKeys",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-nm-1.0.1/docs/GI-NM-Objects-SettingUser.html#v:settingUserGetKeys"
        })


#endif

-- method SettingUser::set_data
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "setting"
--           , argType =
--               TInterface Name { namespace = "NM" , name = "SettingUser" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #NMSettingUser instance"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the key to set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "val"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the value to set or %NULL to clear a key."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "nm_setting_user_set_data" nm_setting_user_set_data :: 
    Ptr SettingUser ->                      -- setting : TInterface (Name {namespace = "NM", name = "SettingUser"})
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- val : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | /No description available in the introspection data./
-- 
-- /Since: 1.8/
settingUserSetData ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettingUser a) =>
    a
    -- ^ /@setting@/: the t'GI.NM.Objects.SettingUser.SettingUser' instance
    -> T.Text
    -- ^ /@key@/: the key to set
    -> Maybe (T.Text)
    -- ^ /@val@/: the value to set or 'P.Nothing' to clear a key.
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
settingUserSetData :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSettingUser a) =>
a -> Text -> Maybe Text -> m ()
settingUserSetData a
setting Text
key Maybe Text
val = 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
    Ptr SettingUser
setting' <- a -> IO (Ptr SettingUser)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
setting
    CString
key' <- Text -> IO CString
textToCString Text
key
    CString
maybeVal <- case Maybe Text
val of
        Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
FP.nullPtr
        Just Text
jVal -> do
            CString
jVal' <- Text -> IO CString
textToCString Text
jVal
            CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jVal'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr SettingUser
-> CString -> CString -> Ptr (Ptr GError) -> IO CInt
nm_setting_user_set_data Ptr SettingUser
setting' CString
key' CString
maybeVal
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
setting
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
key'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeVal
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
key'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeVal
     )

#if defined(ENABLE_OVERLOADING)
data SettingUserSetDataMethodInfo
instance (signature ~ (T.Text -> Maybe (T.Text) -> m ()), MonadIO m, IsSettingUser a) => O.OverloadedMethod SettingUserSetDataMethodInfo a signature where
    overloadedMethod = settingUserSetData

instance O.OverloadedMethodInfo SettingUserSetDataMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.NM.Objects.SettingUser.settingUserSetData",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-nm-1.0.1/docs/GI-NM-Objects-SettingUser.html#v:settingUserSetData"
        })


#endif

-- method SettingUser::check_key
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "key"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the key to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "nm_setting_user_check_key" nm_setting_user_check_key :: 
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Checks whether /@key@/ is a valid user data key. This means,
-- key is not 'P.Nothing', not too large and valid ASCII. Also,
-- only digits and numbers are allowed with a few special
-- characters. The key must contain at least one \'.\' and
-- look like a fully qualified DNS name.
-- 
-- /Since: 1.8/
settingUserCheckKey ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@key@/: the key to check
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
settingUserCheckKey :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
settingUserCheckKey Text
key = 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
    CString
key' <- Text -> IO CString
textToCString Text
key
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString -> Ptr (Ptr GError) -> IO CInt
nm_setting_user_check_key CString
key'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
key'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
key'
     )

#if defined(ENABLE_OVERLOADING)
#endif

-- method SettingUser::check_val
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "val"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the value to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "nm_setting_user_check_val" nm_setting_user_check_val :: 
    CString ->                              -- val : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Checks whether /@val@/ is a valid user data value. This means,
-- value is not 'P.Nothing', not too large and valid UTF-8.
-- 
-- /Since: 1.8/
settingUserCheckVal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@val@/: the value to check
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
settingUserCheckVal :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
settingUserCheckVal Text
val = 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
    CString
val' <- Text -> IO CString
textToCString Text
val
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString -> Ptr (Ptr GError) -> IO CInt
nm_setting_user_check_val CString
val'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
val'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
val'
     )

#if defined(ENABLE_OVERLOADING)
#endif