Commit 994ae44a authored by Stef Walter's avatar Stef Walter

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
parent 5cc30b2b
*~
*.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
......@@ -249,6 +249,7 @@ AC_CONFIG_FILES([
po/Makefile
libsecret/Makefile
libsecret/libsecret.pc
libsecret/libsecret-unstable.pc
libsecret/tests/Makefile
tool/Makefile
])
......
......@@ -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 += \
......
// 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
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
......@@ -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__
......
......@@ -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()
*/
......
......@@ -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;
......
......@@ -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
*
......
......@@ -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"
......
......@@ -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 *
......
......@@ -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__
......
......@@ -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.
*/
......
......@@ -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__
......
......@@ -17,6 +17,7 @@
#include <gio/gio.h>
#include "secret-item.h"
#include "secret-service.h"
#include "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_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;
......
......@@ -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__
......
......@@ -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__
......
......@@ -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 *
......
......@@ -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;
......
......@@ -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___ */
/* 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__ */
......@@ -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.
......
......@@ -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;
......
......@@ -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__ */
......@@ -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)
......
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();
#!/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()
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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment