[libsecret] Split the pkg-config files, gir, and vapi into stable/unstable
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsecret] Split the pkg-config files, gir, and vapi into stable/unstable
- Date: Fri, 13 Jul 2012 10:01:33 +0000 (UTC)
commit 994ae44a77e55077bb64141a08ab8a5143a7d3f1
Author: Stef Walter <stefw gnome org>
Date: Fri Jul 13 11:11:58 2012 +0200
Split the pkg-config files, gir, and vapi into stable/unstable
* C callers need to use libsecret-0 pkg-config file for stable and
libsecret-unstable for unstable stuff.
* Vala callers need to '--pkg libsecret-unstable' for unstable
* GObject Introspection callers need to use the SecretUnstable package
.gitignore | 4 +-
configure.ac | 1 +
libsecret/Makefile.am | 70 ++++++++++++++++++++++++-------
libsecret/SecretUnstable-0.metadata | 5 ++
libsecret/libsecret-unstable.pc.in | 13 ++++++
libsecret/secret-attributes.h | 2 +-
libsecret/secret-collection.c | 6 +-
libsecret/secret-collection.h | 5 ++-
libsecret/secret-item.c | 4 +-
libsecret/secret-item.h | 3 +-
libsecret/secret-methods.c | 4 +-
libsecret/secret-password.h | 2 +-
libsecret/secret-paths.c | 4 +-
libsecret/secret-paths.h | 2 +-
libsecret/secret-private.h | 1 +
libsecret/secret-prompt.h | 3 +-
libsecret/secret-schema.h | 2 +-
libsecret/secret-schemas.h | 2 +-
libsecret/secret-service.c | 2 +-
libsecret/secret-service.h | 11 ++++-
libsecret/secret-types.h | 15 +------
libsecret/secret-unstable.h | 39 -----------------
libsecret/secret-value.c | 2 +-
libsecret/secret-value.h | 4 +-
libsecret/secret.h | 18 ++++++++
libsecret/tests/Makefile.am | 56 +++++++++++++------------
libsecret/tests/test-unstable.js | 17 +++++++
libsecret/tests/test-unstable.py | 23 ++++++++++
libsecret/tests/test-vala-unstable.vala | 25 +++++++++++
29 files changed, 227 insertions(+), 118 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 43fbffd..bef9fe7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
*~
*.bak
+*.deps
*.gcov
*.gcno
*.gcda
@@ -8,6 +9,7 @@
*.la
*.lo
*.o
+*.patch
*.pyc
*.pc
*.tar.gz
@@ -74,6 +76,6 @@ stamp*
!/libsecret/tests/test-*.js
!/libsecret/tests/test-*.py
!/libsecret/tests/test-*.vala
-/libsecret/tests/test-vala-lang.c
+/libsecret/tests/test-vala-*.c
/tool/secret-tool
diff --git a/configure.ac b/configure.ac
index 548e45d..e8b1152 100644
--- a/configure.ac
+++ b/configure.ac
@@ -249,6 +249,7 @@ AC_CONFIG_FILES([
po/Makefile
libsecret/Makefile
libsecret/libsecret.pc
+ libsecret/libsecret-unstable.pc
libsecret/tests/Makefile
tool/Makefile
])
diff --git a/libsecret/Makefile.am b/libsecret/Makefile.am
index b071994..e43970e 100644
--- a/libsecret/Makefile.am
+++ b/libsecret/Makefile.am
@@ -32,7 +32,6 @@ HEADER_FILES = \
secret-schemas.h \
secret-service.h \
secret-types.h \
- secret-unstable.h \
secret-value.h \
$(NULL)
@@ -46,30 +45,34 @@ BUILT_SOURCES = \
secret-enum-types.c secret-enum-types.h \
$(NULL)
-PUBLIC_FILES = \
+STABLE_FILES = \
secret-attributes.h secret-attributes.c \
+ secret-password.h secret-password.c \
+ secret-schema.h secret-schema.c \
+ secret-types.h \
+ $(NULL)
+
+UNSTABLE_FILES = \
secret-collection.h secret-collection.c \
secret-item.h secret-item.c \
secret-methods.c \
- secret-password.h secret-password.c \
secret-paths.h secret-paths.c \
secret-prompt.h secret-prompt.c \
- secret-schema.h secret-schema.c \
secret-schemas.h secret-schemas.c \
secret-service.h secret-service.c \
- secret-types.h \
secret-value.h secret-value.c \
$(NULL)
-INTERNAL_FILES = \
+PRIVATE_FILES = \
secret-private.h \
secret-session.c \
secret-util.c \
$(NULL)
libsecret_ SECRET_MAJOR@_la_SOURCES = \
- $(PUBLIC_FILES) \
- $(INTERNAL_FILES) \
+ $(STABLE_FILES) \
+ $(UNSTABLE_FILES) \
+ $(PRIVATE_FILES) \
$(BUILT_SOURCES) \
$(NULL)
@@ -107,20 +110,32 @@ if HAVE_INTROSPECTION
include $(INTROSPECTION_MAKEFILE)
-INTROSPECTION_GIRS = Secret- SECRET_MAJOR@.gir
+INTROSPECTION_GIRS = Secret- SECRET_MAJOR@.gir SecretUnstable-0.gir
INTROSPECTION_SCANNER_ARGS = $(INTROSPECTION_FLAGS) --warn-all --add-include-path=$(srcdir) --add-include-path=.
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) --includedir=.
Secret- SECRET_MAJOR@.gir: libsecret- SECRET_MAJOR@.la
+Secret_ SECRET_MAJOR@_gir_NAMESPACE = Secret
Secret_ SECRET_MAJOR@_gir_PACKAGES = gobject-2.0 gio-2.0
Secret_ SECRET_MAJOR@_gir_EXPORT_PACKAGES = libsecret- SECRET_MAJOR@
Secret_ SECRET_MAJOR@_gir_INCLUDES = GObject-2.0 Gio-2.0
Secret_ SECRET_MAJOR@_gir_LIBS = libsecret- SECRET_MAJOR@.la
-Secret_ SECRET_MAJOR@_gir_CFLAGS = -I$(top_srcdir) -I$(top_builddir) -DSECRET_COMPILATION -DSECRET_API_SUBJECT_TO_CHANGE
-Secret_ SECRET_MAJOR@_gir_FILES = $(PUBLIC_FILES)
+Secret_ SECRET_MAJOR@_gir_CFLAGS = -I$(top_srcdir) -I$(top_builddir) -DSECRET_COMPILATION
+Secret_ SECRET_MAJOR@_gir_FILES = $(STABLE_FILES)
Secret_ SECRET_MAJOR@_gir_SCANNERFLAGS = --c-include "libsecret/secret.h"
+SecretUnstable-0.gir: libsecret- SECRET_MAJOR@.la
+
+SecretUnstable_0_gir_NAMESPACE = SecretUnstable
+SecretUnstable_0_gir_PACKAGES = gobject-2.0 gio-2.0 libsecret- SECRET_MAJOR@
+SecretUnstable_0_gir_EXPORT_PACKAGES = libsecret-unstable
+SecretUnstable_0_gir_INCLUDES = GObject-2.0 Gio-2.0 Secret- SECRET_MAJOR@
+SecretUnstable_0_gir_LIBS = libsecret- SECRET_MAJOR@.la
+SecretUnstable_0_gir_CFLAGS = -I$(top_srcdir) -I$(top_builddir) -DSECRET_COMPILATION -DSECRET_API_SUBJECT_TO_CHANGE
+SecretUnstable_0_gir_FILES = $(UNSTABLE_FILES)
+SecretUnstable_0_gir_SCANNERFLAGS = --c-include "libsecret/secret.h" --identifier-prefix=Secret --symbol-prefix=secret
+
girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
@@ -132,16 +147,36 @@ include $(VAPIGEN_MAKEFILE)
libsecret- SECRET_MAJOR@.vapi: Secret- SECRET_MAJOR@.gir Secret- SECRET_MAJOR@.metadata
-VAPIGEN_VAPIS = libsecret- SECRET_MAJOR@.vapi
+libsecret-unstable.vapi: SecretUnstable-0.gir SecretUnstable-0.metadata
-libsecret_ SECRET_MAJOR@_vapi_DEPS = gio-2.0
+VAPIGEN_VAPIS = \
+ libsecret- SECRET_MAJOR@.vapi \
+ libsecret-unstable.vapi
+
+libsecret_ SECRET_MAJOR@_vapi_DEPS = glib-2.0 gio-2.0
libsecret_ SECRET_MAJOR@_vapi_METADATADIRS = $(srcdir)
libsecret_ SECRET_MAJOR@_vapi_FILES = Secret- SECRET_MAJOR@.gir
+libsecret_unstable_vapi_DEPS = gio-2.0 libsecret- SECRET_MAJOR@
+libsecret_unstable_vapi_METADATADIRS = $(srcdir)
+libsecret_unstable_vapi_VAPIDIRS = $(builddir)
+libsecret_unstable_vapi_FILES = SecretUnstable-0.gir
+
+VAPI_DEPS = $(VAPIGEN_VAPIS:.vapi=.deps)
+
+libsecret-$(SECRET_MAJOR).deps: Makefile.am
+ $(AM_V_GEN) echo $(libsecret_ SECRET_MAJOR@_vapi_DEPS) | tr ' ' '\n' > $@
+libsecret-unstable.deps: Makefile.am
+ $(AM_V_GEN) echo $(libsecret_unstable_vapi_DEPS) | tr ' ' '\n' > $@
+
vapidir = $(datadir)/vala/vapi
-vapi_DATA = $(VAPIGEN_VAPIS)
+vapi_DATA = \
+ $(VAPIGEN_VAPIS) \
+ $(VAPI_DEPS)
-CLEANFILES += $(VAPIGEN_VAPIS)
+CLEANFILES += \
+ $(VAPIGEN_VAPIS) \
+ $(VAPI_DEPS)
endif # ENABLE_VAPIGEN
endif # HAVE_INTROSPECTION
@@ -153,7 +188,9 @@ libsecret-$(SECRET_MAJOR).pc: libsecret.pc
cp libsecret.pc libsecret-$(SECRET_MAJOR).pc
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libsecret-$(SECRET_MAJOR).pc
+pkgconfig_DATA = \
+ libsecret-$(SECRET_MAJOR).pc \
+ libsecret-unstable.pc
# ------------------------------------------------------------------
@@ -163,6 +200,7 @@ EXTRA_DIST = \
secret-enum-types.c.template \
org.freedesktop.Secrets.xml \
Secret- SECRET_MAJOR@.metadata \
+ SecretUnstable-0.metadata \
$(NULL)
CLEANFILES += \
diff --git a/libsecret/SecretUnstable-0.metadata b/libsecret/SecretUnstable-0.metadata
new file mode 100644
index 0000000..a54b215
--- /dev/null
+++ b/libsecret/SecretUnstable-0.metadata
@@ -0,0 +1,5 @@
+// Metadata file for Vala API generation.
+// See https://live.gnome.org/Vala/UpstreamGuide for more information
+
+// include in the same Secret namespace
+* parent="Secret"
\ No newline at end of file
diff --git a/libsecret/libsecret-unstable.pc.in b/libsecret/libsecret-unstable.pc.in
new file mode 100644
index 0000000..44bb10f
--- /dev/null
+++ b/libsecret/libsecret-unstable.pc.in
@@ -0,0 +1,13 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+datarootdir= datarootdir@
+datadir= datadir@
+sysconfdir= sysconfdir@
+
+Name: libsecret-unstable
+Description: GObject bindings for Secret Service API (Unstable)
+Version: @VERSION@
+Requires: libsecret- SECRET_MAJOR@
+Cflags: -DSECRET_WITH_UNSTABLE
diff --git a/libsecret/secret-attributes.h b/libsecret/secret-attributes.h
index b2591bd..43e6035 100644
--- a/libsecret/secret-attributes.h
+++ b/libsecret/secret-attributes.h
@@ -13,7 +13,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_ATTRIBUTES_H__
diff --git a/libsecret/secret-collection.c b/libsecret/secret-collection.c
index 58d690b..1165e12 100644
--- a/libsecret/secret-collection.c
+++ b/libsecret/secret-collection.c
@@ -1456,7 +1456,7 @@ secret_collection_search (SecretCollection *self,
*
* Complete asynchronous operation to search for items in a collection.
*
- * Returns: (transfer full) (element-type Secret.Item):
+ * Returns: (transfer full) (element-type SecretUnstable.Item):
* a list of items that matched the search
*/
GList *
@@ -1546,7 +1546,7 @@ collection_load_items_sync (SecretCollection *self,
* This function may block indefinetely. Use the asynchronous version
* in user interface threads.
*
- * Returns: (transfer full) (element-type Secret.Item):
+ * Returns: (transfer full) (element-type SecretUnstable.Item):
* a list of items that matched the search
*/
GList *
@@ -1767,7 +1767,7 @@ secret_collection_get_flags (SecretCollection *self)
*
* Get the list of items in this collection.
*
- * Returns: (transfer full) (element-type Secret.Item): a list of items,
+ * Returns: (transfer full) (element-type SecretUnstable.Item): a list of items,
* when done, the list should be freed with g_list_free, and each item should
* be released with g_object_unref()
*/
diff --git a/libsecret/secret-collection.h b/libsecret/secret-collection.h
index 24fdf10..613cf95 100644
--- a/libsecret/secret-collection.h
+++ b/libsecret/secret-collection.h
@@ -13,7 +13,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_COLLECTION_H__
@@ -22,6 +22,7 @@
#include <gio/gio.h>
#include "secret-schema.h"
+#include "secret-service.h"
#include "secret-types.h"
G_BEGIN_DECLS
@@ -42,6 +43,8 @@ typedef enum {
#define SECRET_IS_COLLECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_COLLECTION))
#define SECRET_COLLECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_COLLECTION, SecretCollectionClass))
+typedef struct _SecretItem SecretItem;
+typedef struct _SecretCollection SecretCollection;
typedef struct _SecretCollectionClass SecretCollectionClass;
typedef struct _SecretCollectionPrivate SecretCollectionPrivate;
diff --git a/libsecret/secret-item.c b/libsecret/secret-item.c
index a2a8c1b..ca4c107 100644
--- a/libsecret/secret-item.c
+++ b/libsecret/secret-item.c
@@ -1405,7 +1405,7 @@ on_loads_secrets_session (GObject *source,
/**
* secret_item_load_secrets:
- * @items: (element-type Secret.Item): the items to retrieve secrets for
+ * @items: (element-type SecretUnstable.Item): the items to retrieve secrets for
* @cancellable: optional cancellation object
* @callback: called when the operation completes
* @user_data: data to pass to the callback
@@ -1504,7 +1504,7 @@ secret_item_load_secrets_finish (GAsyncResult *result,
/**
* secret_item_load_secrets_sync:
- * @items: (element-type Secret.Item): the items to retrieve secrets for
+ * @items: (element-type SecretUnstable.Item): the items to retrieve secrets for
* @cancellable: optional cancellation object
* @error: location to place an error on failure
*
diff --git a/libsecret/secret-item.h b/libsecret/secret-item.h
index 2c6dc54..e02c871 100644
--- a/libsecret/secret-item.h
+++ b/libsecret/secret-item.h
@@ -13,7 +13,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_ITEM_H__
@@ -21,6 +21,7 @@
#include <gio/gio.h>
+#include "secret-collection.h"
#include "secret-item.h"
#include "secret-service.h"
#include "secret-value.h"
diff --git a/libsecret/secret-methods.c b/libsecret/secret-methods.c
index 55b658f..78b3eeb 100644
--- a/libsecret/secret-methods.c
+++ b/libsecret/secret-methods.c
@@ -340,7 +340,7 @@ secret_service_search (SecretService *service,
*
* Complete asynchronous operation to search for items.
*
- * Returns: (transfer full) (element-type Secret.Item):
+ * Returns: (transfer full) (element-type SecretUnstable.Item):
* a list of items that matched the search
*/
GList *
@@ -430,7 +430,7 @@ service_load_items_sync (SecretService *service,
* This function may block indefinetely. Use the asynchronous version
* in user interface threads.
*
- * Returns: (transfer full) (element-type Secret.Item):
+ * Returns: (transfer full) (element-type SecretUnstable.Item):
* a list of items that matched the search
*/
GList *
diff --git a/libsecret/secret-password.h b/libsecret/secret-password.h
index a7bcbe3..02e5302 100644
--- a/libsecret/secret-password.h
+++ b/libsecret/secret-password.h
@@ -13,7 +13,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_PASSWORD_H__
diff --git a/libsecret/secret-paths.c b/libsecret/secret-paths.c
index a4068b8..60df179 100644
--- a/libsecret/secret-paths.c
+++ b/libsecret/secret-paths.c
@@ -905,7 +905,7 @@ secret_service_get_secrets_for_dbus_paths (SecretService *self,
*
* Items that are locked will not be included the results.
*
- * Returns: (transfer full) (element-type utf8 Secret.Value): a newly
+ * Returns: (transfer full) (element-type utf8 SecretUnstable.Value): a newly
* allocated hash table of item_path keys to #SecretValue
* values.
*/
@@ -948,7 +948,7 @@ secret_service_get_secrets_for_dbus_paths_finish (SecretService *self,
*
* Items that are locked will not be included the results.
*
- * Returns: (transfer full) (element-type utf8 Secret.Value): a newly
+ * Returns: (transfer full) (element-type utf8 SecretUnstable.Value): a newly
* allocated hash table of item_path keys to #SecretValue
* values.
*/
diff --git a/libsecret/secret-paths.h b/libsecret/secret-paths.h
index 11a0efa..b744f34 100644
--- a/libsecret/secret-paths.h
+++ b/libsecret/secret-paths.h
@@ -14,7 +14,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_PATHS_H__
diff --git a/libsecret/secret-private.h b/libsecret/secret-private.h
index c33b57c..aa66689 100644
--- a/libsecret/secret-private.h
+++ b/libsecret/secret-private.h
@@ -17,6 +17,7 @@
#include <gio/gio.h>
+#include "secret-item.h"
#include "secret-service.h"
#include "secret-value.h"
diff --git a/libsecret/secret-prompt.h b/libsecret/secret-prompt.h
index 56ec893..a6abac2 100644
--- a/libsecret/secret-prompt.h
+++ b/libsecret/secret-prompt.h
@@ -13,7 +13,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_PROMPT_H__
@@ -32,6 +32,7 @@ G_BEGIN_DECLS
#define SECRET_IS_PROMPT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_PROMPT))
#define SECRET_PROMPT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_PROMPT, SecretPromptClass))
+typedef struct _SecretPrompt SecretPrompt;
typedef struct _SecretPromptClass SecretPromptClass;
typedef struct _SecretPromptPrivate SecretPromptPrivate;
diff --git a/libsecret/secret-schema.h b/libsecret/secret-schema.h
index 481f73a..4039bd3 100644
--- a/libsecret/secret-schema.h
+++ b/libsecret/secret-schema.h
@@ -13,7 +13,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_SCHEMA_H__
diff --git a/libsecret/secret-schemas.h b/libsecret/secret-schemas.h
index 3a0855a..e4fc793 100644
--- a/libsecret/secret-schemas.h
+++ b/libsecret/secret-schemas.h
@@ -13,7 +13,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_SCHEMAS_H__
diff --git a/libsecret/secret-service.c b/libsecret/secret-service.c
index f58f2ff..eea9b18 100644
--- a/libsecret/secret-service.c
+++ b/libsecret/secret-service.c
@@ -1079,7 +1079,7 @@ secret_service_get_flags (SecretService *self)
* initializing #SecretService proxy object, then this method will return
* %NULL. Use secret_service_load_collections() to load the collections.
*
- * Returns: (transfer full) (element-type Secret.Collection) (allow-none): a
+ * Returns: (transfer full) (element-type SecretUnstable.Collection) (allow-none): a
* list of the collections in the secret service
*/
GList *
diff --git a/libsecret/secret-service.h b/libsecret/secret-service.h
index ea958e1..e73b622 100644
--- a/libsecret/secret-service.h
+++ b/libsecret/secret-service.h
@@ -14,7 +14,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_SERVICE_H__
@@ -35,6 +35,13 @@ typedef enum {
SECRET_SERVICE_LOAD_COLLECTIONS = 1 << 2,
} SecretServiceFlags;
+typedef enum {
+ SECRET_SEARCH_NONE = 0,
+ SECRET_SEARCH_ALL = 1 << 1,
+ SECRET_SEARCH_UNLOCK = 1 << 2,
+ SECRET_SEARCH_LOAD_SECRETS = 1 << 3,
+} SecretSearchFlags;
+
#define SECRET_TYPE_SERVICE (secret_service_get_type ())
#define SECRET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_SERVICE, SecretService))
#define SECRET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_SERVICE, SecretServiceClass))
@@ -42,6 +49,8 @@ typedef enum {
#define SECRET_IS_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_SERVICE))
#define SECRET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_SERVICE, SecretServiceClass))
+typedef struct _SecretCollection SecretCollection;
+typedef struct _SecretService SecretService;
typedef struct _SecretServiceClass SecretServiceClass;
typedef struct _SecretServicePrivate SecretServicePrivate;
diff --git a/libsecret/secret-types.h b/libsecret/secret-types.h
index a6c3ad9..708c53f 100644
--- a/libsecret/secret-types.h
+++ b/libsecret/secret-types.h
@@ -13,7 +13,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_TYPES_H__
@@ -34,23 +34,10 @@ typedef enum {
SECRET_ERROR_ALREADY_EXISTS = 4,
} SecretError;
-typedef struct _SecretCollection SecretCollection;
-typedef struct _SecretItem SecretItem;
-typedef struct _SecretPrompt SecretPrompt;
-typedef struct _SecretService SecretService;
-typedef struct _SecretValue SecretValue;
-
#define SECRET_COLLECTION_DEFAULT "default"
#define SECRET_COLLECTION_SESSION "session"
-typedef enum {
- SECRET_SEARCH_NONE = 0,
- SECRET_SEARCH_ALL = 1 << 1,
- SECRET_SEARCH_UNLOCK = 1 << 2,
- SECRET_SEARCH_LOAD_SECRETS = 1 << 3,
-} SecretSearchFlags;
-
G_END_DECLS
#endif /* __G_SERVICE_H___ */
diff --git a/libsecret/secret-unstable.h b/libsecret/secret-unstable.h
index c6fc0f4..e69de29 100644
--- a/libsecret/secret-unstable.h
+++ b/libsecret/secret-unstable.h
@@ -1,39 +0,0 @@
-/* libsecret - GLib wrapper for Secret Service
- *
- * Copyright 2012 Red Hat Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the licence or (at
- * your option) any later version.
- *
- * See the included COPYING file for more information.
- *
- * Author: Stef Walter <stefw gnome org>
- */
-
-#ifndef SECRET_API_SUBJECT_TO_CHANGE
-#error "This API has not yet reached stability. Define SECRET_API_SUBJECT_TO_CHANGE to acknowledge"
-#endif
-
-#ifndef __SECRET_UNSTABLE_H__
-#define __SECRET_UNSTABLE_H__
-
-#include <glib.h>
-
-#include <libsecret/secret.h>
-
-#define __SECRET_INSIDE_HEADER__
-
-#include <libsecret/secret-attributes.h>
-#include <libsecret/secret-collection.h>
-#include <libsecret/secret-enum-types.h>
-#include <libsecret/secret-item.h>
-#include <libsecret/secret-paths.h>
-#include <libsecret/secret-prompt.h>
-#include <libsecret/secret-service.h>
-#include <libsecret/secret-value.h>
-
-#undef __SECRET_INSIDE_HEADER__
-
-#endif /* __SECRET_UNSTABLE_H__ */
diff --git a/libsecret/secret-value.c b/libsecret/secret-value.c
index 4f6e49f..9b46c48 100644
--- a/libsecret/secret-value.c
+++ b/libsecret/secret-value.c
@@ -201,7 +201,7 @@ secret_value_ref (SecretValue *value)
/**
* secret_value_unref:
- * @value: (type Secret.Value) (allow-none): value to unreference
+ * @value: (type SecretUnstable.Value) (allow-none): value to unreference
*
* Unreference a #SecretValue. When the last reference is gone, then
* the value will be freed.
diff --git a/libsecret/secret-value.h b/libsecret/secret-value.h
index b3b53b0..08bd88b 100644
--- a/libsecret/secret-value.h
+++ b/libsecret/secret-value.h
@@ -13,7 +13,7 @@
*/
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
-#error "Only <libsecret/secret.h> or <libsecret/secret-unstable.h> can be included directly."
+#error "Only <libsecret/secret.h> can be included directly."
#endif
#ifndef __SECRET_VALUE_H__
@@ -25,6 +25,8 @@
G_BEGIN_DECLS
+typedef struct _SecretValue SecretValue;
+
#define SECRET_TYPE_VALUE (secret_value_get_type ())
GType secret_value_get_type (void) G_GNUC_CONST;
diff --git a/libsecret/secret.h b/libsecret/secret.h
index 0c03c30..91b7541 100644
--- a/libsecret/secret.h
+++ b/libsecret/secret.h
@@ -24,6 +24,24 @@
#include <libsecret/secret-schemas.h>
#include <libsecret/secret-types.h>
+/* This symbol is defined by the secret-unstable.pc pkg-config file */
+#if defined(SECRET_WITH_UNSTABLE) || defined(SECRET_API_SUBJECT_TO_CHANGE)
+
+#ifndef SECRET_API_SUBJECT_TO_CHANGE
+#warning "This API has not yet reached stability. Define SECRET_API_SUBJECT_TO_CHANGE to acknowledge"
+#endif
+
+#include <libsecret/secret-attributes.h>
+#include <libsecret/secret-collection.h>
+#include <libsecret/secret-enum-types.h>
+#include <libsecret/secret-item.h>
+#include <libsecret/secret-paths.h>
+#include <libsecret/secret-prompt.h>
+#include <libsecret/secret-service.h>
+#include <libsecret/secret-value.h>
+
+#endif /* SECRET_WITH_UNSTABLE || SECRET_API_SUBJECT_TO_CHANGE */
+
#undef __SECRET_INSIDE_HEADER__
#endif /* __SECRET_H__ */
diff --git a/libsecret/tests/Makefile.am b/libsecret/tests/Makefile.am
index d4456a1..32a16e3 100644
--- a/libsecret/tests/Makefile.am
+++ b/libsecret/tests/Makefile.am
@@ -56,7 +56,8 @@ noinst_PROGRAMS = \
JS_TESTS = \
test-lookup-password.js \
test-remove-password.js \
- test-store-password.js
+ test-store-password.js \
+ test-unstable.js
JS_ENV = \
LD_LIBRARY_PATH=$(builddir)/../.libs:$(builddir)/.libs \
@@ -65,7 +66,8 @@ JS_ENV = \
PY_TESTS = \
test-lookup-password.py \
test-remove-password.py \
- test-store-password.py
+ test-store-password.py \
+ test-unstable.py
PY_ENV = $(JS_ENV)
@@ -75,24 +77,39 @@ VALA_V = $(VALA_V_$(V))
VALA_V_ = $(VALA_V_$(AM_DEFAULT_VERBOSITY))
VALA_V_0 = @echo " VALAC " $^;
-if HAVE_INTROSPECTION
-if ENABLE_VAPIGEN
-
VALA_TESTS = \
test-vala-lang \
+ test-vala-unstable \
$(NULL)
-endif
-endif
+VALA_FLAGS = \
+ --vapidir=$(builddir)/.. \
+ --pkg gio-2.0
-test-vala-lang.c: test-vala-lang.vala libsecret- SECRET_MAJOR@.vapi mock-service-0.vapi
- $(VALA_V)$(VALAC) -C --pkg gio-2.0 $^
+VALA_TESTS_VAPIS = \
+ $(builddir)/../libsecret-unstable.vapi \
+ $(builddir)/../libsecret- SECRET_MAJOR@.vapi \
+ mock-service-0.vapi
+
+VALA_SRCS = $(VALA_TESTS:=.vala)
+
+.vala.c: $(VALA_TESTS_VAPIS)
+ $(VALA_V)$(VALAC) $(VALA_FLAGS) -C $<
+
+if HAVE_INTROSPECTION
+if ENABLE_VAPIGEN
TEST_PROGS += $(VALA_TESTS)
+endif
+endif
+
test_vala_lang_CFLAGS = -w
+test_vala_unstable_CFLAGS = -DSECRET_WITH_UNSTABLE -w
-DISTCLEANFILES = test-vala-lang.c
+DISTCLEANFILES = \
+ test-vala-lang.c \
+ test-vala-unstable.c
test-vala: $(VALA_TESTS)
@gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(VALA_TESTS)
@@ -142,7 +159,7 @@ noinst_DATA = \
if ENABLE_VAPIGEN
include $(VAPIGEN_MAKEFILE)
-mock-service-0.vapi: MockService-0.gir libsecret- SECRET_MAJOR@.vapi
+mock-service-0.vapi: MockService-0.gir $(builddir)/../libsecret- SECRET_MAJOR@.vapi
VAPIGEN_VAPIS = mock-service-0.vapi
@@ -154,21 +171,6 @@ mock_service_0_vapi_FILES = MockService-0.gir
vapidir = $(datadir)/vala/vapi
vapi_DATA = mock-service-0.vapi
-# We have to make a version of the VAPI which references the
-# uninstalled C headers.
-
-VAPIGEN_VAPIS += libsecret- SECRET_MAJOR@.vapi
-
-Secret- SECRET_MAJOR@.metadata: $(top_srcdir)/libsecret/Secret- SECRET_MAJOR@.metadata
- $(AM_V_GEN) echo "* cheader_filename=\"secret-collection.h,secret-item.h,secret-password.h,secret-prompt.h,secret-schema.h,secret-schemas.h,secret-service.h,secret-types.h,secret-value.h\"" > $@ && \
- cat < $^ >> $@
-
-libsecret- SECRET_MAJOR@.vapi: Secret- SECRET_MAJOR@.metadata $(top_builddir)/libsecret/Secret- SECRET_MAJOR@.gir
-
-libsecret_ SECRET_MAJOR@_vapi_DEPS = gio-2.0
-libsecret_ SECRET_MAJOR@_vapi_METADATADIRS = $(srcdir)
-libsecret_ SECRET_MAJOR@_vapi_FILES = $(top_builddir)/libsecret/Secret- SECRET_MAJOR@.gir
-
noinst_DATA += $(VAPIGEN_VAPIS)
endif # ENABLE_VAPIGEN
@@ -184,7 +186,7 @@ EXTRA_DIST = \
mock-service-only-plain.py \
mock-service-prompt.py \
Secret- SECRET_MAJOR@.metadata \
- test-vala-lang.vala \
+ $(VALA_SRCS) \
$(JS_TESTS) \
$(PY_TESTS) \
$(NULL)
diff --git a/libsecret/tests/test-unstable.js b/libsecret/tests/test-unstable.js
new file mode 100644
index 0000000..40dcf4f
--- /dev/null
+++ b/libsecret/tests/test-unstable.js
@@ -0,0 +1,17 @@
+
+const Mock = imports.gi.MockService;
+const Secret = imports.gi.SecretUnstable;
+const GLib = imports.gi.GLib;
+
+const JsUnit = imports.jsUnit;
+const assertNotEquals = JsUnit.assertNotEquals;
+
+Mock.start("mock-service-normal.py");
+
+var service = Secret.Service.get_sync(Secret.ServiceFlags.NONE, null);
+var path = service.read_alias_dbus_path_sync("default", null);
+
+/* Just running this without error is good enough for us to test the unstable gir */
+assertNotEquals(path, null);
+
+Mock.stop();
diff --git a/libsecret/tests/test-unstable.py b/libsecret/tests/test-unstable.py
new file mode 100644
index 0000000..09b3968
--- /dev/null
+++ b/libsecret/tests/test-unstable.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import unittest
+
+from gi.repository import MockService as Mock
+from gi.repository import SecretUnstable as Secret, GLib
+
+class TestStore(unittest.TestCase):
+ def setUp(self):
+ Mock.start("mock-service-normal.py")
+
+ def tearDown(self):
+ Mock.stop()
+
+ def testSynchronous(self):
+ service = Secret.Service.get_sync(Secret.ServiceFlags.NONE, None);
+ path = service.read_alias_dbus_path_sync("default", None);
+
+ # Just running this without error is good enough for us to test the unstable gir
+ self.assertNotEqual(path, None);
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/libsecret/tests/test-vala-unstable.vala b/libsecret/tests/test-vala-unstable.vala
new file mode 100644
index 0000000..ac28ce5
--- /dev/null
+++ b/libsecret/tests/test-vala-unstable.vala
@@ -0,0 +1,25 @@
+private void test_read_alias () {
+ try {
+ var service = Secret.Service.get_sync(Secret.ServiceFlags.NONE);
+ var path = service.read_alias_dbus_path_sync("default", null);
+ GLib.assert (path != null);
+ } catch ( GLib.Error e ) {
+ GLib.error (e.message);
+ }
+}
+
+private static int main (string[] args) {
+ GLib.Test.init (ref args);
+
+ try {
+ MockService.start ("mock-service-normal.py");
+ } catch ( GLib.Error e ) {
+ GLib.error ("Unable to start mock service: %s", e.message);
+ }
+
+ GLib.Test.add_data_func ("/vala/unstable/read-alias", test_read_alias);
+
+ var res = GLib.Test.run ();
+ MockService.stop ();
+ return res;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]