Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GI.Secret fails to generate bindings for Schema::new #248

Open
moll opened this issue Aug 13, 2019 · 1 comment
Open

GI.Secret fails to generate bindings for Schema::new #248

moll opened this issue Aug 13, 2019 · 1 comment

Comments

@moll
Copy link

moll commented Aug 13, 2019

Hey,

As you asked, reminding you to look into why Schema::new binding generation fails in https://hackage.haskell.org/package/gi-secret-0.0.11/docs/src/GI.Secret.Structs.Schema.html#schemaRef.

Thank you in advance for fixing it!

@moll moll changed the title GI.Secret fails to generate Schema::new GI.Secret fails to generate bindings for Schema::new Aug 13, 2019
@moll
Copy link
Author

moll commented Aug 13, 2019

I got around this for now with a C file:

app.cabal:

c-sources: secrets.c
pkgconfig-depends: libsecret-1

secrets.c:

#include <libsecret/secret.h>

const SecretSchema schema = {
	"com.example",
	SECRET_SCHEMA_NONE,
	{
		{"environment", SECRET_SCHEMA_ATTRIBUTE_STRING},
		{NULL, 0},
	}
};

Secrets.hs:

import qualified Data.GI.Base as Gi
import System.IO.Unsafe (unsafePerformIO)

{-# NOINLINE sessionSchema #-}
schema :: Secret.Schema
schema = Secret.Schema $ unsafePerformIO $ Gi.newManagedPtr_ schema'

foreign import ccall unsafe "&schema" schema' :: Ffi.Ptr Secret.Schema

Then call GI.Secret.passwordStoreSync normally, passing schema from above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant