Remove unstable vapi
[platform/upstream/libsecret.git] / docs / reference / libsecret / libsecret-using.sgml
1 <?xml version="1.0"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3                "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
4 <!ENTITY major SYSTEM "version-major.xml">
5 ]>
6 <part id="using">
7 <title>Using libsecret in builds or scripts</title>
8
9 <chapter id="using-c">
10 <title>C: Compiling with libsecret</title>
11
12 <para>Like other GNOME libraries, <application>libsecret</application> uses
13 <application>pkg-config</application> to provide compiler options. The package
14 name is "<literal>libsecret-&major;</literal>". So in your
15 <literal>configure.ac</literal> script,you might specify something like:</para>
16
17 <informalexample><programlisting>
18 PKG_CHECK_MODULES(LIBSECRET, [libsecret-&major; >= 1.0])
19 AC_SUBST(LIBSECRET_CFLAGS)
20 AC_SUBST(LIBSECRET_LIBS)
21 </programlisting></informalexample>
22
23 <para>
24 Code using <application>libsecret</application> should include the header like this:
25 </para>
26
27 <informalexample><programlisting>
28 #include &lt;libsecret/secret.h&gt;
29 </programlisting></informalexample>
30
31 <para>
32 Including individual headers besides the main header files is not
33 permitted and will cause an error.
34 </para>
35
36 <para>
37 Some parts of the <application>libsecret</application> API are not yet stable.
38 To use them you need use the <literal>libsecret-unstable</literal> package.
39 The API contained in this package will change from time to time. Here's how
40 you would do it:
41 </para>
42
43 <informalexample><programlisting>
44 PKG_CHECK_MODULES(LIBSECRET, [libsecret-unstable >= 1.0])
45 AC_SUBST(LIBSECRET_CFLAGS)
46 AC_SUBST(LIBSECRET_LIBS)
47 </programlisting></informalexample>
48
49 </chapter>
50
51 <chapter id="using-js">
52 <title>Javascript: Importing libsecret</title>
53
54 <para>
55 In javascript use the standard introspection import mechanism to get at
56 <application>libsecret</application>:
57 </para>
58
59 <informalexample><programlisting language="javascript">
60 const Secret = imports.gi.Secret;
61
62 // ... and here's a sample line of code which uses the import
63 var schema = new Secret.Schema.new("org.mock.Schema",
64         Secret.SchemaFlags.NONE, { "name", Secret.SchemaAttributeType.STRING });
65 </programlisting></informalexample>
66
67 </chapter>
68
69 <chapter id="using-python">
70 <title>Python: Importing libsecret</title>
71
72 <para>
73 In python use the standard introspection import mechanism to get at
74 <application>libsecret</application>:
75 </para>
76
77 <informalexample><programlisting language="py">
78 from gi.repository import Secret
79
80 # ... and a here's sample line of code which uses the import
81 schema = Secret.Schema.new("org.mock.Schema",
82         Secret.SchemaFlags.NONE, { "name", Secret.SchemaAttributeType.STRING })
83 </programlisting></informalexample>
84
85 </chapter>
86
87 <chapter id="using-vala">
88 <title>Vala: Compiling with libsecret</title>
89
90 <para>
91 The package name is "<literal>libsecret-&major;</literal>". You can use it like
92 this in your <literal>Makefile.am</literal> file:
93 </para>
94
95 <informalexample><programlisting>
96 AM_VALAFLAGS = \
97         --pkg=libsecret-&major;
98 </programlisting></informalexample>
99
100 <para>
101 Some parts of the <application>libsecret</application> API are not yet stable.
102 To use them you need to define the SECRET_WITH_UNSTABLE C preprocessor
103 macro to use them, or else the build will fail:
104 </para>
105
106 <informalexample><programlisting>
107 AM_CPPFLAGS = \
108         -DSECRET_WITH_UNSTABLE=1
109 </programlisting></informalexample>
110
111 </chapter>
112
113 </part>