#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Secret.Functions
(
attributesValidate ,
getSchema ,
passwordClear ,
passwordClearFinish ,
passwordClearSync ,
passwordLookup ,
passwordLookupFinish ,
passwordLookupSync ,
passwordSearch ,
passwordSearchFinish ,
passwordSearchSync ,
passwordStore ,
passwordStoreBinary ,
passwordStoreBinarySync ,
passwordStoreFinish ,
passwordStoreSync ,
passwordWipe ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Secret.Enums as Secret.Enums
import {-# SOURCE #-} qualified GI.Secret.Flags as Secret.Flags
import {-# SOURCE #-} qualified GI.Secret.Interfaces.Retrievable as Secret.Retrievable
import {-# SOURCE #-} qualified GI.Secret.Structs.Schema as Secret.Schema
import {-# SOURCE #-} qualified GI.Secret.Structs.Value as Secret.Value
#else
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Secret.Enums as Secret.Enums
import {-# SOURCE #-} qualified GI.Secret.Flags as Secret.Flags
import {-# SOURCE #-} qualified GI.Secret.Interfaces.Retrievable as Secret.Retrievable
import {-# SOURCE #-} qualified GI.Secret.Structs.Schema as Secret.Schema
import {-# SOURCE #-} qualified GI.Secret.Structs.Value as Secret.Value
#endif
foreign import ccall "secret_password_wipe" secret_password_wipe ::
CString ->
IO ()
passwordWipe ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (T.Text)
-> m ()
passwordWipe :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe Text -> m ()
passwordWipe Maybe Text
password = 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
maybePassword <- case Maybe Text
password of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jPassword -> do
jPassword' <- Text -> IO (Ptr CChar)
textToCString Text
jPassword
return jPassword'
secret_password_wipe maybePassword
freeMem maybePassword
return ()
foreign import ccall "secret_password_storev_sync" secret_password_storev_sync ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
CString ->
CString ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
passwordStoreSync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> Maybe (T.Text)
-> T.Text
-> T.Text
-> Maybe (a)
-> m ()
passwordStoreSync :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema
-> Map Text Text -> Maybe Text -> Text -> Text -> Maybe a -> m ()
passwordStoreSync Maybe Schema
schema Map Text Text
attributes Maybe Text
collection Text
label Text
password Maybe a
cancellable = 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
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
maybeCollection <- case collection of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jCollection -> do
jCollection' <- Text -> IO (Ptr CChar)
textToCString Text
jCollection
return jCollection'
label' <- textToCString label
password' <- textToCString password
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ secret_password_storev_sync maybeSchema attributes'''''' maybeCollection label' password' maybeCancellable
whenJust schema touchManagedPtr
whenJust cancellable touchManagedPtr
unrefGHashTable attributes''''''
freeMem maybeCollection
freeMem label'
freeMem password'
return ()
) (do
unrefGHashTable attributes''''''
freeMem maybeCollection
freeMem label'
freeMem password'
)
foreign import ccall "secret_password_store_finish" secret_password_store_finish ::
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
passwordStoreFinish ::
(B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
a
-> m ()
passwordStoreFinish :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAsyncResult a) =>
a -> m ()
passwordStoreFinish a
result_ = 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
result_' <- a -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
result_
onException (do
_ <- propagateGError $ secret_password_store_finish result_'
touchManagedPtr result_
return ()
) (do
return ()
)
foreign import ccall "secret_password_storev_binary_sync" secret_password_storev_binary_sync ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
CString ->
CString ->
Ptr Secret.Value.Value ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
passwordStoreBinarySync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> Maybe (T.Text)
-> T.Text
-> Secret.Value.Value
-> Maybe (a)
-> m ()
passwordStoreBinarySync :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema
-> Map Text Text -> Maybe Text -> Text -> Value -> Maybe a -> m ()
passwordStoreBinarySync Maybe Schema
schema Map Text Text
attributes Maybe Text
collection Text
label Value
value Maybe a
cancellable = 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
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
maybeCollection <- case collection of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jCollection -> do
jCollection' <- Text -> IO (Ptr CChar)
textToCString Text
jCollection
return jCollection'
label' <- textToCString label
value' <- unsafeManagedPtrGetPtr value
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ secret_password_storev_binary_sync maybeSchema attributes'''''' maybeCollection label' value' maybeCancellable
whenJust schema touchManagedPtr
touchManagedPtr value
whenJust cancellable touchManagedPtr
unrefGHashTable attributes''''''
freeMem maybeCollection
freeMem label'
return ()
) (do
unrefGHashTable attributes''''''
freeMem maybeCollection
freeMem label'
)
foreign import ccall "secret_password_storev_binary" secret_password_storev_binary ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
CString ->
CString ->
Ptr Secret.Value.Value ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
passwordStoreBinary ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> Maybe (T.Text)
-> T.Text
-> Secret.Value.Value
-> Maybe (a)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
passwordStoreBinary :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema
-> Map Text Text
-> Maybe Text
-> Text
-> Value
-> Maybe a
-> Maybe AsyncReadyCallback
-> m ()
passwordStoreBinary Maybe Schema
schema Map Text Text
attributes Maybe Text
collection Text
label Value
value Maybe a
cancellable Maybe AsyncReadyCallback
callback = 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
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
maybeCollection <- case collection of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jCollection -> do
jCollection' <- Text -> IO (Ptr CChar)
textToCString Text
jCollection
return jCollection'
label' <- textToCString label
value' <- unsafeManagedPtrGetPtr value
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
secret_password_storev_binary maybeSchema attributes'''''' maybeCollection label' value' maybeCancellable maybeCallback userData
whenJust schema touchManagedPtr
touchManagedPtr value
whenJust cancellable touchManagedPtr
freeMem maybeCollection
freeMem label'
return ()
foreign import ccall "secret_password_storev" secret_password_storev ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
CString ->
CString ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
passwordStore ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> Maybe (T.Text)
-> T.Text
-> T.Text
-> Maybe (a)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
passwordStore :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema
-> Map Text Text
-> Maybe Text
-> Text
-> Text
-> Maybe a
-> Maybe AsyncReadyCallback
-> m ()
passwordStore Maybe Schema
schema Map Text Text
attributes Maybe Text
collection Text
label Text
password Maybe a
cancellable Maybe AsyncReadyCallback
callback = 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
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
maybeCollection <- case collection of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jCollection -> do
jCollection' <- Text -> IO (Ptr CChar)
textToCString Text
jCollection
return jCollection'
label' <- textToCString label
password' <- textToCString password
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
secret_password_storev maybeSchema attributes'''''' maybeCollection label' password' maybeCancellable maybeCallback userData
whenJust schema touchManagedPtr
whenJust cancellable touchManagedPtr
freeMem maybeCollection
freeMem label'
freeMem password'
return ()
foreign import ccall "secret_password_searchv_sync" secret_password_searchv_sync ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr (GList (Ptr Secret.Retrievable.Retrievable)))
passwordSearchSync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> [Secret.Flags.SearchFlags]
-> Maybe (a)
-> m [Secret.Retrievable.Retrievable]
passwordSearchSync :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema
-> Map Text Text -> [SearchFlags] -> Maybe a -> m [Retrievable]
passwordSearchSync Maybe Schema
schema Map Text Text
attributes [SearchFlags]
flags Maybe a
cancellable = IO [Retrievable] -> m [Retrievable]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Retrievable] -> m [Retrievable])
-> IO [Retrievable] -> m [Retrievable]
forall a b. (a -> b) -> a -> b
$ do
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
let flags' = [SearchFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [SearchFlags]
flags
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ secret_password_searchv_sync maybeSchema attributes'''''' flags' maybeCancellable
result' <- unpackGList result
result'' <- mapM (wrapObject Secret.Retrievable.Retrievable) result'
g_list_free result
whenJust schema touchManagedPtr
whenJust cancellable touchManagedPtr
unrefGHashTable attributes''''''
return result''
) (do
unrefGHashTable attributes''''''
)
foreign import ccall "secret_password_search_finish" secret_password_search_finish ::
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr (GList (Ptr Secret.Retrievable.Retrievable)))
passwordSearchFinish ::
(B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
a
-> m [Secret.Retrievable.Retrievable]
passwordSearchFinish :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAsyncResult a) =>
a -> m [Retrievable]
passwordSearchFinish a
result_ = IO [Retrievable] -> m [Retrievable]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Retrievable] -> m [Retrievable])
-> IO [Retrievable] -> m [Retrievable]
forall a b. (a -> b) -> a -> b
$ do
result_' <- a -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
result_
onException (do
result <- propagateGError $ secret_password_search_finish result_'
result' <- unpackGList result
result'' <- mapM (wrapObject Secret.Retrievable.Retrievable) result'
g_list_free result
touchManagedPtr result_
return result''
) (do
return ()
)
foreign import ccall "secret_password_searchv" secret_password_searchv ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
passwordSearch ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> [Secret.Flags.SearchFlags]
-> Maybe (a)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
passwordSearch :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema
-> Map Text Text
-> [SearchFlags]
-> Maybe a
-> Maybe AsyncReadyCallback
-> m ()
passwordSearch Maybe Schema
schema Map Text Text
attributes [SearchFlags]
flags Maybe a
cancellable Maybe AsyncReadyCallback
callback = 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
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
let flags' = [SearchFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [SearchFlags]
flags
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
secret_password_searchv maybeSchema attributes'''''' flags' maybeCancellable maybeCallback userData
whenJust schema touchManagedPtr
whenJust cancellable touchManagedPtr
return ()
foreign import ccall "secret_password_lookupv_sync" secret_password_lookupv_sync ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CString
passwordLookupSync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> Maybe (a)
-> m (Maybe T.Text)
passwordLookupSync :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema -> Map Text Text -> Maybe a -> m (Maybe Text)
passwordLookupSync Maybe Schema
schema Map Text Text
attributes Maybe a
cancellable = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ secret_password_lookupv_sync maybeSchema attributes'''''' maybeCancellable
maybeResult <- convertIfNonNull result $ \Ptr CChar
result' -> do
result'' <- HasCallStack => Ptr CChar -> IO Text
Ptr CChar -> IO Text
cstringToText Ptr CChar
result'
freeMem result'
return result''
whenJust schema touchManagedPtr
whenJust cancellable touchManagedPtr
unrefGHashTable attributes''''''
return maybeResult
) (do
unrefGHashTable attributes''''''
)
foreign import ccall "secret_password_lookup_finish" secret_password_lookup_finish ::
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CString
passwordLookupFinish ::
(B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
a
-> m T.Text
passwordLookupFinish :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAsyncResult a) =>
a -> m Text
passwordLookupFinish a
result_ = 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
result_' <- a -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
result_
onException (do
result <- propagateGError $ secret_password_lookup_finish result_'
checkUnexpectedReturnNULL "passwordLookupFinish" result
result' <- cstringToText result
freeMem result
touchManagedPtr result_
return result'
) (do
return ()
)
foreign import ccall "secret_password_lookupv" secret_password_lookupv ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
passwordLookup ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> Maybe (a)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
passwordLookup :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema
-> Map Text Text -> Maybe a -> Maybe AsyncReadyCallback -> m ()
passwordLookup Maybe Schema
schema Map Text Text
attributes Maybe a
cancellable Maybe AsyncReadyCallback
callback = 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
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
secret_password_lookupv maybeSchema attributes'''''' maybeCancellable maybeCallback userData
whenJust schema touchManagedPtr
whenJust cancellable touchManagedPtr
return ()
foreign import ccall "secret_password_clearv_sync" secret_password_clearv_sync ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
passwordClearSync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> Maybe (a)
-> m ()
passwordClearSync :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema -> Map Text Text -> Maybe a -> m ()
passwordClearSync Maybe Schema
schema Map Text Text
attributes Maybe a
cancellable = 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
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ secret_password_clearv_sync maybeSchema attributes'''''' maybeCancellable
whenJust schema touchManagedPtr
whenJust cancellable touchManagedPtr
unrefGHashTable attributes''''''
return ()
) (do
unrefGHashTable attributes''''''
)
foreign import ccall "secret_password_clear_finish" secret_password_clear_finish ::
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
passwordClearFinish ::
(B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
a
-> m ()
passwordClearFinish :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAsyncResult a) =>
a -> m ()
passwordClearFinish a
result_ = 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
result_' <- a -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
result_
onException (do
_ <- propagateGError $ secret_password_clear_finish result_'
touchManagedPtr result_
return ()
) (do
return ()
)
foreign import ccall "secret_password_clearv" secret_password_clearv ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable CString CString) ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
passwordClear ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Maybe (Secret.Schema.Schema)
-> Map.Map T.Text T.Text
-> Maybe (a)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
passwordClear :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Maybe Schema
-> Map Text Text -> Maybe a -> Maybe AsyncReadyCallback -> m ()
passwordClear Maybe Schema
schema Map Text Text
attributes Maybe a
cancellable Maybe AsyncReadyCallback
callback = 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
maybeSchema <- case Maybe Schema
schema of
Maybe Schema
Nothing -> Ptr Schema -> IO (Ptr Schema)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Schema
forall a. Ptr a
FP.nullPtr
Just Schema
jSchema -> do
jSchema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
jSchema
return jSchema'
let attributes' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
attributes
attributes'' <- mapFirstA textToCString attributes'
attributes''' <- mapSecondA textToCString attributes''
let attributes'''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(Ptr CChar, Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(Ptr CChar, Ptr CChar)]
attributes'''
let attributes''''' = (Ptr CChar -> PtrWrapped (Ptr CChar))
-> [(PtrWrapped (Ptr CChar), Ptr CChar)]
-> [(PtrWrapped (Ptr CChar), PtrWrapped (Ptr CChar))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr CChar -> PtrWrapped (Ptr CChar)
B.GHT.cstringPackPtr [(PtrWrapped (Ptr CChar), Ptr CChar)]
attributes''''
attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
maybeCancellable <- case cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just a
jCancellable -> do
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
secret_password_clearv maybeSchema attributes'''''' maybeCancellable maybeCallback userData
whenJust schema touchManagedPtr
whenJust cancellable touchManagedPtr
return ()
foreign import ccall "secret_get_schema" secret_get_schema ::
CUInt ->
IO (Ptr Secret.Schema.Schema)
getSchema ::
(B.CallStack.HasCallStack, MonadIO m) =>
Secret.Enums.SchemaType
-> m Secret.Schema.Schema
getSchema :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SchemaType -> m Schema
getSchema SchemaType
type_ = IO Schema -> m Schema
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Schema -> m Schema) -> IO Schema -> m Schema
forall a b. (a -> b) -> a -> b
$ do
let type_' :: CUInt
type_' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SchemaType -> Int) -> SchemaType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SchemaType -> Int
forall a. Enum a => a -> Int
fromEnum) SchemaType
type_
result <- CUInt -> IO (Ptr Schema)
secret_get_schema CUInt
type_'
checkUnexpectedReturnNULL "getSchema" result
result' <- (newBoxed Secret.Schema.Schema) result
return result'
foreign import ccall "secret_attributes_validate" secret_attributes_validate ::
Ptr Secret.Schema.Schema ->
Ptr (GHashTable (Ptr ()) (Ptr ())) ->
Ptr (Ptr GError) ->
IO CInt
attributesValidate ::
(B.CallStack.HasCallStack, MonadIO m) =>
Secret.Schema.Schema
-> Map.Map (Ptr ()) (Ptr ())
-> m ()
attributesValidate :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Schema -> Map (Ptr ()) (Ptr ()) -> m ()
attributesValidate Schema
schema Map (Ptr ()) (Ptr ())
attributes = 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
schema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
schema
let attributes' = Map (Ptr ()) (Ptr ()) -> [(Ptr (), Ptr ())]
forall k a. Map k a -> [(k, a)]
Map.toList Map (Ptr ()) (Ptr ())
attributes
let attributes'' = (Ptr () -> PtrWrapped (Ptr ()))
-> [(Ptr (), Ptr ())] -> [(PtrWrapped (Ptr ()), Ptr ())]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr () -> PtrWrapped (Ptr ())
forall a. Ptr a -> PtrWrapped (Ptr a)
B.GHT.ptrPackPtr [(Ptr (), Ptr ())]
attributes'
let attributes''' = (Ptr () -> PtrWrapped (Ptr ()))
-> [(PtrWrapped (Ptr ()), Ptr ())]
-> [(PtrWrapped (Ptr ()), PtrWrapped (Ptr ()))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr () -> PtrWrapped (Ptr ())
forall a. Ptr a -> PtrWrapped (Ptr a)
B.GHT.ptrPackPtr [(PtrWrapped (Ptr ()), Ptr ())]
attributes''
attributes'''' <- packGHashTable gDirectHash gDirectEqual Nothing Nothing attributes'''
onException (do
_ <- propagateGError $ secret_attributes_validate schema' attributes''''
touchManagedPtr schema
unrefGHashTable attributes''''
return ()
) (do
unrefGHashTable attributes''''
)