mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 04:38:55 +00:00
Rename gsecret to libsecret
* Fixes the namespacing capitalization issues run into with gobject-introspection and glib code tools
This commit is contained in:
parent
797b63f8e3
commit
46137f865b
6
.gitignore
vendored
6
.gitignore
vendored
@ -34,13 +34,13 @@ stamp*
|
||||
/build/valgrind-suppressions
|
||||
|
||||
/po/POTFILES
|
||||
/po/gsecret.pot
|
||||
/po/libsecret.pot
|
||||
|
||||
/egg/tests/test-*
|
||||
!/egg/tests/test-*.c
|
||||
|
||||
/library/gsecret-dbus-generated.[ch]
|
||||
/library/gsecret-enum-types.[ch]
|
||||
/library/secret-dbus-generated.[ch]
|
||||
/library/secret-enum-types.[ch]
|
||||
/library/tests/test-*
|
||||
!/library/tests/test-*.c
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
=== ChangeLog discontinued ===
|
||||
|
||||
gsecret relies on commit messages to provide change history. Please
|
||||
libsecret relies on commit messages to provide change history. Please
|
||||
write commit messages in the following format:
|
||||
|
||||
=== begin example commit ===
|
||||
|
@ -6,9 +6,9 @@ test -z "$srcdir" && srcdir=.
|
||||
|
||||
ORIGDIR=`pwd`
|
||||
cd $srcdir
|
||||
PROJECT=gsecret
|
||||
PROJECT=libsecret
|
||||
TEST_TYPE=-f
|
||||
FILE=library/gsecret-value.c
|
||||
FILE=library/secret-value.c
|
||||
|
||||
DIE=0
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
AC_PREREQ(2.65)
|
||||
AC_CONFIG_MACRO_DIR([build/m4])
|
||||
|
||||
AC_INIT([gsecret],[0.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=gsecret])
|
||||
AC_INIT([libsecret],[0.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=libsecret])
|
||||
|
||||
AC_CONFIG_SRCDIR([library/gsecret-value.c])
|
||||
AC_CONFIG_SRCDIR([library/secret-value.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
dnl Other initialization
|
||||
@ -24,7 +24,7 @@ AC_CHECK_FUNCS(mlock)
|
||||
#
|
||||
|
||||
IT_PROG_INTLTOOL([0.35.0])
|
||||
GETTEXT_PACKAGE=gsecret
|
||||
GETTEXT_PACKAGE=libsecret
|
||||
|
||||
AC_SUBST([GETTEXT_PACKAGE])
|
||||
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gettext domain name])
|
||||
|
@ -7,42 +7,42 @@ module_flags = \
|
||||
-avoid-version \
|
||||
-module \
|
||||
-no-undefined \
|
||||
-export-symbols-regex '^gsecret_'
|
||||
-export-symbols-regex '^secret_'
|
||||
|
||||
INCLUDES = \
|
||||
-DGSECRET_COMPILATION
|
||||
-DSECRET_COMPILATION
|
||||
|
||||
lib_LTLIBRARIES = libgsecret.la
|
||||
lib_LTLIBRARIES = libsecret.la
|
||||
|
||||
HEADER_FILES = \
|
||||
gsecret-collection.h \
|
||||
gsecret-item.h \
|
||||
gsecret-password.h \
|
||||
gsecret-prompt.h \
|
||||
gsecret-service.h \
|
||||
gsecret-value.h
|
||||
secret-collection.h \
|
||||
secret-item.h \
|
||||
secret-password.h \
|
||||
secret-prompt.h \
|
||||
secret-service.h \
|
||||
secret-value.h
|
||||
|
||||
BUILT_SOURCES = \
|
||||
gsecret-dbus-generated.c gsecret-dbus-generated.h \
|
||||
gsecret-enum-types.c gsecret-enum-types.h
|
||||
secret-dbus-generated.c secret-dbus-generated.h \
|
||||
secret-enum-types.c secret-enum-types.h
|
||||
|
||||
libgsecret_la_SOURCES = \
|
||||
gsecret-collection.h gsecret-collection.c \
|
||||
gsecret-item.h gsecret-item.c \
|
||||
gsecret-methods.c \
|
||||
gsecret-password.h gsecret-password.c \
|
||||
gsecret-prompt.h gsecret-prompt.c \
|
||||
gsecret-service.h gsecret-service.c \
|
||||
gsecret-session.h gsecret-session.c \
|
||||
gsecret-util.c \
|
||||
gsecret-value.h gsecret-value.c \
|
||||
libsecret_la_SOURCES = \
|
||||
secret-collection.h secret-collection.c \
|
||||
secret-item.h secret-item.c \
|
||||
secret-methods.c \
|
||||
secret-password.h secret-password.c \
|
||||
secret-prompt.h secret-prompt.c \
|
||||
secret-service.h secret-service.c \
|
||||
secret-session.h secret-session.c \
|
||||
secret-util.c \
|
||||
secret-value.h secret-value.c \
|
||||
$(BUILT_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
libgsecret_la_CFLAGS = \
|
||||
libsecret_la_CFLAGS = \
|
||||
$(LIBGCRYPT_CFLAGS)
|
||||
|
||||
libgsecret_la_LIBADD = \
|
||||
libsecret_la_LIBADD = \
|
||||
$(top_builddir)/egg/libegg.la \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(LIBS)
|
||||
@ -50,23 +50,23 @@ libgsecret_la_LIBADD = \
|
||||
DBUS_XML_DEFINITIONS = \
|
||||
org.freedesktop.Secrets.xml
|
||||
|
||||
gsecret-dbus-generated.c: $(DBUS_XML_DEFINITIONS) Makefile.am
|
||||
secret-dbus-generated.c: $(DBUS_XML_DEFINITIONS) Makefile.am
|
||||
$(AM_V_GEN) gdbus-codegen --interface-prefix org.freedesktop.Secret. \
|
||||
--generate-c-code gsecret-dbus-generated --c-namespace GSecretGen \
|
||||
--generate-c-code secret-dbus-generated --c-namespace SecretGen \
|
||||
$(DBUS_XML_DEFINITIONS)
|
||||
$(AM_V_GEN) sed -i -e 's/gsecret_gen_/_gsecret_gen_/g' gsecret-dbus-generated.[ch]
|
||||
$(AM_V_GEN) sed -i -e '1i #define GLIB_DISABLE_DEPRECATION_WARNINGS' gsecret-dbus-generated.c
|
||||
gsecret-dbus-generated.h: gsecret-dbus-generated.c
|
||||
$(AM_V_GEN) sed -i -e 's/secret_gen_/_secret_gen_/g' secret-dbus-generated.[ch]
|
||||
$(AM_V_GEN) sed -i -e '1i #define GLIB_DISABLE_DEPRECATION_WARNINGS' secret-dbus-generated.c
|
||||
secret-dbus-generated.h: secret-dbus-generated.c
|
||||
|
||||
gsecret-enum-types.h: gsecret-enum-types.h.template $(HEADER_FILES)
|
||||
secret-enum-types.h: secret-enum-types.h.template $(HEADER_FILES)
|
||||
$(AM_V_GEN) $(GLIB_MKENUMS) --template $^ > $@
|
||||
|
||||
gsecret-enum-types.c: gsecret-enum-types.c.template $(HEADER_FILES)
|
||||
secret-enum-types.c: secret-enum-types.c.template $(HEADER_FILES)
|
||||
$(AM_V_GEN) $(GLIB_MKENUMS) --template $^ > $@
|
||||
|
||||
EXTRA_DIST = \
|
||||
gsecret-enum-types.h.template \
|
||||
gsecret-enum-types.c.template
|
||||
secret-enum-types.h.template \
|
||||
secret-enum-types.c.template
|
||||
|
||||
check-memory:
|
||||
make -C tests check-memory
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
*
|
||||
@ -10,107 +10,107 @@
|
||||
* See the included COPYING file for more information.
|
||||
*/
|
||||
|
||||
#ifndef __GSECRET_COLLECTION_H__
|
||||
#define __GSECRET_COLLECTION_H__
|
||||
#ifndef __SECRET_COLLECTION_H__
|
||||
#define __SECRET_COLLECTION_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "gsecret-types.h"
|
||||
#include "secret-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSECRET_TYPE_COLLECTION (gsecret_collection_get_type ())
|
||||
#define GSECRET_COLLECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), GSECRET_TYPE_COLLECTION, GSecretCollection))
|
||||
#define GSECRET_COLLECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), GSECRET_TYPE_COLLECTION, GSecretCollectionClass))
|
||||
#define GSECRET_IS_COLLECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), GSECRET_TYPE_COLLECTION))
|
||||
#define GSECRET_IS_COLLECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), GSECRET_TYPE_COLLECTION))
|
||||
#define GSECRET_COLLECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GSECRET_TYPE_COLLECTION, GSecretCollectionClass))
|
||||
#define SECRET_TYPE_COLLECTION (secret_collection_get_type ())
|
||||
#define SECRET_COLLECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_COLLECTION, SecretCollection))
|
||||
#define SECRET_COLLECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_COLLECTION, SecretCollectionClass))
|
||||
#define SECRET_IS_COLLECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_COLLECTION))
|
||||
#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 _GSecretCollectionClass GSecretCollectionClass;
|
||||
typedef struct _GSecretCollectionPrivate GSecretCollectionPrivate;
|
||||
typedef struct _SecretCollectionClass SecretCollectionClass;
|
||||
typedef struct _SecretCollectionPrivate SecretCollectionPrivate;
|
||||
|
||||
struct _GSecretCollection {
|
||||
struct _SecretCollection {
|
||||
GDBusProxy parent;
|
||||
GSecretCollectionPrivate *pv;
|
||||
SecretCollectionPrivate *pv;
|
||||
};
|
||||
|
||||
struct _GSecretCollectionClass {
|
||||
struct _SecretCollectionClass {
|
||||
GDBusProxyClass parent_class;
|
||||
gpointer padding[8];
|
||||
};
|
||||
|
||||
GType gsecret_collection_get_type (void) G_GNUC_CONST;
|
||||
GType secret_collection_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gsecret_collection_new (GSecretService *service,
|
||||
void secret_collection_new (SecretService *service,
|
||||
const gchar *collection_path,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretCollection * gsecret_collection_new_finish (GAsyncResult *result,
|
||||
SecretCollection * secret_collection_new_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GSecretCollection * gsecret_collection_new_sync (GSecretService *service,
|
||||
SecretCollection * secret_collection_new_sync (SecretService *service,
|
||||
const gchar *collection_path,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_collection_refresh (GSecretCollection *self);
|
||||
void secret_collection_refresh (SecretCollection *self);
|
||||
|
||||
void gsecret_collection_create (GSecretService *service,
|
||||
void secret_collection_create (SecretService *service,
|
||||
const gchar *label,
|
||||
const gchar *alias,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretCollection * gsecret_collection_create_finish (GAsyncResult *result,
|
||||
SecretCollection * secret_collection_create_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GSecretCollection * gsecret_collection_create_sync (GSecretService *service,
|
||||
SecretCollection * secret_collection_create_sync (SecretService *service,
|
||||
const gchar *label,
|
||||
const gchar *alias,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_collection_delete (GSecretCollection *self,
|
||||
void secret_collection_delete (SecretCollection *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_collection_delete_finish (GSecretCollection *self,
|
||||
gboolean secret_collection_delete_finish (SecretCollection *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_collection_delete_sync (GSecretCollection *self,
|
||||
gboolean secret_collection_delete_sync (SecretCollection *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
GList * gsecret_collection_get_items (GSecretCollection *self);
|
||||
GList * secret_collection_get_items (SecretCollection *self);
|
||||
|
||||
gchar * gsecret_collection_get_label (GSecretCollection *self);
|
||||
gchar * secret_collection_get_label (SecretCollection *self);
|
||||
|
||||
void gsecret_collection_set_label (GSecretCollection *self,
|
||||
void secret_collection_set_label (SecretCollection *self,
|
||||
const gchar *label,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_collection_set_label_finish (GSecretCollection *self,
|
||||
gboolean secret_collection_set_label_finish (SecretCollection *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_collection_set_label_sync (GSecretCollection *self,
|
||||
gboolean secret_collection_set_label_sync (SecretCollection *self,
|
||||
const gchar *label,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_collection_get_locked (GSecretCollection *self);
|
||||
gboolean secret_collection_get_locked (SecretCollection *self);
|
||||
|
||||
guint64 gsecret_collection_get_created (GSecretCollection *self);
|
||||
guint64 secret_collection_get_created (SecretCollection *self);
|
||||
|
||||
guint64 gsecret_collection_get_modified (GSecretCollection *self);
|
||||
guint64 secret_collection_get_modified (SecretCollection *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSECRET_COLLECTION_H___ */
|
||||
#endif /* __SECRET_COLLECTION_H___ */
|
@ -2,8 +2,8 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#ifndef GSECRET_COMPILATION
|
||||
#define GSECRET_COMPILATION
|
||||
#ifndef SECRET_COMPILATION
|
||||
#define SECRET_COMPILATION
|
||||
#endif
|
||||
|
||||
/*** END file-header ***/
|
@ -1,10 +1,10 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#if !defined (__GSECRET_INSIDE_HEADER__) && !defined (GSECRET_COMPILATION)
|
||||
#error "Only <gsecret/gsecret.h> can be included directly."
|
||||
#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
|
||||
#error "Only <secret/secret.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GSECRET_ENUM_TYPES_H__
|
||||
#define __GSECRET_ENUM_TYPES_H__
|
||||
#ifndef __SECRET_ENUM_TYPES_H__
|
||||
#define __SECRET_ENUM_TYPES_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
@ -24,5 +24,5 @@ GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
/*** BEGIN file-tail ***/
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSECRET_ENUM_TYPES_H__ */
|
||||
#endif /* __SECRET_ENUM_TYPES_H__ */
|
||||
/*** END file-tail ***/
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
*
|
||||
@ -10,159 +10,159 @@
|
||||
* See the included COPYING file for more information.
|
||||
*/
|
||||
|
||||
#ifndef __GSECRET_ITEM_H__
|
||||
#define __GSECRET_ITEM_H__
|
||||
#ifndef __SECRET_ITEM_H__
|
||||
#define __SECRET_ITEM_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "gsecret-item.h"
|
||||
#include "gsecret-service.h"
|
||||
#include "gsecret-value.h"
|
||||
#include "secret-item.h"
|
||||
#include "secret-service.h"
|
||||
#include "secret-value.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSECRET_TYPE_ITEM (gsecret_item_get_type ())
|
||||
#define GSECRET_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), GSECRET_TYPE_ITEM, GSecretItem))
|
||||
#define GSECRET_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), GSECRET_TYPE_ITEM, GSecretItemClass))
|
||||
#define GSECRET_IS_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), GSECRET_TYPE_ITEM))
|
||||
#define GSECRET_IS_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), GSECRET_TYPE_ITEM))
|
||||
#define GSECRET_ITEM_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GSECRET_TYPE_ITEM, GSecretItemClass))
|
||||
#define SECRET_TYPE_ITEM (secret_item_get_type ())
|
||||
#define SECRET_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_ITEM, SecretItem))
|
||||
#define SECRET_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_ITEM, SecretItemClass))
|
||||
#define SECRET_IS_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_ITEM))
|
||||
#define SECRET_IS_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_ITEM))
|
||||
#define SECRET_ITEM_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_ITEM, SecretItemClass))
|
||||
|
||||
typedef struct _GSecretItemClass GSecretItemClass;
|
||||
typedef struct _GSecretItemPrivate GSecretItemPrivate;
|
||||
typedef struct _SecretItemClass SecretItemClass;
|
||||
typedef struct _SecretItemPrivate SecretItemPrivate;
|
||||
|
||||
struct _GSecretItem {
|
||||
struct _SecretItem {
|
||||
GDBusProxy parent_instance;
|
||||
GSecretItemPrivate *pv;;
|
||||
SecretItemPrivate *pv;;
|
||||
};
|
||||
|
||||
struct _GSecretItemClass {
|
||||
struct _SecretItemClass {
|
||||
GDBusProxyClass parent_class;
|
||||
gpointer padding[4];
|
||||
};
|
||||
|
||||
GType gsecret_item_get_type (void) G_GNUC_CONST;
|
||||
GType secret_item_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gsecret_item_new (GSecretService *service,
|
||||
void secret_item_new (SecretService *service,
|
||||
const gchar *item_path,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretItem * gsecret_item_new_finish (GAsyncResult *result,
|
||||
SecretItem * secret_item_new_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GSecretItem * gsecret_item_new_sync (GSecretService *service,
|
||||
SecretItem * secret_item_new_sync (SecretService *service,
|
||||
const gchar *item_path,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_item_refresh (GSecretItem *self);
|
||||
void secret_item_refresh (SecretItem *self);
|
||||
|
||||
void gsecret_item_create (GSecretCollection *collection,
|
||||
void secret_item_create (SecretCollection *collection,
|
||||
const gchar *schema_name,
|
||||
const gchar *label,
|
||||
GHashTable *attributes,
|
||||
GSecretValue *value,
|
||||
SecretValue *value,
|
||||
gboolean replace,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretItem * gsecret_item_create_finish (GAsyncResult *result,
|
||||
SecretItem * secret_item_create_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GSecretItem * gsecret_item_create_sync (GSecretCollection *collection,
|
||||
SecretItem * secret_item_create_sync (SecretCollection *collection,
|
||||
const gchar *schema_name,
|
||||
const gchar *label,
|
||||
GHashTable *attributes,
|
||||
GSecretValue *value,
|
||||
SecretValue *value,
|
||||
gboolean replace,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_item_delete (GSecretItem *self,
|
||||
void secret_item_delete (SecretItem *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_item_delete_finish (GSecretItem *self,
|
||||
gboolean secret_item_delete_finish (SecretItem *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_item_delete_sync (GSecretItem *self,
|
||||
gboolean secret_item_delete_sync (SecretItem *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_item_get_secret (GSecretItem *self,
|
||||
void secret_item_get_secret (SecretItem *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretValue * gsecret_item_get_secret_finish (GSecretItem *self,
|
||||
SecretValue * secret_item_get_secret_finish (SecretItem *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GSecretValue * gsecret_item_get_secret_sync (GSecretItem *self,
|
||||
SecretValue * secret_item_get_secret_sync (SecretItem *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_item_set_secret (GSecretItem *self,
|
||||
GSecretValue *value,
|
||||
void secret_item_set_secret (SecretItem *self,
|
||||
SecretValue *value,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_item_set_secret_finish (GSecretItem *self,
|
||||
gboolean secret_item_set_secret_finish (SecretItem *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_item_set_secret_sync (GSecretItem *self,
|
||||
GSecretValue *value,
|
||||
gboolean secret_item_set_secret_sync (SecretItem *self,
|
||||
SecretValue *value,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
GHashTable* gsecret_item_get_attributes (GSecretItem *self);
|
||||
GHashTable* secret_item_get_attributes (SecretItem *self);
|
||||
|
||||
void gsecret_item_set_attributes (GSecretItem *self,
|
||||
void secret_item_set_attributes (SecretItem *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_item_set_attributes_finish (GSecretItem *self,
|
||||
gboolean secret_item_set_attributes_finish (SecretItem *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_item_set_attributes_sync (GSecretItem *self,
|
||||
gboolean secret_item_set_attributes_sync (SecretItem *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gchar * gsecret_item_get_label (GSecretItem *self);
|
||||
gchar * secret_item_get_label (SecretItem *self);
|
||||
|
||||
void gsecret_item_set_label (GSecretItem *self,
|
||||
void secret_item_set_label (SecretItem *self,
|
||||
const gchar *label,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_item_set_label_finish (GSecretItem *self,
|
||||
gboolean secret_item_set_label_finish (SecretItem *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_item_set_label_sync (GSecretItem *self,
|
||||
gboolean secret_item_set_label_sync (SecretItem *self,
|
||||
const gchar *label,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gchar * gsecret_item_get_schema (GSecretItem *self);
|
||||
gchar * secret_item_get_schema (SecretItem *self);
|
||||
|
||||
gboolean gsecret_item_get_locked (GSecretItem *self);
|
||||
gboolean secret_item_get_locked (SecretItem *self);
|
||||
|
||||
guint64 gsecret_item_get_created (GSecretItem *self);
|
||||
guint64 secret_item_get_created (SecretItem *self);
|
||||
|
||||
guint64 gsecret_item_get_modified (GSecretItem *self);
|
||||
guint64 secret_item_get_modified (SecretItem *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -12,18 +12,18 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-password.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "gsecret-value.h"
|
||||
#include "secret-password.h"
|
||||
#include "secret-private.h"
|
||||
#include "secret-value.h"
|
||||
|
||||
#include <egg/egg-secure-memory.h>
|
||||
|
||||
typedef struct {
|
||||
const GSecretSchema *schema;
|
||||
const SecretSchema *schema;
|
||||
GHashTable *attributes;
|
||||
gchar *collection_path;
|
||||
gchar *label;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
GCancellable *cancellable;
|
||||
gboolean created;
|
||||
} StoreClosure;
|
||||
@ -35,7 +35,7 @@ store_closure_free (gpointer data)
|
||||
g_hash_table_unref (closure->attributes);
|
||||
g_free (closure->collection_path);
|
||||
g_free (closure->label);
|
||||
gsecret_value_unref (closure->value);
|
||||
secret_value_unref (closure->value);
|
||||
g_clear_object (&closure->cancellable);
|
||||
g_slice_free (StoreClosure, closure);
|
||||
}
|
||||
@ -49,7 +49,7 @@ on_store_complete (GObject *source,
|
||||
StoreClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GError *error = NULL;
|
||||
|
||||
closure->created = gsecret_service_store_finish (GSECRET_SERVICE (source),
|
||||
closure->created = secret_service_store_finish (SECRET_SERVICE (source),
|
||||
result, &error);
|
||||
if (error != NULL)
|
||||
g_simple_async_result_take_error (res, error);
|
||||
@ -65,12 +65,12 @@ on_store_connected (GObject *source,
|
||||
{
|
||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
||||
StoreClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
GError *error = NULL;
|
||||
|
||||
service = gsecret_service_get_finish (result, &error);
|
||||
service = secret_service_get_finish (result, &error);
|
||||
if (error == NULL) {
|
||||
gsecret_service_storev (service, closure->schema,
|
||||
secret_service_storev (service, closure->schema,
|
||||
closure->attributes,
|
||||
closure->collection_path,
|
||||
closure->label, closure->value,
|
||||
@ -88,7 +88,7 @@ on_store_connected (GObject *source,
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_password_store (const GSecretSchema *schema,
|
||||
secret_password_store (const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
const gchar *password,
|
||||
@ -107,17 +107,17 @@ gsecret_password_store (const GSecretSchema *schema,
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
|
||||
va_start (va, user_data);
|
||||
attributes = _gsecret_util_attributes_for_varargs (schema, va);
|
||||
attributes = _secret_util_attributes_for_varargs (schema, va);
|
||||
va_end (va);
|
||||
|
||||
gsecret_password_storev (schema, collection_path, label, password, attributes,
|
||||
secret_password_storev (schema, collection_path, label, password, attributes,
|
||||
cancellable, callback, user_data);
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_password_storev (const GSecretSchema *schema,
|
||||
secret_password_storev (const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
const gchar *password,
|
||||
@ -137,24 +137,24 @@ gsecret_password_storev (const GSecretSchema *schema,
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
|
||||
res = g_simple_async_result_new (NULL, callback, user_data,
|
||||
gsecret_password_storev);
|
||||
secret_password_storev);
|
||||
closure = g_slice_new0 (StoreClosure);
|
||||
closure->schema = schema;
|
||||
closure->collection_path = g_strdup (collection_path);
|
||||
closure->label = g_strdup (label);
|
||||
closure->value = gsecret_value_new (password, -1, "text/plain");
|
||||
closure->value = secret_value_new (password, -1, "text/plain");
|
||||
closure->attributes = g_hash_table_ref (attributes);
|
||||
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||
g_simple_async_result_set_op_res_gpointer (res, closure, store_closure_free);
|
||||
|
||||
gsecret_service_get (GSECRET_SERVICE_OPEN_SESSION, cancellable,
|
||||
secret_service_get (SECRET_SERVICE_OPEN_SESSION, cancellable,
|
||||
on_store_connected, g_object_ref (res));
|
||||
|
||||
g_object_unref (res);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_password_store_finish (GAsyncResult *result,
|
||||
secret_password_store_finish (GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
GSimpleAsyncResult *res;
|
||||
@ -162,7 +162,7 @@ gsecret_password_store_finish (GAsyncResult *result,
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL,
|
||||
gsecret_password_storev), FALSE);
|
||||
secret_password_storev), FALSE);
|
||||
|
||||
res = G_SIMPLE_ASYNC_RESULT (result);
|
||||
if (g_simple_async_result_propagate_error (res, error))
|
||||
@ -173,7 +173,7 @@ gsecret_password_store_finish (GAsyncResult *result,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_password_store_sync (const GSecretSchema *schema,
|
||||
secret_password_store_sync (const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
const gchar *password,
|
||||
@ -192,10 +192,10 @@ gsecret_password_store_sync (const GSecretSchema *schema,
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
va_start (va, error);
|
||||
attributes = _gsecret_util_attributes_for_varargs (schema, va);
|
||||
attributes = _secret_util_attributes_for_varargs (schema, va);
|
||||
va_end (va);
|
||||
|
||||
ret = gsecret_password_storev_sync (schema, collection_path, label, password,
|
||||
ret = secret_password_storev_sync (schema, collection_path, label, password,
|
||||
attributes, cancellable, error);
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
@ -203,7 +203,7 @@ gsecret_password_store_sync (const GSecretSchema *schema,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_password_storev_sync (const GSecretSchema *schema,
|
||||
secret_password_storev_sync (const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
const gchar *password,
|
||||
@ -211,7 +211,7 @@ gsecret_password_storev_sync (const GSecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GSecretSync *sync;
|
||||
SecretSync *sync;
|
||||
gboolean ret;
|
||||
|
||||
g_return_val_if_fail (schema != NULL, FALSE);
|
||||
@ -222,18 +222,18 @@ gsecret_password_storev_sync (const GSecretSchema *schema,
|
||||
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
sync = _gsecret_sync_new ();
|
||||
sync = _secret_sync_new ();
|
||||
g_main_context_push_thread_default (sync->context);
|
||||
|
||||
gsecret_password_storev (schema, collection_path, label, password, attributes,
|
||||
cancellable, _gsecret_sync_on_result, sync);
|
||||
secret_password_storev (schema, collection_path, label, password, attributes,
|
||||
cancellable, _secret_sync_on_result, sync);
|
||||
|
||||
g_main_loop_run (sync->loop);
|
||||
|
||||
ret = gsecret_password_store_finish (sync->result, error);
|
||||
ret = secret_password_store_finish (sync->result, error);
|
||||
|
||||
g_main_context_pop_thread_default (sync->context);
|
||||
_gsecret_sync_free (sync);
|
||||
_secret_sync_free (sync);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -241,7 +241,7 @@ gsecret_password_storev_sync (const GSecretSchema *schema,
|
||||
typedef struct {
|
||||
GCancellable *cancellable;
|
||||
GHashTable *attributes;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
} LookupClosure;
|
||||
|
||||
static void
|
||||
@ -251,12 +251,12 @@ lookup_closure_free (gpointer data)
|
||||
g_clear_object (&closure->cancellable);
|
||||
g_hash_table_unref (closure->attributes);
|
||||
if (closure->value)
|
||||
gsecret_value_unref (closure->value);
|
||||
secret_value_unref (closure->value);
|
||||
g_slice_free (LookupClosure, closure);
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_password_lookup (const GSecretSchema *schema,
|
||||
secret_password_lookup (const SecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data,
|
||||
@ -269,10 +269,10 @@ gsecret_password_lookup (const GSecretSchema *schema,
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
|
||||
va_start (va, user_data);
|
||||
attributes = _gsecret_util_attributes_for_varargs (schema, va);
|
||||
attributes = _secret_util_attributes_for_varargs (schema, va);
|
||||
va_end (va);
|
||||
|
||||
gsecret_password_lookupv (attributes, cancellable, callback, user_data);
|
||||
secret_password_lookupv (attributes, cancellable, callback, user_data);
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
}
|
||||
@ -286,7 +286,7 @@ on_lookup_complete (GObject *source,
|
||||
LookupClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GError *error = NULL;
|
||||
|
||||
closure->value = gsecret_service_lookup_finish (GSECRET_SERVICE (source),
|
||||
closure->value = secret_service_lookup_finish (SECRET_SERVICE (source),
|
||||
result, &error);
|
||||
|
||||
if (error != NULL)
|
||||
@ -303,16 +303,16 @@ on_lookup_connected (GObject *source,
|
||||
{
|
||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
||||
LookupClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
GError *error = NULL;
|
||||
|
||||
service = gsecret_service_get_finish (result, &error);
|
||||
service = secret_service_get_finish (result, &error);
|
||||
if (error != NULL) {
|
||||
g_simple_async_result_take_error (res, error);
|
||||
g_simple_async_result_complete (res);
|
||||
|
||||
} else {
|
||||
gsecret_service_lookupv (service, closure->attributes, closure->cancellable,
|
||||
secret_service_lookupv (service, closure->attributes, closure->cancellable,
|
||||
on_lookup_complete, g_object_ref (res));
|
||||
g_object_unref (service);
|
||||
}
|
||||
@ -321,7 +321,7 @@ on_lookup_connected (GObject *source,
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_password_lookupv (GHashTable *attributes,
|
||||
secret_password_lookupv (GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@ -333,20 +333,20 @@ gsecret_password_lookupv (GHashTable *attributes,
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
|
||||
res = g_simple_async_result_new (NULL, callback, user_data,
|
||||
gsecret_password_lookupv);
|
||||
secret_password_lookupv);
|
||||
closure = g_slice_new0 (LookupClosure);
|
||||
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||
closure->attributes = g_hash_table_ref (attributes);
|
||||
g_simple_async_result_set_op_res_gpointer (res, closure, lookup_closure_free);
|
||||
|
||||
gsecret_service_get (GSECRET_SERVICE_OPEN_SESSION, cancellable,
|
||||
secret_service_get (SECRET_SERVICE_OPEN_SESSION, cancellable,
|
||||
on_lookup_connected, g_object_ref (res));
|
||||
|
||||
g_object_unref (res);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gsecret_password_lookup_finish (GAsyncResult *result,
|
||||
secret_password_lookup_finish (GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
GSimpleAsyncResult *res;
|
||||
@ -356,16 +356,16 @@ gsecret_password_lookup_finish (GAsyncResult *result,
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL,
|
||||
gsecret_password_lookupv), NULL);
|
||||
secret_password_lookupv), NULL);
|
||||
|
||||
res = G_SIMPLE_ASYNC_RESULT (result);
|
||||
if (g_simple_async_result_propagate_error (res, error))
|
||||
return NULL;
|
||||
|
||||
closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
content_type = gsecret_value_get_content_type (closure->value);
|
||||
content_type = secret_value_get_content_type (closure->value);
|
||||
if (content_type && g_str_equal (content_type, "text/plain")) {
|
||||
password = _gsecret_value_unref_to_password (closure->value);
|
||||
password = _secret_value_unref_to_password (closure->value);
|
||||
closure->value = NULL;
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ gsecret_password_lookup_finish (GAsyncResult *result,
|
||||
}
|
||||
|
||||
gchar *
|
||||
gsecret_password_lookup_sync (const GSecretSchema *schema,
|
||||
secret_password_lookup_sync (const SecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GError **error,
|
||||
...)
|
||||
@ -387,10 +387,10 @@ gsecret_password_lookup_sync (const GSecretSchema *schema,
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
va_start (va, error);
|
||||
attributes = _gsecret_util_attributes_for_varargs (schema, va);
|
||||
attributes = _secret_util_attributes_for_varargs (schema, va);
|
||||
va_end (va);
|
||||
|
||||
password = gsecret_password_lookupv_sync (attributes, cancellable, error);
|
||||
password = secret_password_lookupv_sync (attributes, cancellable, error);
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
|
||||
@ -398,29 +398,29 @@ gsecret_password_lookup_sync (const GSecretSchema *schema,
|
||||
}
|
||||
|
||||
gchar *
|
||||
gsecret_password_lookupv_sync (GHashTable *attributes,
|
||||
secret_password_lookupv_sync (GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GSecretSync *sync;
|
||||
SecretSync *sync;
|
||||
gchar *password;
|
||||
|
||||
g_return_val_if_fail (attributes != NULL, NULL);
|
||||
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
sync = _gsecret_sync_new ();
|
||||
sync = _secret_sync_new ();
|
||||
g_main_context_push_thread_default (sync->context);
|
||||
|
||||
gsecret_password_lookupv (attributes, cancellable,
|
||||
_gsecret_sync_on_result, sync);
|
||||
secret_password_lookupv (attributes, cancellable,
|
||||
_secret_sync_on_result, sync);
|
||||
|
||||
g_main_loop_run (sync->loop);
|
||||
|
||||
password = gsecret_password_lookup_finish (sync->result, error);
|
||||
password = secret_password_lookup_finish (sync->result, error);
|
||||
|
||||
g_main_context_pop_thread_default (sync->context);
|
||||
_gsecret_sync_free (sync);
|
||||
_secret_sync_free (sync);
|
||||
|
||||
return password;
|
||||
}
|
||||
@ -441,7 +441,7 @@ delete_closure_free (gpointer data)
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_password_remove (const GSecretSchema *schema,
|
||||
secret_password_remove (const SecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data,
|
||||
@ -454,10 +454,10 @@ gsecret_password_remove (const GSecretSchema *schema,
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
|
||||
va_start (va, user_data);
|
||||
attributes = _gsecret_util_attributes_for_varargs (schema, va);
|
||||
attributes = _secret_util_attributes_for_varargs (schema, va);
|
||||
va_end (va);
|
||||
|
||||
gsecret_password_removev (attributes, cancellable,
|
||||
secret_password_removev (attributes, cancellable,
|
||||
callback, user_data);
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
@ -472,7 +472,7 @@ on_delete_complete (GObject *source,
|
||||
DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GError *error = NULL;
|
||||
|
||||
closure->deleted = gsecret_service_remove_finish (GSECRET_SERVICE (source),
|
||||
closure->deleted = secret_service_remove_finish (SECRET_SERVICE (source),
|
||||
result, &error);
|
||||
if (error != NULL)
|
||||
g_simple_async_result_take_error (res, error);
|
||||
@ -488,12 +488,12 @@ on_delete_connect (GObject *source,
|
||||
{
|
||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
||||
DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
GError *error = NULL;
|
||||
|
||||
service = gsecret_service_get_finish (result, &error);
|
||||
service = secret_service_get_finish (result, &error);
|
||||
if (error == NULL) {
|
||||
gsecret_service_removev (service, closure->attributes,
|
||||
secret_service_removev (service, closure->attributes,
|
||||
closure->cancellable, on_delete_complete,
|
||||
g_object_ref (res));
|
||||
g_object_unref (service);
|
||||
@ -507,7 +507,7 @@ on_delete_connect (GObject *source,
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_password_removev (GHashTable *attributes,
|
||||
secret_password_removev (GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@ -519,20 +519,20 @@ gsecret_password_removev (GHashTable *attributes,
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
|
||||
res = g_simple_async_result_new (NULL, callback, user_data,
|
||||
gsecret_password_removev);
|
||||
secret_password_removev);
|
||||
closure = g_slice_new0 (DeleteClosure);
|
||||
closure->attributes = g_hash_table_ref (attributes);
|
||||
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||
g_simple_async_result_set_op_res_gpointer (res, closure, delete_closure_free);
|
||||
|
||||
gsecret_service_get (GSECRET_SERVICE_NONE, cancellable,
|
||||
secret_service_get (SECRET_SERVICE_NONE, cancellable,
|
||||
on_delete_connect, g_object_ref (res));
|
||||
|
||||
g_object_unref (res);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_password_remove_finish (GAsyncResult *result,
|
||||
secret_password_remove_finish (GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
DeleteClosure *closure;
|
||||
@ -540,7 +540,7 @@ gsecret_password_remove_finish (GAsyncResult *result,
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL,
|
||||
gsecret_password_removev), FALSE);
|
||||
secret_password_removev), FALSE);
|
||||
|
||||
res = G_SIMPLE_ASYNC_RESULT (result);
|
||||
if (g_simple_async_result_propagate_error (res, error))
|
||||
@ -551,7 +551,7 @@ gsecret_password_remove_finish (GAsyncResult *result,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_password_remove_sync (const GSecretSchema* schema,
|
||||
secret_password_remove_sync (const SecretSchema* schema,
|
||||
GCancellable *cancellable,
|
||||
GError **error,
|
||||
...)
|
||||
@ -565,10 +565,10 @@ gsecret_password_remove_sync (const GSecretSchema* schema,
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
va_start (va, error);
|
||||
attributes = _gsecret_util_attributes_for_varargs (schema, va);
|
||||
attributes = _secret_util_attributes_for_varargs (schema, va);
|
||||
va_end (va);
|
||||
|
||||
result = gsecret_password_removev_sync (attributes, cancellable, error);
|
||||
result = secret_password_removev_sync (attributes, cancellable, error);
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
|
||||
@ -576,35 +576,35 @@ gsecret_password_remove_sync (const GSecretSchema* schema,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_password_removev_sync (GHashTable *attributes,
|
||||
secret_password_removev_sync (GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GSecretSync *sync;
|
||||
SecretSync *sync;
|
||||
gboolean result;
|
||||
|
||||
g_return_val_if_fail (attributes != NULL, FALSE);
|
||||
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
sync = _gsecret_sync_new ();
|
||||
sync = _secret_sync_new ();
|
||||
g_main_context_push_thread_default (sync->context);
|
||||
|
||||
gsecret_password_removev (attributes, cancellable,
|
||||
_gsecret_sync_on_result, sync);
|
||||
secret_password_removev (attributes, cancellable,
|
||||
_secret_sync_on_result, sync);
|
||||
|
||||
g_main_loop_run (sync->loop);
|
||||
|
||||
result = gsecret_password_remove_finish (sync->result, error);
|
||||
result = secret_password_remove_finish (sync->result, error);
|
||||
|
||||
g_main_context_pop_thread_default (sync->context);
|
||||
_gsecret_sync_free (sync);
|
||||
_secret_sync_free (sync);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_password_free (gpointer password)
|
||||
secret_password_free (gpointer password)
|
||||
{
|
||||
if (password == NULL)
|
||||
return;
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -10,16 +10,16 @@
|
||||
* See the included COPYING file for more information.
|
||||
*/
|
||||
|
||||
#ifndef __GSECRET_PASSWORD_H__
|
||||
#define __GSECRET_PASSWORD_H__
|
||||
#ifndef __SECRET_PASSWORD_H__
|
||||
#define __SECRET_PASSWORD_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#include "gsecret-types.h"
|
||||
#include "secret-types.h"
|
||||
|
||||
void gsecret_password_store (const GSecretSchema *schema,
|
||||
void secret_password_store (const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
const gchar *password,
|
||||
@ -28,7 +28,7 @@ void gsecret_password_store (const GSecretSchema *sc
|
||||
gpointer user_data,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
void gsecret_password_storev (const GSecretSchema *schema,
|
||||
void secret_password_storev (const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
const gchar *password,
|
||||
@ -37,10 +37,10 @@ void gsecret_password_storev (const GSecretSchema *sc
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_password_store_finish (GAsyncResult *result,
|
||||
gboolean secret_password_store_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_password_store_sync (const GSecretSchema *schema,
|
||||
gboolean secret_password_store_sync (const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
const gchar *password,
|
||||
@ -48,7 +48,7 @@ gboolean gsecret_password_store_sync (const GSecretSchema *sc
|
||||
GError **error,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
gboolean gsecret_password_storev_sync (const GSecretSchema *schema,
|
||||
gboolean secret_password_storev_sync (const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *display_name,
|
||||
const gchar *password,
|
||||
@ -56,53 +56,53 @@ gboolean gsecret_password_storev_sync (const GSecretSchema *sc
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_password_lookup (const GSecretSchema *schema,
|
||||
void secret_password_lookup (const SecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
void gsecret_password_lookupv (GHashTable *attributes,
|
||||
void secret_password_lookupv (GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gchar * gsecret_password_lookup_finish (GAsyncResult *result,
|
||||
gchar * secret_password_lookup_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gchar * gsecret_password_lookup_sync (const GSecretSchema *schema,
|
||||
gchar * secret_password_lookup_sync (const SecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GError **error,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
gchar * gsecret_password_lookupv_sync (GHashTable *attributes,
|
||||
gchar * secret_password_lookupv_sync (GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_password_remove (const GSecretSchema *schema,
|
||||
void secret_password_remove (const SecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
void gsecret_password_removev (GHashTable *attributes,
|
||||
void secret_password_removev (GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_password_remove_finish (GAsyncResult *result,
|
||||
gboolean secret_password_remove_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_password_remove_sync (const GSecretSchema* schema,
|
||||
gboolean secret_password_remove_sync (const SecretSchema* schema,
|
||||
GCancellable *cancellable,
|
||||
GError **error,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
gboolean gsecret_password_removev_sync (GHashTable *attributes,
|
||||
gboolean secret_password_removev_sync (GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_password_free (gpointer password);
|
||||
void secret_password_free (gpointer password);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -10,13 +10,13 @@
|
||||
* See the included COPYING file for more information.
|
||||
|
||||
*/
|
||||
#ifndef __GSECRET_PRIVATE_H__
|
||||
#define __GSECRET_PRIVATE_H__
|
||||
#ifndef __SECRET_PRIVATE_H__
|
||||
#define __SECRET_PRIVATE_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "gsecret-service.h"
|
||||
#include "gsecret-value.h"
|
||||
#include "secret-service.h"
|
||||
#include "secret-value.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -24,61 +24,61 @@ typedef struct {
|
||||
GAsyncResult *result;
|
||||
GMainContext *context;
|
||||
GMainLoop *loop;
|
||||
} GSecretSync;
|
||||
} SecretSync;
|
||||
|
||||
typedef struct _GSecretSession GSecretSession;
|
||||
typedef struct _SecretSession SecretSession;
|
||||
|
||||
#define GSECRET_SERVICE_PATH "/org/freedesktop/secrets"
|
||||
#define SECRET_SERVICE_PATH "/org/freedesktop/secrets"
|
||||
|
||||
#define GSECRET_SERVICE_BUS_NAME "org.freedesktop.Secret.Service"
|
||||
#define SECRET_SERVICE_BUS_NAME "org.freedesktop.Secret.Service"
|
||||
|
||||
#define GSECRET_ITEM_INTERFACE "org.freedesktop.Secret.Item"
|
||||
#define GSECRET_COLLECTION_INTERFACE "org.freedesktop.Secret.Collection"
|
||||
#define GSECRET_PROMPT_INTERFACE "org.freedesktop.Secret.Prompt"
|
||||
#define GSECRET_SERVICE_INTERFACE "org.freedesktop.Secret.Service"
|
||||
#define SECRET_ITEM_INTERFACE "org.freedesktop.Secret.Item"
|
||||
#define SECRET_COLLECTION_INTERFACE "org.freedesktop.Secret.Collection"
|
||||
#define SECRET_PROMPT_INTERFACE "org.freedesktop.Secret.Prompt"
|
||||
#define SECRET_SERVICE_INTERFACE "org.freedesktop.Secret.Service"
|
||||
|
||||
#define GSECRET_PROMPT_SIGNAL_COMPLETED "Completed"
|
||||
#define SECRET_PROMPT_SIGNAL_COMPLETED "Completed"
|
||||
|
||||
#define GSECRET_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
|
||||
#define SECRET_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
|
||||
|
||||
GSecretSync * _gsecret_sync_new (void);
|
||||
SecretSync * _secret_sync_new (void);
|
||||
|
||||
void _gsecret_sync_free (gpointer data);
|
||||
void _secret_sync_free (gpointer data);
|
||||
|
||||
void _gsecret_sync_on_result (GObject *source,
|
||||
void _secret_sync_on_result (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretPrompt * _gsecret_prompt_instance (GDBusConnection *connection,
|
||||
SecretPrompt * _secret_prompt_instance (GDBusConnection *connection,
|
||||
const gchar *object_path);
|
||||
|
||||
gchar * _gsecret_util_parent_path (const gchar *path);
|
||||
gchar * _secret_util_parent_path (const gchar *path);
|
||||
|
||||
gboolean _gsecret_util_empty_path (const gchar *path);
|
||||
gboolean _secret_util_empty_path (const gchar *path);
|
||||
|
||||
GType _gsecret_list_get_type (void) G_GNUC_CONST;
|
||||
GType _secret_list_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GVariant * _gsecret_util_variant_for_attributes (GHashTable *attributes);
|
||||
GVariant * _secret_util_variant_for_attributes (GHashTable *attributes);
|
||||
|
||||
GHashTable * _gsecret_util_attributes_for_variant (GVariant *variant);
|
||||
GHashTable * _secret_util_attributes_for_variant (GVariant *variant);
|
||||
|
||||
GHashTable * _gsecret_util_attributes_for_varargs (const GSecretSchema *schema,
|
||||
GHashTable * _secret_util_attributes_for_varargs (const SecretSchema *schema,
|
||||
va_list va);
|
||||
|
||||
GVariant * _gsecret_util_variant_for_properties (GHashTable *properties);
|
||||
GVariant * _secret_util_variant_for_properties (GHashTable *properties);
|
||||
|
||||
void _gsecret_util_get_properties (GDBusProxy *proxy,
|
||||
void _secret_util_get_properties (GDBusProxy *proxy,
|
||||
gpointer result_tag,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean _gsecret_util_get_properties_finish (GDBusProxy *proxy,
|
||||
gboolean _secret_util_get_properties_finish (GDBusProxy *proxy,
|
||||
gpointer result_tag,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void _gsecret_util_set_property (GDBusProxy *proxy,
|
||||
void _secret_util_set_property (GDBusProxy *proxy,
|
||||
const gchar *property,
|
||||
GVariant *value,
|
||||
gpointer result_tag,
|
||||
@ -86,59 +86,59 @@ void _gsecret_util_set_property (GDBusProxy *prox
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean _gsecret_util_set_property_finish (GDBusProxy *proxy,
|
||||
gboolean _secret_util_set_property_finish (GDBusProxy *proxy,
|
||||
gpointer result_tag,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean _gsecret_util_set_property_sync (GDBusProxy *proxy,
|
||||
gboolean _secret_util_set_property_sync (GDBusProxy *proxy,
|
||||
const gchar *property,
|
||||
GVariant *value,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean _gsecret_util_have_cached_properties (GDBusProxy *proxy);
|
||||
gboolean _secret_util_have_cached_properties (GDBusProxy *proxy);
|
||||
|
||||
void _gsecret_service_set_default_bus_name (const gchar *bus_name);
|
||||
void _secret_service_set_default_bus_name (const gchar *bus_name);
|
||||
|
||||
GSecretSession * _gsecret_service_get_session (GSecretService *self);
|
||||
SecretSession * _secret_service_get_session (SecretService *self);
|
||||
|
||||
void _gsecret_service_take_session (GSecretService *self,
|
||||
GSecretSession *session);
|
||||
void _secret_service_take_session (SecretService *self,
|
||||
SecretSession *session);
|
||||
|
||||
void _gsecret_service_delete_path (GSecretService *self,
|
||||
void _secret_service_delete_path (SecretService *self,
|
||||
const gchar *object_path,
|
||||
gboolean is_an_item,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretItem * _gsecret_service_find_item_instance (GSecretService *self,
|
||||
SecretItem * _secret_service_find_item_instance (SecretService *self,
|
||||
const gchar *item_path);
|
||||
|
||||
GSecretItem * _gsecret_collection_find_item_instance (GSecretCollection *self,
|
||||
SecretItem * _secret_collection_find_item_instance (SecretCollection *self,
|
||||
const gchar *item_path);
|
||||
|
||||
gchar * _gsecret_value_unref_to_password (GSecretValue *value);
|
||||
gchar * _secret_value_unref_to_password (SecretValue *value);
|
||||
|
||||
void _gsecret_session_free (gpointer data);
|
||||
void _secret_session_free (gpointer data);
|
||||
|
||||
const gchar * _gsecret_session_get_algorithms (GSecretSession *session);
|
||||
const gchar * _secret_session_get_algorithms (SecretSession *session);
|
||||
|
||||
const gchar * _gsecret_session_get_path (GSecretSession *session);
|
||||
const gchar * _secret_session_get_path (SecretSession *session);
|
||||
|
||||
void _gsecret_session_open (GSecretService *service,
|
||||
void _secret_session_open (SecretService *service,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean _gsecret_session_open_finish (GAsyncResult *result,
|
||||
gboolean _secret_session_open_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GVariant * _gsecret_session_encode_secret (GSecretSession *session,
|
||||
GSecretValue *value);
|
||||
GVariant * _secret_session_encode_secret (SecretSession *session,
|
||||
SecretValue *value);
|
||||
|
||||
GSecretValue * _gsecret_session_decode_secret (GSecretSession *session,
|
||||
SecretValue * _secret_session_decode_secret (SecretSession *session,
|
||||
GVariant *encoded);
|
||||
|
||||
G_END_DECLS
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Prompt
|
||||
/* libsecret - GLib wrapper for Secret Prompt
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -12,53 +12,53 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-dbus-generated.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "gsecret-prompt.h"
|
||||
#include "secret-dbus-generated.h"
|
||||
#include "secret-private.h"
|
||||
#include "secret-prompt.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <gcrypt.h>
|
||||
|
||||
typedef struct _GSecretPromptPrivate {
|
||||
typedef struct _SecretPromptPrivate {
|
||||
/* Locked by mutex */
|
||||
GMutex mutex;
|
||||
gint prompted;
|
||||
GVariant *last_result;
|
||||
} GSecretPromptPrivate;
|
||||
} SecretPromptPrivate;
|
||||
|
||||
G_DEFINE_TYPE (GSecretPrompt, gsecret_prompt, G_TYPE_DBUS_PROXY);
|
||||
G_DEFINE_TYPE (SecretPrompt, secret_prompt, G_TYPE_DBUS_PROXY);
|
||||
|
||||
static void
|
||||
gsecret_prompt_init (GSecretPrompt *self)
|
||||
secret_prompt_init (SecretPrompt *self)
|
||||
{
|
||||
self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GSECRET_TYPE_PROMPT,
|
||||
GSecretPromptPrivate);
|
||||
self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SECRET_TYPE_PROMPT,
|
||||
SecretPromptPrivate);
|
||||
|
||||
g_mutex_init (&self->pv->mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
gsecret_prompt_finalize (GObject *obj)
|
||||
secret_prompt_finalize (GObject *obj)
|
||||
{
|
||||
GSecretPrompt *self = GSECRET_PROMPT (obj);
|
||||
SecretPrompt *self = SECRET_PROMPT (obj);
|
||||
|
||||
g_mutex_clear (&self->pv->mutex);
|
||||
if (self->pv->last_result)
|
||||
g_variant_unref (self->pv->last_result);
|
||||
|
||||
G_OBJECT_CLASS (gsecret_prompt_parent_class)->finalize (obj);
|
||||
G_OBJECT_CLASS (secret_prompt_parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
gsecret_prompt_class_init (GSecretPromptClass *klass)
|
||||
secret_prompt_class_init (SecretPromptClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gsecret_prompt_finalize;
|
||||
object_class->finalize = secret_prompt_finalize;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GSecretPromptPrivate));
|
||||
g_type_class_add_private (klass, sizeof (SecretPromptPrivate));
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@ -76,29 +76,29 @@ on_prompt_run_complete (GObject *source,
|
||||
g_main_loop_quit (closure->loop);
|
||||
}
|
||||
|
||||
GSecretPrompt *
|
||||
gsecret_prompt_instance (GSecretService *service,
|
||||
SecretPrompt *
|
||||
secret_prompt_instance (SecretService *service,
|
||||
const gchar *prompt_path)
|
||||
{
|
||||
GDBusProxy *proxy;
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_val_if_fail (GSECRET_IS_SERVICE (service), NULL);
|
||||
g_return_val_if_fail (SECRET_IS_SERVICE (service), NULL);
|
||||
g_return_val_if_fail (prompt_path != NULL, NULL);
|
||||
|
||||
proxy = G_DBUS_PROXY (service);
|
||||
prompt = g_initable_new (GSECRET_TYPE_PROMPT, NULL, &error,
|
||||
prompt = g_initable_new (SECRET_TYPE_PROMPT, NULL, &error,
|
||||
"g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
|
||||
"g-interface-info", _gsecret_gen_prompt_interface_info (),
|
||||
"g-interface-info", _secret_gen_prompt_interface_info (),
|
||||
"g-name", g_dbus_proxy_get_name (proxy),
|
||||
"g-connection", g_dbus_proxy_get_connection (proxy),
|
||||
"g-object-path", prompt_path,
|
||||
"g-interface-name", GSECRET_PROMPT_INTERFACE,
|
||||
"g-interface-name", SECRET_PROMPT_INTERFACE,
|
||||
NULL);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning ("couldn't create GSecretPrompt object: %s", error->message);
|
||||
g_warning ("couldn't create SecretPrompt object: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
return NULL;
|
||||
}
|
||||
@ -107,7 +107,7 @@ gsecret_prompt_instance (GSecretService *service,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_prompt_run (GSecretPrompt *self,
|
||||
secret_prompt_run (SecretPrompt *self,
|
||||
gulong window_id,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
@ -116,7 +116,7 @@ gsecret_prompt_run (GSecretPrompt *self,
|
||||
RunClosure *closure;
|
||||
gboolean ret;
|
||||
|
||||
g_return_val_if_fail (GSECRET_IS_PROMPT (self), FALSE);
|
||||
g_return_val_if_fail (SECRET_IS_PROMPT (self), FALSE);
|
||||
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
@ -125,12 +125,12 @@ gsecret_prompt_run (GSecretPrompt *self,
|
||||
closure = g_new0 (RunClosure, 1);
|
||||
closure->loop = g_main_loop_new (context, FALSE);
|
||||
|
||||
gsecret_prompt_perform (self, window_id, cancellable,
|
||||
secret_prompt_perform (self, window_id, cancellable,
|
||||
on_prompt_run_complete, closure);
|
||||
|
||||
g_main_loop_run (closure->loop);
|
||||
|
||||
ret = gsecret_prompt_perform_finish (self, closure->result, error);
|
||||
ret = secret_prompt_perform_finish (self, closure->result, error);
|
||||
|
||||
g_main_loop_unref (closure->loop);
|
||||
g_object_unref (closure->result);
|
||||
@ -140,7 +140,7 @@ gsecret_prompt_run (GSecretPrompt *self,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_prompt_perform_sync (GSecretPrompt *self,
|
||||
secret_prompt_perform_sync (SecretPrompt *self,
|
||||
gulong window_id,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
@ -148,14 +148,14 @@ gsecret_prompt_perform_sync (GSecretPrompt *self,
|
||||
GMainContext *context;
|
||||
gboolean ret;
|
||||
|
||||
g_return_val_if_fail (GSECRET_IS_PROMPT (self), FALSE);
|
||||
g_return_val_if_fail (SECRET_IS_PROMPT (self), FALSE);
|
||||
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
context = g_main_context_new ();
|
||||
g_main_context_push_thread_default (context);
|
||||
|
||||
ret = gsecret_prompt_run (self, window_id, cancellable, error);
|
||||
ret = secret_prompt_run (self, window_id, cancellable, error);
|
||||
|
||||
/* Needed to prevent memory leaks */
|
||||
while (g_main_context_iteration (context, FALSE));
|
||||
@ -227,14 +227,14 @@ on_prompt_completed (GDBusConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
||||
GSecretPrompt *self = GSECRET_PROMPT (g_async_result_get_source_object (user_data));
|
||||
SecretPrompt *self = SECRET_PROMPT (g_async_result_get_source_object (user_data));
|
||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
gboolean dismissed;
|
||||
|
||||
closure->prompting = FALSE;
|
||||
|
||||
if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(bv)"))) {
|
||||
g_warning ("GSecretPrompt received invalid %s signal of type %s",
|
||||
g_warning ("SecretPrompt received invalid %s signal of type %s",
|
||||
signal_name, g_variant_get_type_string (parameters));
|
||||
perform_prompt_complete (res, TRUE);
|
||||
|
||||
@ -256,7 +256,7 @@ on_prompt_prompted (GObject *source,
|
||||
{
|
||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GSecretPrompt *self = GSECRET_PROMPT (source);
|
||||
SecretPrompt *self = SECRET_PROMPT (source);
|
||||
GError *error = NULL;
|
||||
GVariant *retval;
|
||||
|
||||
@ -302,7 +302,7 @@ on_prompt_dismissed (GObject *source,
|
||||
{
|
||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GSecretPrompt *self = GSECRET_PROMPT (source);
|
||||
SecretPrompt *self = SECRET_PROMPT (source);
|
||||
GError *error = NULL;
|
||||
GVariant *retval;
|
||||
|
||||
@ -329,7 +329,7 @@ on_prompt_cancelled (GCancellable *cancellable,
|
||||
{
|
||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
||||
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GSecretPrompt *self = GSECRET_PROMPT (g_async_result_get_source_object (user_data));
|
||||
SecretPrompt *self = SECRET_PROMPT (g_async_result_get_source_object (user_data));
|
||||
|
||||
/* Instead of cancelling our dbus calls, we cancel the prompt itself via this dbus call */
|
||||
|
||||
@ -342,7 +342,7 @@ on_prompt_cancelled (GCancellable *cancellable,
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_prompt_perform (GSecretPrompt *self,
|
||||
secret_prompt_perform (SecretPrompt *self,
|
||||
gulong window_id,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
@ -356,7 +356,7 @@ gsecret_prompt_perform (GSecretPrompt *self,
|
||||
GDBusProxy *proxy;
|
||||
gchar *window;
|
||||
|
||||
g_return_if_fail (GSECRET_IS_PROMPT (self));
|
||||
g_return_if_fail (SECRET_IS_PROMPT (self));
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
|
||||
g_mutex_lock (&self->pv->mutex);
|
||||
@ -371,7 +371,7 @@ gsecret_prompt_perform (GSecretPrompt *self,
|
||||
proxy = G_DBUS_PROXY (self);
|
||||
|
||||
res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
|
||||
gsecret_prompt_perform);
|
||||
secret_prompt_perform);
|
||||
closure = g_slice_new0 (PerformClosure);
|
||||
closure->connection = g_object_ref (g_dbus_proxy_get_connection (proxy));
|
||||
closure->call_cancellable = g_cancellable_new ();
|
||||
@ -387,8 +387,8 @@ gsecret_prompt_perform (GSecretPrompt *self,
|
||||
object_path = g_dbus_proxy_get_object_path (proxy);
|
||||
|
||||
closure->signal = g_dbus_connection_signal_subscribe (closure->connection, owner_name,
|
||||
GSECRET_PROMPT_INTERFACE,
|
||||
GSECRET_PROMPT_SIGNAL_COMPLETED,
|
||||
SECRET_PROMPT_INTERFACE,
|
||||
SECRET_PROMPT_SIGNAL_COMPLETED,
|
||||
object_path, NULL,
|
||||
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||
on_prompt_completed,
|
||||
@ -416,17 +416,17 @@ gsecret_prompt_perform (GSecretPrompt *self,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsecret_prompt_perform_finish (GSecretPrompt *self,
|
||||
secret_prompt_perform_finish (SecretPrompt *self,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
PerformClosure *closure;
|
||||
GSimpleAsyncResult *res;
|
||||
|
||||
g_return_val_if_fail (GSECRET_IS_PROMPT (self), FALSE);
|
||||
g_return_val_if_fail (SECRET_IS_PROMPT (self), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self),
|
||||
gsecret_prompt_perform), FALSE);
|
||||
secret_prompt_perform), FALSE);
|
||||
|
||||
res = G_SIMPLE_ASYNC_RESULT (result);
|
||||
|
||||
@ -438,13 +438,13 @@ gsecret_prompt_perform_finish (GSecretPrompt *self,
|
||||
}
|
||||
|
||||
GVariant *
|
||||
gsecret_prompt_get_result_value (GSecretPrompt *self,
|
||||
secret_prompt_get_result_value (SecretPrompt *self,
|
||||
const GVariantType *expected_type)
|
||||
{
|
||||
GVariant *last_result;
|
||||
gchar *string;
|
||||
|
||||
g_return_val_if_fail (GSECRET_IS_PROMPT (self), NULL);
|
||||
g_return_val_if_fail (SECRET_IS_PROMPT (self), NULL);
|
||||
|
||||
g_mutex_lock (&self->pv->mutex);
|
||||
if (self->pv->last_result)
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -10,61 +10,61 @@
|
||||
* See the included COPYING file for more information.
|
||||
*/
|
||||
|
||||
#ifndef __GSECRET_PROMPT_H__
|
||||
#define __GSECRET_PROMPT_H__
|
||||
#ifndef __SECRET_PROMPT_H__
|
||||
#define __SECRET_PROMPT_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "gsecret-types.h"
|
||||
#include "secret-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSECRET_TYPE_PROMPT (gsecret_prompt_get_type ())
|
||||
#define GSECRET_PROMPT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), GSECRET_TYPE_PROMPT, GSecretPrompt))
|
||||
#define GSECRET_PROMPT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), GSECRET_TYPE_PROMPT, GSecretPromptClass))
|
||||
#define GSECRET_IS_PROMPT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), GSECRET_TYPE_PROMPT))
|
||||
#define GSECRET_IS_PROMPT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), GSECRET_TYPE_PROMPT))
|
||||
#define GSECRET_PROMPT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GSECRET_TYPE_PROMPT, GSecretPromptClass))
|
||||
#define SECRET_TYPE_PROMPT (secret_prompt_get_type ())
|
||||
#define SECRET_PROMPT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_PROMPT, SecretPrompt))
|
||||
#define SECRET_PROMPT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_PROMPT, SecretPromptClass))
|
||||
#define SECRET_IS_PROMPT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_PROMPT))
|
||||
#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 _GSecretPromptClass GSecretPromptClass;
|
||||
typedef struct _GSecretPromptPrivate GSecretPromptPrivate;
|
||||
typedef struct _SecretPromptClass SecretPromptClass;
|
||||
typedef struct _SecretPromptPrivate SecretPromptPrivate;
|
||||
|
||||
struct _GSecretPrompt {
|
||||
struct _SecretPrompt {
|
||||
GDBusProxy parent_instance;
|
||||
GSecretPromptPrivate *pv;
|
||||
SecretPromptPrivate *pv;
|
||||
};
|
||||
|
||||
struct _GSecretPromptClass {
|
||||
struct _SecretPromptClass {
|
||||
GDBusProxyClass parent_class;
|
||||
gpointer padding[8];
|
||||
};
|
||||
|
||||
GType gsecret_prompt_get_type (void) G_GNUC_CONST;
|
||||
GType secret_prompt_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GSecretPrompt * gsecret_prompt_instance (GSecretService *service,
|
||||
SecretPrompt * secret_prompt_instance (SecretService *service,
|
||||
const gchar *prompt_path);
|
||||
|
||||
gboolean gsecret_prompt_run (GSecretPrompt *self,
|
||||
gboolean secret_prompt_run (SecretPrompt *self,
|
||||
gulong window_id,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_prompt_perform_sync (GSecretPrompt *self,
|
||||
gboolean secret_prompt_perform_sync (SecretPrompt *self,
|
||||
gulong window_id,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_prompt_perform (GSecretPrompt *self,
|
||||
void secret_prompt_perform (SecretPrompt *self,
|
||||
gulong window_id,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_prompt_perform_finish (GSecretPrompt *self,
|
||||
gboolean secret_prompt_perform_finish (SecretPrompt *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GVariant * gsecret_prompt_get_result_value (GSecretPrompt *self,
|
||||
GVariant * secret_prompt_get_result_value (SecretPrompt *self,
|
||||
const GVariantType *expected_type);
|
||||
|
||||
G_END_DECLS
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
@ -11,441 +11,441 @@
|
||||
* See the included COPYING file for more information.
|
||||
*/
|
||||
|
||||
#ifndef __GSECRET_SERVICE_H__
|
||||
#define __GSECRET_SERVICE_H__
|
||||
#ifndef __SECRET_SERVICE_H__
|
||||
#define __SECRET_SERVICE_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "gsecret-prompt.h"
|
||||
#include "gsecret-types.h"
|
||||
#include "gsecret-value.h"
|
||||
#include "secret-prompt.h"
|
||||
#include "secret-types.h"
|
||||
#include "secret-value.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
GSECRET_SERVICE_NONE,
|
||||
GSECRET_SERVICE_OPEN_SESSION = 1 << 1,
|
||||
GSECRET_SERVICE_LOAD_COLLECTIONS = 1 << 2,
|
||||
} GSecretServiceFlags;
|
||||
SECRET_SERVICE_NONE,
|
||||
SECRET_SERVICE_OPEN_SESSION = 1 << 1,
|
||||
SECRET_SERVICE_LOAD_COLLECTIONS = 1 << 2,
|
||||
} SecretServiceFlags;
|
||||
|
||||
#define GSECRET_TYPE_SERVICE (gsecret_service_get_type ())
|
||||
#define GSECRET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), GSECRET_TYPE_SERVICE, GSecretService))
|
||||
#define GSECRET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), GSECRET_TYPE_SERVICE, GSecretServiceClass))
|
||||
#define GSECRET_IS_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), GSECRET_TYPE_SERVICE))
|
||||
#define GSECRET_IS_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), GSECRET_TYPE_SERVICE))
|
||||
#define GSECRET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GSECRET_TYPE_SERVICE, GSecretServiceClass))
|
||||
#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))
|
||||
#define SECRET_IS_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_SERVICE))
|
||||
#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 _GSecretServiceClass GSecretServiceClass;
|
||||
typedef struct _GSecretServicePrivate GSecretServicePrivate;
|
||||
typedef struct _SecretServiceClass SecretServiceClass;
|
||||
typedef struct _SecretServicePrivate SecretServicePrivate;
|
||||
|
||||
struct _GSecretService {
|
||||
struct _SecretService {
|
||||
GDBusProxy parent;
|
||||
GSecretServicePrivate *pv;
|
||||
SecretServicePrivate *pv;
|
||||
};
|
||||
|
||||
struct _GSecretServiceClass {
|
||||
struct _SecretServiceClass {
|
||||
GDBusProxyClass parent_class;
|
||||
|
||||
GType collection_gtype;
|
||||
GType item_gtype;
|
||||
|
||||
gboolean (*prompt_sync) (GSecretService *self,
|
||||
GSecretPrompt *prompt,
|
||||
gboolean (*prompt_sync) (SecretService *self,
|
||||
SecretPrompt *prompt,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void (*prompt_async) (GSecretService *self,
|
||||
GSecretPrompt *prompt,
|
||||
void (*prompt_async) (SecretService *self,
|
||||
SecretPrompt *prompt,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean (*prompt_finish) (GSecretService *self,
|
||||
gboolean (*prompt_finish) (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gpointer padding[16];
|
||||
};
|
||||
|
||||
GType gsecret_service_get_type (void) G_GNUC_CONST;
|
||||
GType secret_service_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gsecret_service_get (GSecretServiceFlags flags,
|
||||
void secret_service_get (SecretServiceFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretService * gsecret_service_get_finish (GAsyncResult *result,
|
||||
SecretService * secret_service_get_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GSecretService * gsecret_service_get_sync (GSecretServiceFlags flags,
|
||||
SecretService * secret_service_get_sync (SecretServiceFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_new (const gchar *service_bus_name,
|
||||
GSecretServiceFlags flags,
|
||||
void secret_service_new (const gchar *service_bus_name,
|
||||
SecretServiceFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretService * gsecret_service_new_finish (GAsyncResult *result,
|
||||
SecretService * secret_service_new_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GSecretService * gsecret_service_new_sync (const gchar *service_bus_name,
|
||||
GSecretServiceFlags flags,
|
||||
SecretService * secret_service_new_sync (const gchar *service_bus_name,
|
||||
SecretServiceFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
GSecretServiceFlags gsecret_service_get_flags (GSecretService *self);
|
||||
SecretServiceFlags secret_service_get_flags (SecretService *self);
|
||||
|
||||
const gchar * gsecret_service_get_session_algorithms (GSecretService *self);
|
||||
const gchar * secret_service_get_session_algorithms (SecretService *self);
|
||||
|
||||
const gchar * gsecret_service_get_session_path (GSecretService *self);
|
||||
const gchar * secret_service_get_session_path (SecretService *self);
|
||||
|
||||
GList * gsecret_service_get_collections (GSecretService *self);
|
||||
GList * secret_service_get_collections (SecretService *self);
|
||||
|
||||
void gsecret_service_ensure_session (GSecretService *self,
|
||||
void secret_service_ensure_session (SecretService *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
const gchar * gsecret_service_ensure_session_finish (GSecretService *self,
|
||||
const gchar * secret_service_ensure_session_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
const gchar * gsecret_service_ensure_session_sync (GSecretService *self,
|
||||
const gchar * secret_service_ensure_session_sync (SecretService *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_ensure_collections (GSecretService *self,
|
||||
void secret_service_ensure_collections (SecretService *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_service_ensure_collections_finish (GSecretService *self,
|
||||
gboolean secret_service_ensure_collections_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_service_ensure_collections_sync (GSecretService *self,
|
||||
gboolean secret_service_ensure_collections_sync (SecretService *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_search (GSecretService *self,
|
||||
void secret_service_search (SecretService *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_service_search_finish (GSecretService *self,
|
||||
gboolean secret_service_search_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GList **unlocked,
|
||||
GList **locked,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_service_search_sync (GSecretService *self,
|
||||
gboolean secret_service_search_sync (SecretService *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GList **unlocked,
|
||||
GList **locked,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_search_for_paths (GSecretService *self,
|
||||
void secret_service_search_for_paths (SecretService *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_service_search_for_paths_finish (GSecretService *self,
|
||||
gboolean secret_service_search_for_paths_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
gchar ***unlocked,
|
||||
gchar ***locked,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_service_search_for_paths_sync (GSecretService *self,
|
||||
gboolean secret_service_search_for_paths_sync (SecretService *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
gchar ***unlocked,
|
||||
gchar ***locked,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_get_secret_for_path (GSecretService *self,
|
||||
void secret_service_get_secret_for_path (SecretService *self,
|
||||
const gchar *object_path,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretValue * gsecret_service_get_secret_for_path_finish (GSecretService *self,
|
||||
SecretValue * secret_service_get_secret_for_path_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GSecretValue * gsecret_service_get_secret_for_path_sync (GSecretService *self,
|
||||
SecretValue * secret_service_get_secret_for_path_sync (SecretService *self,
|
||||
const gchar *object_path,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_get_secrets_for_paths (GSecretService *self,
|
||||
void secret_service_get_secrets_for_paths (SecretService *self,
|
||||
const gchar **object_paths,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GHashTable * gsecret_service_get_secrets_for_paths_finish (GSecretService *self,
|
||||
GHashTable * secret_service_get_secrets_for_paths_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GHashTable * gsecret_service_get_secrets_for_paths_sync (GSecretService *self,
|
||||
GHashTable * secret_service_get_secrets_for_paths_sync (SecretService *self,
|
||||
const gchar **object_paths,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_get_secrets (GSecretService *self,
|
||||
void secret_service_get_secrets (SecretService *self,
|
||||
GList *items,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GHashTable * gsecret_service_get_secrets_finish (GSecretService *self,
|
||||
GHashTable * secret_service_get_secrets_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GHashTable * gsecret_service_get_secrets_sync (GSecretService *self,
|
||||
GHashTable * secret_service_get_secrets_sync (SecretService *self,
|
||||
GList *items,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_lock (GSecretService *self,
|
||||
void secret_service_lock (SecretService *self,
|
||||
GList *objects,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gint gsecret_service_lock_finish (GSecretService *self,
|
||||
gint secret_service_lock_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GList **locked,
|
||||
GError **error);
|
||||
|
||||
gint gsecret_service_lock_sync (GSecretService *self,
|
||||
gint secret_service_lock_sync (SecretService *self,
|
||||
GList *objects,
|
||||
GCancellable *cancellable,
|
||||
GList **locked,
|
||||
GError **error);
|
||||
|
||||
gint gsecret_service_lock_paths_sync (GSecretService *self,
|
||||
gint secret_service_lock_paths_sync (SecretService *self,
|
||||
const gchar **paths,
|
||||
GCancellable *cancellable,
|
||||
gchar ***locked,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_lock_paths (GSecretService *self,
|
||||
void secret_service_lock_paths (SecretService *self,
|
||||
const gchar **paths,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gint gsecret_service_lock_paths_finish (GSecretService *self,
|
||||
gint secret_service_lock_paths_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
gchar ***locked,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_unlock (GSecretService *self,
|
||||
void secret_service_unlock (SecretService *self,
|
||||
GList *objects,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gint gsecret_service_unlock_finish (GSecretService *self,
|
||||
gint secret_service_unlock_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GList **unlocked,
|
||||
GError **error);
|
||||
|
||||
gint gsecret_service_unlock_sync (GSecretService *self,
|
||||
gint secret_service_unlock_sync (SecretService *self,
|
||||
GList *objects,
|
||||
GCancellable *cancellable,
|
||||
GList **unlocked,
|
||||
GError **error);
|
||||
|
||||
gint gsecret_service_unlock_paths_sync (GSecretService *self,
|
||||
gint secret_service_unlock_paths_sync (SecretService *self,
|
||||
const gchar **paths,
|
||||
GCancellable *cancellable,
|
||||
gchar ***unlocked,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_unlock_paths (GSecretService *self,
|
||||
void secret_service_unlock_paths (SecretService *self,
|
||||
const gchar **paths,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gint gsecret_service_unlock_paths_finish (GSecretService *self,
|
||||
gint secret_service_unlock_paths_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
gchar ***unlocked,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_service_prompt_sync (GSecretService *self,
|
||||
GSecretPrompt *prompt,
|
||||
gboolean secret_service_prompt_sync (SecretService *self,
|
||||
SecretPrompt *prompt,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_prompt (GSecretService *self,
|
||||
GSecretPrompt *prompt,
|
||||
void secret_service_prompt (SecretService *self,
|
||||
SecretPrompt *prompt,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_service_prompt_finish (GSecretService *self,
|
||||
gboolean secret_service_prompt_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_store (GSecretService *self,
|
||||
const GSecretSchema *schema,
|
||||
void secret_service_store (SecretService *self,
|
||||
const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
GSecretValue *value,
|
||||
SecretValue *value,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
void gsecret_service_storev (GSecretService *self,
|
||||
const GSecretSchema *schema,
|
||||
void secret_service_storev (SecretService *self,
|
||||
const SecretSchema *schema,
|
||||
GHashTable *attributes,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
GSecretValue *value,
|
||||
SecretValue *value,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_service_store_finish (GSecretService *self,
|
||||
gboolean secret_service_store_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_service_store_sync (GSecretService *self,
|
||||
const GSecretSchema *schema,
|
||||
gboolean secret_service_store_sync (SecretService *self,
|
||||
const SecretSchema *schema,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
GSecretValue *value,
|
||||
SecretValue *value,
|
||||
GCancellable *cancellable,
|
||||
GError **error,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
gboolean gsecret_service_storev_sync (GSecretService *self,
|
||||
const GSecretSchema *schema,
|
||||
gboolean secret_service_storev_sync (SecretService *self,
|
||||
const SecretSchema *schema,
|
||||
GHashTable *attributes,
|
||||
const gchar *collection_path,
|
||||
const gchar *label,
|
||||
GSecretValue *value,
|
||||
SecretValue *value,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_lookup (GSecretService *self,
|
||||
const GSecretSchema *schema,
|
||||
void secret_service_lookup (SecretService *self,
|
||||
const SecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
void gsecret_service_lookupv (GSecretService *self,
|
||||
void secret_service_lookupv (SecretService *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
GSecretValue * gsecret_service_lookup_finish (GSecretService *self,
|
||||
SecretValue * secret_service_lookup_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GSecretValue * gsecret_service_lookup_sync (GSecretService *self,
|
||||
const GSecretSchema *schema,
|
||||
SecretValue * secret_service_lookup_sync (SecretService *self,
|
||||
const SecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GError **error,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
GSecretValue * gsecret_service_lookupv_sync (GSecretService *self,
|
||||
SecretValue * secret_service_lookupv_sync (SecretService *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_delete_path (GSecretService *self,
|
||||
void secret_service_delete_path (SecretService *self,
|
||||
const gchar *object_path,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_service_delete_path_finish (GSecretService *self,
|
||||
gboolean secret_service_delete_path_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_service_delete_path_sync (GSecretService *self,
|
||||
gboolean secret_service_delete_path_sync (SecretService *self,
|
||||
const gchar *object_path,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_remove (GSecretService *self,
|
||||
const GSecretSchema *schema,
|
||||
void secret_service_remove (SecretService *self,
|
||||
const SecretSchema *schema,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
void gsecret_service_removev (GSecretService *self,
|
||||
void secret_service_removev (SecretService *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean gsecret_service_remove_finish (GSecretService *self,
|
||||
gboolean secret_service_remove_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean gsecret_service_remove_sync (GSecretService *self,
|
||||
const GSecretSchema* schema,
|
||||
gboolean secret_service_remove_sync (SecretService *self,
|
||||
const SecretSchema* schema,
|
||||
GCancellable *cancellable,
|
||||
GError **error,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
gboolean gsecret_service_removev_sync (GSecretService *self,
|
||||
gboolean secret_service_removev_sync (SecretService *self,
|
||||
GHashTable *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_create_collection_path (GSecretService *self,
|
||||
void secret_service_create_collection_path (SecretService *self,
|
||||
GHashTable *properties,
|
||||
const gchar *alias,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gchar * gsecret_service_create_collection_path_finish (GSecretService *self,
|
||||
gchar * secret_service_create_collection_path_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gchar * gsecret_service_create_collection_path_sync (GSecretService *self,
|
||||
gchar * secret_service_create_collection_path_sync (SecretService *self,
|
||||
GHashTable *properties,
|
||||
const gchar *alias,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void gsecret_service_create_item_path (GSecretService *self,
|
||||
void secret_service_create_item_path (SecretService *self,
|
||||
const gchar *collection_path,
|
||||
GHashTable *properties,
|
||||
GSecretValue *value,
|
||||
SecretValue *value,
|
||||
gboolean replace,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gchar * gsecret_service_create_item_path_finish (GSecretService *self,
|
||||
gchar * secret_service_create_item_path_finish (SecretService *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gchar * gsecret_service_create_item_path_sync (GSecretService *self,
|
||||
gchar * secret_service_create_item_path_sync (SecretService *self,
|
||||
const gchar *collection_path,
|
||||
GHashTable *properties,
|
||||
GSecretValue *value,
|
||||
SecretValue *value,
|
||||
gboolean replace,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSECRET_SERVICE_H___ */
|
||||
#endif /* __SECRET_SERVICE_H___ */
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-private.h"
|
||||
#include "secret-private.h"
|
||||
|
||||
#ifdef WITH_GCRYPT
|
||||
#include "egg/egg-dh.h"
|
||||
@ -31,7 +31,7 @@ EGG_SECURE_DECLARE (secret_session);
|
||||
#define ALGORITHMS_AES "dh-ietf1024-sha256-aes128-cbc-pkcs7"
|
||||
#define ALGORITHMS_PLAIN "plain"
|
||||
|
||||
struct _GSecretSession {
|
||||
struct _SecretSession {
|
||||
gchar *path;
|
||||
const gchar *algorithms;
|
||||
#ifdef WITH_GCRYPT
|
||||
@ -44,9 +44,9 @@ struct _GSecretSession {
|
||||
};
|
||||
|
||||
void
|
||||
_gsecret_session_free (gpointer data)
|
||||
_secret_session_free (gpointer data)
|
||||
{
|
||||
GSecretSession *session = data;
|
||||
SecretSession *session = data;
|
||||
|
||||
if (session == NULL)
|
||||
return;
|
||||
@ -64,7 +64,7 @@ _gsecret_session_free (gpointer data)
|
||||
#ifdef WITH_GCRYPT
|
||||
|
||||
static GVariant *
|
||||
request_open_session_aes (GSecretSession *session)
|
||||
request_open_session_aes (SecretSession *session)
|
||||
{
|
||||
gcry_error_t gcry;
|
||||
gcry_mpi_t base;
|
||||
@ -104,7 +104,7 @@ request_open_session_aes (GSecretSession *session)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
response_open_session_aes (GSecretSession *session,
|
||||
response_open_session_aes (SecretSession *session,
|
||||
GVariant *response)
|
||||
{
|
||||
gconstpointer buffer;
|
||||
@ -168,14 +168,14 @@ response_open_session_aes (GSecretSession *session,
|
||||
#endif /* WITH_GCRYPT */
|
||||
|
||||
static GVariant *
|
||||
request_open_session_plain (GSecretSession *session)
|
||||
request_open_session_plain (SecretSession *session)
|
||||
{
|
||||
GVariant *argument = g_variant_new_string ("");
|
||||
return g_variant_new ("(sv)", "plain", argument);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
response_open_session_plain (GSecretSession *session,
|
||||
response_open_session_plain (SecretSession *session,
|
||||
GVariant *response)
|
||||
{
|
||||
GVariant *argument;
|
||||
@ -203,7 +203,7 @@ response_open_session_plain (GSecretSession *session,
|
||||
|
||||
typedef struct {
|
||||
GCancellable *cancellable;
|
||||
GSecretSession *session;
|
||||
SecretSession *session;
|
||||
} OpenSessionClosure;
|
||||
|
||||
static void
|
||||
@ -212,7 +212,7 @@ open_session_closure_free (gpointer data)
|
||||
OpenSessionClosure *closure = data;
|
||||
g_assert (closure);
|
||||
g_clear_object (&closure->cancellable);
|
||||
_gsecret_session_free (closure->session);
|
||||
_secret_session_free (closure->session);
|
||||
g_free (closure);
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ on_service_open_session_plain (GObject *source,
|
||||
{
|
||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
||||
OpenSessionClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GSecretService *service = GSECRET_SERVICE (source);
|
||||
SecretService *service = SECRET_SERVICE (source);
|
||||
GError *error = NULL;
|
||||
GVariant *response;
|
||||
|
||||
@ -232,11 +232,11 @@ on_service_open_session_plain (GObject *source,
|
||||
/* A successful response, decode it */
|
||||
if (response != NULL) {
|
||||
if (response_open_session_plain (closure->session, response)) {
|
||||
_gsecret_service_take_session (service, closure->session);
|
||||
_secret_service_take_session (service, closure->session);
|
||||
closure->session = NULL;
|
||||
|
||||
} else {
|
||||
g_simple_async_result_set_error (res, GSECRET_ERROR, GSECRET_ERROR_PROTOCOL,
|
||||
g_simple_async_result_set_error (res, SECRET_ERROR, SECRET_ERROR_PROTOCOL,
|
||||
_("Couldn't communicate with the secret storage"));
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ on_service_open_session_aes (GObject *source,
|
||||
{
|
||||
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
|
||||
OpenSessionClosure * closure = g_simple_async_result_get_op_res_gpointer (res);
|
||||
GSecretService *service = GSECRET_SERVICE (source);
|
||||
SecretService *service = SECRET_SERVICE (source);
|
||||
GError *error = NULL;
|
||||
GVariant *response;
|
||||
|
||||
@ -269,11 +269,11 @@ on_service_open_session_aes (GObject *source,
|
||||
/* A successful response, decode it */
|
||||
if (response != NULL) {
|
||||
if (response_open_session_aes (closure->session, response)) {
|
||||
_gsecret_service_take_session (service, closure->session);
|
||||
_secret_service_take_session (service, closure->session);
|
||||
closure->session = NULL;
|
||||
|
||||
} else {
|
||||
g_simple_async_result_set_error (res, GSECRET_ERROR, GSECRET_ERROR_PROTOCOL,
|
||||
g_simple_async_result_set_error (res, SECRET_ERROR, SECRET_ERROR_PROTOCOL,
|
||||
_("Couldn't communicate with the secret storage"));
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ on_service_open_session_aes (GObject *source,
|
||||
|
||||
|
||||
void
|
||||
_gsecret_session_open (GSecretService *service,
|
||||
_secret_session_open (SecretService *service,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@ -313,10 +313,10 @@ _gsecret_session_open (GSecretService *service,
|
||||
OpenSessionClosure *closure;
|
||||
|
||||
res = g_simple_async_result_new (G_OBJECT (service), callback, user_data,
|
||||
_gsecret_session_open);
|
||||
_secret_session_open);
|
||||
closure = g_new (OpenSessionClosure, 1);
|
||||
closure->cancellable = cancellable ? g_object_ref (cancellable) : cancellable;
|
||||
closure->session = g_new0 (GSecretSession, 1);
|
||||
closure->session = g_new0 (SecretSession, 1);
|
||||
g_simple_async_result_set_op_res_gpointer (res, closure, open_session_closure_free);
|
||||
|
||||
g_dbus_proxy_call (G_DBUS_PROXY (service), "OpenSession",
|
||||
@ -335,7 +335,7 @@ _gsecret_session_open (GSecretService *service,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gsecret_session_open_finish (GAsyncResult *result,
|
||||
_secret_session_open_finish (GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
|
||||
@ -376,8 +376,8 @@ pkcs7_unpad_bytes_in_place (guchar *padded,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GSecretValue *
|
||||
service_decode_aes_secret (GSecretSession *session,
|
||||
static SecretValue *
|
||||
service_decode_aes_secret (SecretSession *session,
|
||||
gconstpointer param,
|
||||
gsize n_param,
|
||||
gconstpointer value,
|
||||
@ -441,13 +441,13 @@ service_decode_aes_secret (GSecretSession *session,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return gsecret_value_new_full ((gchar *)padded, n_padded, content_type, egg_secure_free);
|
||||
return secret_value_new_full ((gchar *)padded, n_padded, content_type, egg_secure_free);
|
||||
}
|
||||
|
||||
#endif /* WITH_GCRYPT */
|
||||
|
||||
static GSecretValue *
|
||||
service_decode_plain_secret (GSecretSession *session,
|
||||
static SecretValue *
|
||||
service_decode_plain_secret (SecretSession *session,
|
||||
gconstpointer param,
|
||||
gsize n_param,
|
||||
gconstpointer value,
|
||||
@ -459,14 +459,14 @@ service_decode_plain_secret (GSecretSession *session,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return gsecret_value_new (value, n_value, content_type);
|
||||
return secret_value_new (value, n_value, content_type);
|
||||
}
|
||||
|
||||
GSecretValue *
|
||||
_gsecret_session_decode_secret (GSecretSession *session,
|
||||
SecretValue *
|
||||
_secret_session_decode_secret (SecretSession *session,
|
||||
GVariant *encoded)
|
||||
{
|
||||
GSecretValue *result;
|
||||
SecretValue *result;
|
||||
gconstpointer param;
|
||||
gconstpointer value;
|
||||
gchar *session_path;
|
||||
@ -535,8 +535,8 @@ pkcs7_pad_bytes_in_secure_memory (gconstpointer secret,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
service_encode_aes_secret (GSecretSession *session,
|
||||
GSecretValue *value,
|
||||
service_encode_aes_secret (SecretSession *session,
|
||||
SecretValue *value,
|
||||
GVariantBuilder *builder)
|
||||
{
|
||||
gcry_cipher_hd_t cih;
|
||||
@ -557,7 +557,7 @@ service_encode_aes_secret (GSecretSession *session,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
secret = gsecret_value_get (value, &n_secret);
|
||||
secret = secret_value_get (value, &n_secret);
|
||||
|
||||
/* Perform the encoding here */
|
||||
padded = pkcs7_pad_bytes_in_secure_memory (secret, n_secret, &n_padded);
|
||||
@ -587,15 +587,15 @@ service_encode_aes_secret (GSecretSession *session,
|
||||
child = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), padded, n_padded, TRUE, egg_secure_free, padded);
|
||||
g_variant_builder_add_value (builder, child);
|
||||
|
||||
g_variant_builder_add (builder, "s", gsecret_value_get_content_type (value));
|
||||
g_variant_builder_add (builder, "s", secret_value_get_content_type (value));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* WITH_GCRYPT */
|
||||
|
||||
static gboolean
|
||||
service_encode_plain_secret (GSecretSession *session,
|
||||
GSecretValue *value,
|
||||
service_encode_plain_secret (SecretSession *session,
|
||||
SecretValue *value,
|
||||
GVariantBuilder *builder)
|
||||
{
|
||||
gconstpointer secret;
|
||||
@ -604,24 +604,24 @@ service_encode_plain_secret (GSecretSession *session,
|
||||
|
||||
g_variant_builder_add (builder, "o", session->path);
|
||||
|
||||
secret = gsecret_value_get (value, &n_secret);
|
||||
secret = secret_value_get (value, &n_secret);
|
||||
|
||||
child = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), "", 0, TRUE, NULL, NULL);
|
||||
g_variant_builder_add_value (builder, child);
|
||||
g_variant_unref (child);
|
||||
|
||||
child = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), secret, n_secret, TRUE,
|
||||
gsecret_value_unref, gsecret_value_ref (value));
|
||||
secret_value_unref, secret_value_ref (value));
|
||||
g_variant_builder_add_value (builder, child);
|
||||
g_variant_unref (child);
|
||||
|
||||
g_variant_builder_add (builder, "s", gsecret_value_get_content_type (value));
|
||||
g_variant_builder_add (builder, "s", secret_value_get_content_type (value));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GVariant *
|
||||
_gsecret_session_encode_secret (GSecretSession *session,
|
||||
GSecretValue *value)
|
||||
_secret_session_encode_secret (SecretSession *session,
|
||||
SecretValue *value)
|
||||
{
|
||||
GVariantBuilder *builder;
|
||||
GVariant *result = NULL;
|
||||
@ -649,14 +649,14 @@ _gsecret_session_encode_secret (GSecretSession *session,
|
||||
}
|
||||
|
||||
const gchar *
|
||||
_gsecret_session_get_algorithms (GSecretSession *session)
|
||||
_secret_session_get_algorithms (SecretSession *session)
|
||||
{
|
||||
g_return_val_if_fail (session != NULL, NULL);
|
||||
return session->algorithms;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
_gsecret_session_get_path (GSecretSession *session)
|
||||
_secret_session_get_path (SecretSession *session)
|
||||
{
|
||||
g_return_val_if_fail (session != NULL, NULL);
|
||||
return session->path;
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -10,32 +10,32 @@
|
||||
* See the included COPYING file for more information.
|
||||
*/
|
||||
|
||||
#ifndef __GSECRET_TYPES_H__
|
||||
#define __GSECRET_TYPES_H__
|
||||
#ifndef __SECRET_TYPES_H__
|
||||
#define __SECRET_TYPES_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSECRET_ERROR (gsecret_error_get_quark ())
|
||||
#define SECRET_ERROR (secret_error_get_quark ())
|
||||
|
||||
GQuark gsecret_error_get_quark (void) G_GNUC_CONST;
|
||||
GQuark secret_error_get_quark (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum {
|
||||
GSECRET_ERROR_PROTOCOL = 1,
|
||||
} GSecretError;
|
||||
SECRET_ERROR_PROTOCOL = 1,
|
||||
} SecretError;
|
||||
|
||||
typedef enum {
|
||||
GSECRET_ATTRIBUTE_BOOLEAN,
|
||||
GSECRET_ATTRIBUTE_STRING,
|
||||
GSECRET_ATTRIBUTE_INTEGER
|
||||
} GSecretSchemaType;
|
||||
SECRET_ATTRIBUTE_BOOLEAN,
|
||||
SECRET_ATTRIBUTE_STRING,
|
||||
SECRET_ATTRIBUTE_INTEGER
|
||||
} SecretSchemaType;
|
||||
|
||||
typedef struct {
|
||||
const gchar *schema_name;
|
||||
struct {
|
||||
const gchar* name;
|
||||
GSecretSchemaType type;
|
||||
SecretSchemaType type;
|
||||
} attributes[32];
|
||||
|
||||
/* <private> */
|
||||
@ -47,13 +47,13 @@ typedef struct {
|
||||
gpointer reserved6;
|
||||
gpointer reserved7;
|
||||
gpointer reserved8;
|
||||
} GSecretSchema;
|
||||
} SecretSchema;
|
||||
|
||||
typedef struct _GSecretCollection GSecretCollection;
|
||||
typedef struct _GSecretItem GSecretItem;
|
||||
typedef struct _GSecretPrompt GSecretPrompt;
|
||||
typedef struct _GSecretService GSecretService;
|
||||
typedef struct _GSecretValue GSecretValue;
|
||||
typedef struct _SecretCollection SecretCollection;
|
||||
typedef struct _SecretItem SecretItem;
|
||||
typedef struct _SecretPrompt SecretPrompt;
|
||||
typedef struct _SecretService SecretService;
|
||||
typedef struct _SecretValue SecretValue;
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -12,8 +12,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-private.h"
|
||||
#include "gsecret-types.h"
|
||||
#include "secret-private.h"
|
||||
#include "secret-types.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -40,11 +40,11 @@ list_ref_copy (GList *reflist)
|
||||
}
|
||||
|
||||
GType
|
||||
_gsecret_list_get_type (void)
|
||||
_secret_list_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
if (!type)
|
||||
type = g_boxed_type_register_static ("GSecretObjectList",
|
||||
type = g_boxed_type_register_static ("SecretObjectList",
|
||||
(GBoxedCopyFunc)list_ref_copy,
|
||||
(GBoxedFreeFunc)list_unref_free);
|
||||
return type;
|
||||
@ -52,13 +52,13 @@ _gsecret_list_get_type (void)
|
||||
}
|
||||
|
||||
GQuark
|
||||
gsecret_error_get_quark (void)
|
||||
secret_error_get_quark (void)
|
||||
{
|
||||
static volatile gsize initialized = 0;
|
||||
static GQuark quark = 0;
|
||||
|
||||
if (g_once_init_enter (&initialized)) {
|
||||
quark = g_quark_from_static_string ("gsecret-error");
|
||||
quark = g_quark_from_static_string ("secret-error");
|
||||
g_once_init_leave (&initialized, 1);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ gsecret_error_get_quark (void)
|
||||
}
|
||||
|
||||
gchar *
|
||||
_gsecret_util_parent_path (const gchar *path)
|
||||
_secret_util_parent_path (const gchar *path)
|
||||
{
|
||||
const gchar *pos;
|
||||
|
||||
@ -80,14 +80,14 @@ _gsecret_util_parent_path (const gchar *path)
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gsecret_util_empty_path (const gchar *path)
|
||||
_secret_util_empty_path (const gchar *path)
|
||||
{
|
||||
g_return_val_if_fail (path != NULL, TRUE);
|
||||
return (g_str_equal (path, "") || g_str_equal (path, "/"));
|
||||
}
|
||||
|
||||
GVariant *
|
||||
_gsecret_util_variant_for_properties (GHashTable *properties)
|
||||
_secret_util_variant_for_properties (GHashTable *properties)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
GVariantBuilder builder;
|
||||
@ -106,7 +106,7 @@ _gsecret_util_variant_for_properties (GHashTable *properties)
|
||||
}
|
||||
|
||||
GVariant *
|
||||
_gsecret_util_variant_for_attributes (GHashTable *attributes)
|
||||
_secret_util_variant_for_attributes (GHashTable *attributes)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
GVariantBuilder builder;
|
||||
@ -125,7 +125,7 @@ _gsecret_util_variant_for_attributes (GHashTable *attributes)
|
||||
}
|
||||
|
||||
GHashTable *
|
||||
_gsecret_util_attributes_for_variant (GVariant *variant)
|
||||
_secret_util_attributes_for_variant (GVariant *variant)
|
||||
{
|
||||
GVariantIter iter;
|
||||
GHashTable *attributes;
|
||||
@ -142,11 +142,11 @@ _gsecret_util_attributes_for_variant (GVariant *variant)
|
||||
}
|
||||
|
||||
GHashTable *
|
||||
_gsecret_util_attributes_for_varargs (const GSecretSchema *schema,
|
||||
_secret_util_attributes_for_varargs (const SecretSchema *schema,
|
||||
va_list args)
|
||||
{
|
||||
const gchar *attribute_name;
|
||||
GSecretSchemaType type;
|
||||
SecretSchemaType type;
|
||||
GHashTable *attributes;
|
||||
const gchar *string;
|
||||
gboolean type_found;
|
||||
@ -180,11 +180,11 @@ _gsecret_util_attributes_for_varargs (const GSecretSchema *schema,
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case GSECRET_ATTRIBUTE_BOOLEAN:
|
||||
case SECRET_ATTRIBUTE_BOOLEAN:
|
||||
boolean = va_arg (args, gboolean);
|
||||
value = g_strdup (boolean ? "true" : "false");
|
||||
break;
|
||||
case GSECRET_ATTRIBUTE_STRING:
|
||||
case SECRET_ATTRIBUTE_STRING:
|
||||
string = va_arg (args, gchar *);
|
||||
if (!g_utf8_validate (string, -1, NULL)) {
|
||||
g_warning ("The value for attribute '%s' was not a valid utf-8 string.", attribute_name);
|
||||
@ -193,7 +193,7 @@ _gsecret_util_attributes_for_varargs (const GSecretSchema *schema,
|
||||
}
|
||||
value = g_strdup (string);
|
||||
break;
|
||||
case GSECRET_ATTRIBUTE_INTEGER:
|
||||
case SECRET_ATTRIBUTE_INTEGER:
|
||||
integer = va_arg (args, gint);
|
||||
value = g_strdup_printf ("%d", integer);
|
||||
break;
|
||||
@ -261,7 +261,7 @@ on_get_properties (GObject *source,
|
||||
}
|
||||
|
||||
void
|
||||
_gsecret_util_get_properties (GDBusProxy *proxy,
|
||||
_secret_util_get_properties (GDBusProxy *proxy,
|
||||
gpointer result_tag,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
@ -287,7 +287,7 @@ _gsecret_util_get_properties (GDBusProxy *proxy,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gsecret_util_get_properties_finish (GDBusProxy *proxy,
|
||||
_secret_util_get_properties_finish (GDBusProxy *proxy,
|
||||
gpointer result_tag,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
@ -348,7 +348,7 @@ on_set_property (GObject *source,
|
||||
}
|
||||
|
||||
void
|
||||
_gsecret_util_set_property (GDBusProxy *proxy,
|
||||
_secret_util_set_property (GDBusProxy *proxy,
|
||||
const gchar *property,
|
||||
GVariant *value,
|
||||
gpointer result_tag,
|
||||
@ -370,7 +370,7 @@ _gsecret_util_set_property (GDBusProxy *proxy,
|
||||
g_dbus_connection_call (g_dbus_proxy_get_connection (proxy),
|
||||
g_dbus_proxy_get_name (proxy),
|
||||
g_dbus_proxy_get_object_path (proxy),
|
||||
GSECRET_PROPERTIES_INTERFACE,
|
||||
SECRET_PROPERTIES_INTERFACE,
|
||||
"Set",
|
||||
g_variant_new ("(ssv)",
|
||||
g_dbus_proxy_get_interface_name (proxy),
|
||||
@ -385,7 +385,7 @@ _gsecret_util_set_property (GDBusProxy *proxy,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gsecret_util_set_property_finish (GDBusProxy *proxy,
|
||||
_secret_util_set_property_finish (GDBusProxy *proxy,
|
||||
gpointer result_tag,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
@ -406,7 +406,7 @@ _gsecret_util_set_property_finish (GDBusProxy *proxy,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gsecret_util_set_property_sync (GDBusProxy *proxy,
|
||||
_secret_util_set_property_sync (GDBusProxy *proxy,
|
||||
const gchar *property,
|
||||
GVariant *value,
|
||||
GCancellable *cancellable,
|
||||
@ -423,7 +423,7 @@ _gsecret_util_set_property_sync (GDBusProxy *proxy,
|
||||
retval = g_dbus_connection_call_sync (g_dbus_proxy_get_connection (proxy),
|
||||
g_dbus_proxy_get_name (proxy),
|
||||
g_dbus_proxy_get_object_path (proxy),
|
||||
GSECRET_PROPERTIES_INTERFACE,
|
||||
SECRET_PROPERTIES_INTERFACE,
|
||||
"Set",
|
||||
g_variant_new ("(ssv)",
|
||||
g_dbus_proxy_get_interface_name (proxy),
|
||||
@ -445,7 +445,7 @@ _gsecret_util_set_property_sync (GDBusProxy *proxy,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gsecret_util_have_cached_properties (GDBusProxy *proxy)
|
||||
_secret_util_have_cached_properties (GDBusProxy *proxy)
|
||||
{
|
||||
gchar **names;
|
||||
|
||||
@ -455,12 +455,12 @@ _gsecret_util_have_cached_properties (GDBusProxy *proxy)
|
||||
return names != NULL;
|
||||
}
|
||||
|
||||
GSecretSync *
|
||||
_gsecret_sync_new (void)
|
||||
SecretSync *
|
||||
_secret_sync_new (void)
|
||||
{
|
||||
GSecretSync *sync;
|
||||
SecretSync *sync;
|
||||
|
||||
sync = g_new0 (GSecretSync, 1);
|
||||
sync = g_new0 (SecretSync, 1);
|
||||
|
||||
sync->context = g_main_context_new ();
|
||||
sync->loop = g_main_loop_new (sync->context, FALSE);
|
||||
@ -469,9 +469,9 @@ _gsecret_sync_new (void)
|
||||
}
|
||||
|
||||
void
|
||||
_gsecret_sync_free (gpointer data)
|
||||
_secret_sync_free (gpointer data)
|
||||
{
|
||||
GSecretSync *sync = data;
|
||||
SecretSync *sync = data;
|
||||
|
||||
g_clear_object (&sync->result);
|
||||
g_main_loop_unref (sync->loop);
|
||||
@ -479,11 +479,11 @@ _gsecret_sync_free (gpointer data)
|
||||
}
|
||||
|
||||
void
|
||||
_gsecret_sync_on_result (GObject *source,
|
||||
_secret_sync_on_result (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSecretSync *sync = user_data;
|
||||
SecretSync *sync = user_data;
|
||||
g_assert (sync->result == NULL);
|
||||
sync->result = g_object_ref (result);
|
||||
g_main_loop_quit (sync->loop);
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -12,16 +12,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-private.h"
|
||||
#include "gsecret-value.h"
|
||||
#include "secret-private.h"
|
||||
#include "secret-value.h"
|
||||
|
||||
#include "egg/egg-secure-memory.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
EGG_SECURE_DECLARE (gsecret_value);
|
||||
EGG_SECURE_DECLARE (secret_value);
|
||||
|
||||
struct _GSecretValue {
|
||||
struct _SecretValue {
|
||||
gint refs;
|
||||
gpointer secret;
|
||||
gsize length;
|
||||
@ -30,23 +30,23 @@ struct _GSecretValue {
|
||||
};
|
||||
|
||||
GType
|
||||
gsecret_value_get_type (void)
|
||||
secret_value_get_type (void)
|
||||
{
|
||||
static gsize initialized = 0;
|
||||
static GType type = 0;
|
||||
|
||||
if (g_once_init_enter (&initialized)) {
|
||||
type = g_boxed_type_register_static ("GSecretValue",
|
||||
(GBoxedCopyFunc)gsecret_value_ref,
|
||||
(GBoxedFreeFunc)gsecret_value_unref);
|
||||
type = g_boxed_type_register_static ("SecretValue",
|
||||
(GBoxedCopyFunc)secret_value_ref,
|
||||
(GBoxedFreeFunc)secret_value_unref);
|
||||
g_once_init_leave (&initialized, 1);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
GSecretValue*
|
||||
gsecret_value_new (const gchar *secret, gssize length, const gchar *content_type)
|
||||
SecretValue*
|
||||
secret_value_new (const gchar *secret, gssize length, const gchar *content_type)
|
||||
{
|
||||
gchar *copy;
|
||||
|
||||
@ -59,14 +59,14 @@ gsecret_value_new (const gchar *secret, gssize length, const gchar *content_type
|
||||
copy = egg_secure_alloc (length + 1);
|
||||
memcpy (copy, secret, length);
|
||||
copy[length] = 0;
|
||||
return gsecret_value_new_full (copy, length, content_type, egg_secure_free);
|
||||
return secret_value_new_full (copy, length, content_type, egg_secure_free);
|
||||
}
|
||||
|
||||
GSecretValue*
|
||||
gsecret_value_new_full (gchar *secret, gssize length,
|
||||
SecretValue*
|
||||
secret_value_new_full (gchar *secret, gssize length,
|
||||
const gchar *content_type, GDestroyNotify destroy)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
|
||||
g_return_val_if_fail (secret == NULL || length != 0, NULL);
|
||||
g_return_val_if_fail (content_type, NULL);
|
||||
@ -74,7 +74,7 @@ gsecret_value_new_full (gchar *secret, gssize length,
|
||||
if (length < 0)
|
||||
length = strlen (secret);
|
||||
|
||||
value = g_slice_new0 (GSecretValue);
|
||||
value = g_slice_new0 (SecretValue);
|
||||
value->refs = 1;
|
||||
value->content_type = g_strdup (content_type);
|
||||
value->destroy = destroy;
|
||||
@ -85,7 +85,7 @@ gsecret_value_new_full (gchar *secret, gssize length,
|
||||
}
|
||||
|
||||
const gchar*
|
||||
gsecret_value_get (GSecretValue *value, gsize *length)
|
||||
secret_value_get (SecretValue *value, gsize *length)
|
||||
{
|
||||
g_return_val_if_fail (value, NULL);
|
||||
if (length)
|
||||
@ -94,14 +94,14 @@ gsecret_value_get (GSecretValue *value, gsize *length)
|
||||
}
|
||||
|
||||
const gchar*
|
||||
gsecret_value_get_content_type (GSecretValue *value)
|
||||
secret_value_get_content_type (SecretValue *value)
|
||||
{
|
||||
g_return_val_if_fail (value, NULL);
|
||||
return value->content_type;
|
||||
}
|
||||
|
||||
GSecretValue*
|
||||
gsecret_value_ref (GSecretValue *value)
|
||||
SecretValue*
|
||||
secret_value_ref (SecretValue *value)
|
||||
{
|
||||
g_return_val_if_fail (value, NULL);
|
||||
g_atomic_int_inc (&value->refs);
|
||||
@ -109,9 +109,9 @@ gsecret_value_ref (GSecretValue *value)
|
||||
}
|
||||
|
||||
void
|
||||
gsecret_value_unref (gpointer value)
|
||||
secret_value_unref (gpointer value)
|
||||
{
|
||||
GSecretValue *val = value;
|
||||
SecretValue *val = value;
|
||||
|
||||
g_return_if_fail (value != NULL);
|
||||
|
||||
@ -119,20 +119,20 @@ gsecret_value_unref (gpointer value)
|
||||
g_free (val->content_type);
|
||||
if (val->destroy)
|
||||
(val->destroy) (val->secret);
|
||||
g_slice_free (GSecretValue, val);
|
||||
g_slice_free (SecretValue, val);
|
||||
}
|
||||
}
|
||||
|
||||
gchar *
|
||||
_gsecret_value_unref_to_password (GSecretValue *value)
|
||||
_secret_value_unref_to_password (SecretValue *value)
|
||||
{
|
||||
GSecretValue *val = value;
|
||||
SecretValue *val = value;
|
||||
gchar *result;
|
||||
|
||||
g_return_val_if_fail (value != NULL, NULL);
|
||||
|
||||
if (val->content_type && !g_str_equal (val->content_type, "text/plain")) {
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ _gsecret_value_unref_to_password (GSecretValue *value)
|
||||
(val->destroy) (val->secret);
|
||||
}
|
||||
g_free (val->content_type);
|
||||
g_slice_free (GSecretValue, val);
|
||||
g_slice_free (SecretValue, val);
|
||||
|
||||
} else {
|
||||
result = egg_secure_strdup (val->secret);
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -10,36 +10,36 @@
|
||||
* See the included COPYING file for more information.
|
||||
*/
|
||||
|
||||
#ifndef __GSECRET_VALUE_H__
|
||||
#define __GSECRET_VALUE_H__
|
||||
#ifndef __SECRET_VALUE_H__
|
||||
#define __SECRET_VALUE_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "gsecret-types.h"
|
||||
#include "secret-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSECRET_TYPE_VALUE (gsecret_value_get_type ())
|
||||
#define SECRET_TYPE_VALUE (secret_value_get_type ())
|
||||
|
||||
GType gsecret_value_get_type (void) G_GNUC_CONST;
|
||||
GType secret_value_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GSecretValue* gsecret_value_new (const gchar *secret,
|
||||
SecretValue* secret_value_new (const gchar *secret,
|
||||
gssize length,
|
||||
const gchar *content_type);
|
||||
|
||||
GSecretValue* gsecret_value_new_full (gchar *secret,
|
||||
SecretValue* secret_value_new_full (gchar *secret,
|
||||
gssize length,
|
||||
const gchar *content_type,
|
||||
GDestroyNotify destroy);
|
||||
|
||||
const gchar* gsecret_value_get (GSecretValue *value,
|
||||
const gchar* secret_value_get (SecretValue *value,
|
||||
gsize *length);
|
||||
|
||||
const gchar* gsecret_value_get_content_type (GSecretValue *value);
|
||||
const gchar* secret_value_get_content_type (SecretValue *value);
|
||||
|
||||
GSecretValue* gsecret_value_ref (GSecretValue *value);
|
||||
SecretValue* secret_value_ref (SecretValue *value);
|
||||
|
||||
void gsecret_value_unref (gpointer value);
|
||||
void secret_value_unref (gpointer value);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -16,12 +16,12 @@ libmock_service_la_CFLAGS = \
|
||||
|
||||
libmock_service_la_LIBADD = \
|
||||
$(top_builddir)/egg/libegg.la \
|
||||
$(top_builddir)/library/libgsecret.la \
|
||||
$(top_builddir)/library/libsecret.la \
|
||||
$(LIBGCRYPT_LIBS)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/egg/libegg.la \
|
||||
$(top_builddir)/library/libgsecret.la \
|
||||
$(top_builddir)/library/libsecret.la \
|
||||
$(top_builddir)/library/tests/libmock_service.la \
|
||||
$(NULL)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Red Hat Inc.
|
||||
*
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
#include "mock-service.h"
|
||||
|
||||
#include "gsecret-private.h"
|
||||
#include "secret-private.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@ -45,7 +45,7 @@ mock_service_start (const gchar *mock_script,
|
||||
g_return_val_if_fail (mock_script != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
_gsecret_service_set_default_bus_name (MOCK_SERVICE_NAME);
|
||||
_secret_service_set_default_bus_name (MOCK_SERVICE_NAME);
|
||||
|
||||
if (pipe (wait_pipe) < 0) {
|
||||
g_set_error_literal (error, G_IO_ERROR, g_io_error_from_errno (errno),
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
*
|
||||
@ -15,9 +15,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-collection.h"
|
||||
#include "gsecret-service.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "secret-collection.h"
|
||||
#include "secret-service.h"
|
||||
#include "secret-private.h"
|
||||
|
||||
#include "mock-service.h"
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
} Test;
|
||||
|
||||
static void
|
||||
@ -42,7 +42,7 @@ setup (Test *test,
|
||||
mock_service_start (mock_script, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
test->service = gsecret_service_get_sync (GSECRET_SERVICE_NONE, NULL, &error);
|
||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
@ -86,9 +86,9 @@ test_new_sync (Test *test,
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GError *error = NULL;
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path);
|
||||
@ -103,15 +103,15 @@ test_new_async (Test *test,
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GError *error = NULL;
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GAsyncResult *result = NULL;
|
||||
|
||||
gsecret_collection_new (test->service, collection_path, NULL, on_async_result, &result);
|
||||
secret_collection_new (test->service, collection_path, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
collection = gsecret_collection_new_finish (result, &error);
|
||||
collection = secret_collection_new_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
@ -127,9 +127,9 @@ test_new_sync_noexist (Test *test,
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/nonexistant";
|
||||
GError *error = NULL;
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||
g_assert (collection == NULL);
|
||||
}
|
||||
@ -140,15 +140,15 @@ test_new_async_noexist (Test *test,
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/nonexistant";
|
||||
GError *error = NULL;
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GAsyncResult *result = NULL;
|
||||
|
||||
gsecret_collection_new (test->service, collection_path, NULL, on_async_result, &result);
|
||||
secret_collection_new (test->service, collection_path, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
collection = gsecret_collection_new_finish (result, &error);
|
||||
collection = secret_collection_new_finish (result, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||
g_assert (collection == NULL);
|
||||
g_object_unref (result);
|
||||
@ -160,14 +160,14 @@ test_create_sync (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
|
||||
collection = gsecret_collection_create_sync (test->service, "Train", NULL, NULL, &error);
|
||||
collection = secret_collection_create_sync (test->service, "Train", NULL, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection"));
|
||||
g_assert_cmpstr (gsecret_collection_get_label (collection), ==, "Train");
|
||||
g_assert (gsecret_collection_get_locked (collection) == FALSE);
|
||||
g_assert_cmpstr (secret_collection_get_label (collection), ==, "Train");
|
||||
g_assert (secret_collection_get_locked (collection) == FALSE);
|
||||
|
||||
g_object_unref (collection);
|
||||
egg_assert_not_object (collection);
|
||||
@ -178,21 +178,21 @@ test_create_async (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GAsyncResult *result = NULL;
|
||||
|
||||
gsecret_collection_create (test->service, "Train", NULL, NULL, on_async_result, &result);
|
||||
secret_collection_create (test->service, "Train", NULL, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
collection = gsecret_collection_create_finish (result, &error);
|
||||
collection = secret_collection_create_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection"));
|
||||
g_assert_cmpstr (gsecret_collection_get_label (collection), ==, "Train");
|
||||
g_assert (gsecret_collection_get_locked (collection) == FALSE);
|
||||
g_assert_cmpstr (secret_collection_get_label (collection), ==, "Train");
|
||||
g_assert (secret_collection_get_locked (collection) == FALSE);
|
||||
|
||||
g_object_unref (collection);
|
||||
egg_assert_not_object (collection);
|
||||
@ -203,22 +203,22 @@ test_properties (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GSecretCollection *collection;
|
||||
GSecretService *service;
|
||||
SecretCollection *collection;
|
||||
SecretService *service;
|
||||
GError *error = NULL;
|
||||
guint64 created;
|
||||
guint64 modified;
|
||||
gboolean locked;
|
||||
gchar *label;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (gsecret_collection_get_locked (collection) == FALSE);
|
||||
g_assert_cmpuint (gsecret_collection_get_created (collection), <=, time (NULL));
|
||||
g_assert_cmpuint (gsecret_collection_get_modified (collection), <=, time (NULL));
|
||||
g_assert (secret_collection_get_locked (collection) == FALSE);
|
||||
g_assert_cmpuint (secret_collection_get_created (collection), <=, time (NULL));
|
||||
g_assert_cmpuint (secret_collection_get_modified (collection), <=, time (NULL));
|
||||
|
||||
label = gsecret_collection_get_label (collection);
|
||||
label = secret_collection_get_label (collection);
|
||||
g_assert_cmpstr (label, ==, "Collection One");
|
||||
g_free (label);
|
||||
|
||||
@ -277,14 +277,14 @@ test_items (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GError *error = NULL;
|
||||
GList *items;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
items = gsecret_collection_get_items (collection);
|
||||
items = secret_collection_get_items (collection);
|
||||
check_items_equal (items,
|
||||
"/org/freedesktop/secrets/collection/english/1",
|
||||
"/org/freedesktop/secrets/collection/english/2",
|
||||
@ -308,14 +308,14 @@ test_items_empty (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/empty";
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GError *error = NULL;
|
||||
GList *items;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
items = gsecret_collection_get_items (collection);
|
||||
items = secret_collection_get_items (collection);
|
||||
check_items_equal (items, NULL);
|
||||
g_list_free_full (items, g_object_unref);
|
||||
|
||||
@ -331,21 +331,21 @@ test_items_empty_async (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/empty";
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
GList *items;
|
||||
|
||||
gsecret_collection_new (test->service, collection_path, NULL, on_async_result, &result);
|
||||
secret_collection_new (test->service, collection_path, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
collection = gsecret_collection_new_finish (result, &error);
|
||||
collection = secret_collection_new_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
items = gsecret_collection_get_items (collection);
|
||||
items = secret_collection_get_items (collection);
|
||||
check_items_equal (items, NULL);
|
||||
g_list_free_full (items, g_object_unref);
|
||||
|
||||
@ -362,22 +362,22 @@ test_set_label_sync (Test *test,
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GError *error = NULL;
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
gboolean ret;
|
||||
gchar *label;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
label = gsecret_collection_get_label (collection);
|
||||
label = secret_collection_get_label (collection);
|
||||
g_assert_cmpstr (label, ==, "Collection One");
|
||||
g_free (label);
|
||||
|
||||
ret = gsecret_collection_set_label_sync (collection, "Another label", NULL, &error);
|
||||
ret = secret_collection_set_label_sync (collection, "Another label", NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
label = gsecret_collection_get_label (collection);
|
||||
label = secret_collection_get_label (collection);
|
||||
g_assert_cmpstr (label, ==, "Another label");
|
||||
g_free (label);
|
||||
|
||||
@ -391,28 +391,28 @@ test_set_label_async (Test *test,
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
gboolean ret;
|
||||
gchar *label;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
label = gsecret_collection_get_label (collection);
|
||||
label = secret_collection_get_label (collection);
|
||||
g_assert_cmpstr (label, ==, "Collection One");
|
||||
g_free (label);
|
||||
|
||||
gsecret_collection_set_label (collection, "Another label", NULL, on_async_result, &result);
|
||||
secret_collection_set_label (collection, "Another label", NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_collection_set_label_finish (collection, result, &error);
|
||||
ret = secret_collection_set_label_finish (collection, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
g_object_unref (result);
|
||||
|
||||
label = gsecret_collection_get_label (collection);
|
||||
label = secret_collection_get_label (collection);
|
||||
g_assert_cmpstr (label, ==, "Another label");
|
||||
g_free (label);
|
||||
|
||||
@ -425,14 +425,14 @@ test_set_label_prop (Test *test,
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GError *error = NULL;
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
guint sigs = 2;
|
||||
gchar *label;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
label = gsecret_collection_get_label (collection);
|
||||
label = secret_collection_get_label (collection);
|
||||
g_assert_cmpstr (label, ==, "Collection One");
|
||||
g_free (label);
|
||||
|
||||
@ -442,7 +442,7 @@ test_set_label_prop (Test *test,
|
||||
/* Wait for the property to actually 'take' */
|
||||
egg_test_wait ();
|
||||
|
||||
label = gsecret_collection_get_label (collection);
|
||||
label = secret_collection_get_label (collection);
|
||||
g_assert_cmpstr (label, ==, "Blah blah");
|
||||
g_free (label);
|
||||
|
||||
@ -454,20 +454,20 @@ test_delete_sync (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ret = gsecret_collection_delete_sync (collection, NULL, &error);
|
||||
ret = secret_collection_delete_sync (collection, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
g_object_unref (collection);
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||
g_assert (collection == NULL);
|
||||
}
|
||||
@ -477,27 +477,27 @@ test_delete_async (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
gsecret_collection_delete (collection, NULL, on_async_result, &result);
|
||||
secret_collection_delete (collection, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_collection_delete_finish (collection, result, &error);
|
||||
ret = secret_collection_delete_finish (collection, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
g_object_unref (collection);
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||
g_assert (collection == NULL);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
*
|
||||
@ -15,10 +15,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-collection.h"
|
||||
#include "gsecret-item.h"
|
||||
#include "gsecret-service.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "secret-collection.h"
|
||||
#include "secret-item.h"
|
||||
#include "secret-service.h"
|
||||
#include "secret-private.h"
|
||||
|
||||
#include "mock-service.h"
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
} Test;
|
||||
|
||||
static void
|
||||
@ -43,7 +43,7 @@ setup (Test *test,
|
||||
mock_service_start (mock_script, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
test->service = gsecret_service_get_sync (GSECRET_SERVICE_NONE, NULL, &error);
|
||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
@ -87,9 +87,9 @@ test_new_sync (Test *test,
|
||||
{
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), ==, item_path);
|
||||
@ -103,9 +103,9 @@ test_new_sync_noexist (Test *test,
|
||||
{
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/0000";
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||
g_assert (item == NULL);
|
||||
}
|
||||
@ -117,14 +117,14 @@ test_new_async (Test *test,
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
|
||||
gsecret_item_new (test->service, item_path, NULL, on_async_result, &result);
|
||||
secret_item_new (test->service, item_path, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
item = gsecret_item_new_finish (result, &error);
|
||||
item = secret_item_new_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
@ -140,14 +140,14 @@ test_new_async_noexist (Test *test,
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/0000";
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
|
||||
gsecret_item_new (test->service, item_path, NULL, on_async_result, &result);
|
||||
secret_item_new (test->service, item_path, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
item = gsecret_item_new_finish (result, &error);
|
||||
item = secret_item_new_finish (result, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||
g_assert (item == NULL);
|
||||
g_object_unref (result);
|
||||
@ -158,13 +158,13 @@ test_create_sync (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
GHashTable *attributes;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
@ -172,20 +172,20 @@ test_create_sync (Test *test,
|
||||
g_hash_table_insert (attributes, "string", "ten");
|
||||
g_hash_table_insert (attributes, "number", "10");
|
||||
|
||||
value = gsecret_value_new ("Hoohah", -1, "text/plain");
|
||||
value = secret_value_new ("Hoohah", -1, "text/plain");
|
||||
|
||||
item = gsecret_item_create_sync (collection, "org.mock.Schema", "Tunnel",
|
||||
item = secret_item_create_sync (collection, "org.mock.Schema", "Tunnel",
|
||||
attributes, value, FALSE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
g_object_unref (collection);
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
|
||||
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path));
|
||||
g_assert_cmpstr (gsecret_item_get_label (item), ==, "Tunnel");
|
||||
g_assert (gsecret_item_get_locked (item) == FALSE);
|
||||
g_assert_cmpstr (gsecret_item_get_schema (item), ==, "org.freedesktop.Secret.Generic");
|
||||
g_assert_cmpstr (secret_item_get_label (item), ==, "Tunnel");
|
||||
g_assert (secret_item_get_locked (item) == FALSE);
|
||||
g_assert_cmpstr (secret_item_get_schema (item), ==, "org.freedesktop.Secret.Generic");
|
||||
|
||||
g_object_unref (item);
|
||||
egg_assert_not_object (item);
|
||||
@ -196,14 +196,14 @@ test_create_async (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
GHashTable *attributes;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
@ -211,26 +211,26 @@ test_create_async (Test *test,
|
||||
g_hash_table_insert (attributes, "string", "ten");
|
||||
g_hash_table_insert (attributes, "number", "10");
|
||||
|
||||
value = gsecret_value_new ("Hoohah", -1, "text/plain");
|
||||
value = secret_value_new ("Hoohah", -1, "text/plain");
|
||||
|
||||
gsecret_item_create (collection, "org.mock.Schema", "Tunnel",
|
||||
secret_item_create (collection, "org.mock.Schema", "Tunnel",
|
||||
attributes, value, FALSE, NULL, on_async_result, &result);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
g_object_unref (collection);
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
item = gsecret_item_create_finish (result, &error);
|
||||
item = secret_item_create_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path));
|
||||
g_assert_cmpstr (gsecret_item_get_label (item), ==, "Tunnel");
|
||||
g_assert (gsecret_item_get_locked (item) == FALSE);
|
||||
g_assert_cmpstr (gsecret_item_get_schema (item), ==, "org.freedesktop.Secret.Generic");
|
||||
g_assert_cmpstr (secret_item_get_label (item), ==, "Tunnel");
|
||||
g_assert (secret_item_get_locked (item) == FALSE);
|
||||
g_assert_cmpstr (secret_item_get_schema (item), ==, "org.freedesktop.Secret.Generic");
|
||||
|
||||
g_object_unref (item);
|
||||
egg_assert_not_object (item);
|
||||
@ -243,30 +243,30 @@ test_properties (Test *test,
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GError *error = NULL;
|
||||
GHashTable *attributes;
|
||||
GSecretService *service;
|
||||
GSecretItem *item;
|
||||
SecretService *service;
|
||||
SecretItem *item;
|
||||
guint64 created;
|
||||
guint64 modified;
|
||||
gboolean locked;
|
||||
gchar *schema;
|
||||
gchar *label;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (gsecret_item_get_locked (item) == FALSE);
|
||||
g_assert_cmpuint (gsecret_item_get_created (item), <=, time (NULL));
|
||||
g_assert_cmpuint (gsecret_item_get_modified (item), <=, time (NULL));
|
||||
g_assert (secret_item_get_locked (item) == FALSE);
|
||||
g_assert_cmpuint (secret_item_get_created (item), <=, time (NULL));
|
||||
g_assert_cmpuint (secret_item_get_modified (item), <=, time (NULL));
|
||||
|
||||
schema = gsecret_item_get_schema (item);
|
||||
schema = secret_item_get_schema (item);
|
||||
g_assert_cmpstr (schema, ==, "org.mock.type.Store");
|
||||
g_free (schema);
|
||||
|
||||
label = gsecret_item_get_label (item);
|
||||
label = secret_item_get_label (item);
|
||||
g_assert_cmpstr (label, ==, "Item One");
|
||||
g_free (label);
|
||||
|
||||
attributes = gsecret_item_get_attributes (item);
|
||||
attributes = secret_item_get_attributes (item);
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "one");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "number"), ==, "1");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "even"), ==, "false");
|
||||
@ -311,22 +311,22 @@ test_set_label_sync (Test *test,
|
||||
{
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
gboolean ret;
|
||||
gchar *label;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
label = gsecret_item_get_label (item);
|
||||
label = secret_item_get_label (item);
|
||||
g_assert_cmpstr (label, ==, "Item One");
|
||||
g_free (label);
|
||||
|
||||
ret = gsecret_item_set_label_sync (item, "Another label", NULL, &error);
|
||||
ret = secret_item_set_label_sync (item, "Another label", NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
label = gsecret_item_get_label (item);
|
||||
label = secret_item_get_label (item);
|
||||
g_assert_cmpstr (label, ==, "Another label");
|
||||
g_free (label);
|
||||
|
||||
@ -340,28 +340,28 @@ test_set_label_async (Test *test,
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
gboolean ret;
|
||||
gchar *label;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
label = gsecret_item_get_label (item);
|
||||
label = secret_item_get_label (item);
|
||||
g_assert_cmpstr (label, ==, "Item One");
|
||||
g_free (label);
|
||||
|
||||
gsecret_item_set_label (item, "Another label", NULL, on_async_result, &result);
|
||||
secret_item_set_label (item, "Another label", NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_item_set_label_finish (item, result, &error);
|
||||
ret = secret_item_set_label_finish (item, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
g_object_unref (result);
|
||||
|
||||
label = gsecret_item_get_label (item);
|
||||
label = secret_item_get_label (item);
|
||||
g_assert_cmpstr (label, ==, "Another label");
|
||||
g_free (label);
|
||||
|
||||
@ -374,14 +374,14 @@ test_set_label_prop (Test *test,
|
||||
{
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
guint sigs = 2;
|
||||
gchar *label;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
label = gsecret_item_get_label (item);
|
||||
label = secret_item_get_label (item);
|
||||
g_assert_cmpstr (label, ==, "Item One");
|
||||
g_free (label);
|
||||
|
||||
@ -391,7 +391,7 @@ test_set_label_prop (Test *test,
|
||||
/* Wait for the property to actually 'take' */
|
||||
egg_test_wait ();
|
||||
|
||||
label = gsecret_item_get_label (item);
|
||||
label = secret_item_get_label (item);
|
||||
g_assert_cmpstr (label, ==, "Blah blah");
|
||||
g_free (label);
|
||||
|
||||
@ -404,14 +404,14 @@ test_set_attributes_sync (Test *test,
|
||||
{
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
gboolean ret;
|
||||
GHashTable *attributes;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
attributes = gsecret_item_get_attributes (item);
|
||||
attributes = secret_item_get_attributes (item);
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "one");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "number"), ==, "1");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "even"), ==, "false");
|
||||
@ -421,12 +421,12 @@ test_set_attributes_sync (Test *test,
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "string", "five");
|
||||
g_hash_table_insert (attributes, "number", "5");
|
||||
ret = gsecret_item_set_attributes_sync (item, attributes, NULL, &error);
|
||||
ret = secret_item_set_attributes_sync (item, attributes, NULL, &error);
|
||||
g_hash_table_unref (attributes);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
attributes = gsecret_item_get_attributes (item);
|
||||
attributes = secret_item_get_attributes (item);
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "five");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "number"), ==, "5");
|
||||
g_assert_cmpuint (g_hash_table_size (attributes), ==, 2);
|
||||
@ -443,13 +443,13 @@ test_set_attributes_async (Test *test,
|
||||
GHashTable *attributes;
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
gboolean ret;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
attributes = gsecret_item_get_attributes (item);
|
||||
attributes = secret_item_get_attributes (item);
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "one");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "number"), ==, "1");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "even"), ==, "false");
|
||||
@ -459,17 +459,17 @@ test_set_attributes_async (Test *test,
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "string", "five");
|
||||
g_hash_table_insert (attributes, "number", "5");
|
||||
gsecret_item_set_attributes (item, attributes, NULL, on_async_result, &result);
|
||||
secret_item_set_attributes (item, attributes, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_item_set_attributes_finish (item, result, &error);
|
||||
ret = secret_item_set_attributes_finish (item, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
g_object_unref (result);
|
||||
|
||||
attributes = gsecret_item_get_attributes (item);
|
||||
attributes = secret_item_get_attributes (item);
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "five");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "number"), ==, "5");
|
||||
g_assert_cmpuint (g_hash_table_size (attributes), ==, 2);
|
||||
@ -484,14 +484,14 @@ test_set_attributes_prop (Test *test,
|
||||
{
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
GHashTable *attributes;
|
||||
guint sigs = 2;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
attributes = gsecret_item_get_attributes (item);
|
||||
attributes = secret_item_get_attributes (item);
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "one");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "number"), ==, "1");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "even"), ==, "false");
|
||||
@ -509,7 +509,7 @@ test_set_attributes_prop (Test *test,
|
||||
/* Wait for the property to actually 'take' */
|
||||
egg_test_wait ();
|
||||
|
||||
attributes = gsecret_item_get_attributes (item);
|
||||
attributes = secret_item_get_attributes (item);
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "five");
|
||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "number"), ==, "5");
|
||||
g_assert_cmpuint (g_hash_table_size (attributes), ==, 2);
|
||||
@ -524,22 +524,22 @@ test_get_secret_sync (Test *test,
|
||||
{
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
GSecretValue *value;
|
||||
SecretItem *item;
|
||||
SecretValue *value;
|
||||
gconstpointer data;
|
||||
gsize length;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
value = gsecret_item_get_secret_sync (item, NULL, &error);
|
||||
value = secret_item_get_secret_sync (item, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (value != NULL);
|
||||
|
||||
data = gsecret_value_get (value, &length);
|
||||
data = secret_value_get (value, &length);
|
||||
egg_assert_cmpmem (data, length, ==, "111", 3);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
|
||||
g_object_unref (item);
|
||||
}
|
||||
@ -551,28 +551,28 @@ test_get_secret_async (Test *test,
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
GSecretValue *value;
|
||||
SecretItem *item;
|
||||
SecretValue *value;
|
||||
gconstpointer data;
|
||||
gsize length;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
gsecret_item_get_secret (item, NULL, on_async_result, &result);
|
||||
secret_item_get_secret (item, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
value = gsecret_item_get_secret_finish (item, result, &error);
|
||||
value = secret_item_get_secret_finish (item, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (value != NULL);
|
||||
g_object_unref (result);
|
||||
|
||||
data = gsecret_value_get (value, &length);
|
||||
data = secret_value_get (value, &length);
|
||||
egg_assert_cmpmem (data, length, ==, "111", 3);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
|
||||
g_object_unref (item);
|
||||
}
|
||||
@ -583,32 +583,32 @@ test_set_secret_sync (Test *test,
|
||||
{
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
gconstpointer data;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gsize length;
|
||||
gboolean ret;
|
||||
|
||||
value = gsecret_value_new ("Sinking", -1, "strange/content-type");
|
||||
value = secret_value_new ("Sinking", -1, "strange/content-type");
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ret = gsecret_item_set_secret_sync (item, value, NULL, &error);
|
||||
ret = secret_item_set_secret_sync (item, value, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
|
||||
value = gsecret_item_get_secret_sync (item, NULL, &error);
|
||||
value = secret_item_get_secret_sync (item, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (value != NULL);
|
||||
|
||||
data = gsecret_value_get (value, &length);
|
||||
data = secret_value_get (value, &length);
|
||||
egg_assert_cmpmem (data, length, ==, "Sinking", 7);
|
||||
g_assert_cmpstr (gsecret_value_get_content_type (value), ==, "strange/content-type");
|
||||
g_assert_cmpstr (secret_value_get_content_type (value), ==, "strange/content-type");
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
g_object_unref (item);
|
||||
}
|
||||
|
||||
@ -618,19 +618,19 @@ test_delete_sync (Test *test,
|
||||
{
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
gboolean ret;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ret = gsecret_item_delete_sync (item, NULL, &error);
|
||||
ret = secret_item_delete_sync (item, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
g_object_unref (item);
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||
g_assert (item == NULL);
|
||||
}
|
||||
@ -642,24 +642,24 @@ test_delete_async (Test *test,
|
||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
GSecretItem *item;
|
||||
SecretItem *item;
|
||||
gboolean ret;
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
gsecret_item_delete (item, NULL, on_async_result, &result);
|
||||
secret_item_delete (item, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_item_delete_finish (item, result, &error);
|
||||
ret = secret_item_delete_finish (item, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
g_object_unref (item);
|
||||
|
||||
item = gsecret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
item = secret_item_new_sync (test->service, item_path, NULL, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||
g_assert (item == NULL);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -13,10 +13,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-collection.h"
|
||||
#include "gsecret-item.h"
|
||||
#include "gsecret-service.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "secret-collection.h"
|
||||
#include "secret-item.h"
|
||||
#include "secret-service.h"
|
||||
#include "secret-private.h"
|
||||
|
||||
#include "mock-service.h"
|
||||
|
||||
@ -27,26 +27,26 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static const GSecretSchema DELETE_SCHEMA = {
|
||||
static const SecretSchema DELETE_SCHEMA = {
|
||||
"org.mock.schema.Delete",
|
||||
{
|
||||
{ "number", GSECRET_ATTRIBUTE_INTEGER },
|
||||
{ "string", GSECRET_ATTRIBUTE_STRING },
|
||||
{ "even", GSECRET_ATTRIBUTE_BOOLEAN },
|
||||
{ "number", SECRET_ATTRIBUTE_INTEGER },
|
||||
{ "string", SECRET_ATTRIBUTE_STRING },
|
||||
{ "even", SECRET_ATTRIBUTE_BOOLEAN },
|
||||
}
|
||||
};
|
||||
|
||||
static const GSecretSchema STORE_SCHEMA = {
|
||||
static const SecretSchema STORE_SCHEMA = {
|
||||
"org.mock.type.Store",
|
||||
{
|
||||
{ "number", GSECRET_ATTRIBUTE_INTEGER },
|
||||
{ "string", GSECRET_ATTRIBUTE_STRING },
|
||||
{ "even", GSECRET_ATTRIBUTE_BOOLEAN },
|
||||
{ "number", SECRET_ATTRIBUTE_INTEGER },
|
||||
{ "string", SECRET_ATTRIBUTE_STRING },
|
||||
{ "even", SECRET_ATTRIBUTE_BOOLEAN },
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
} Test;
|
||||
|
||||
static void
|
||||
@ -68,7 +68,7 @@ setup (Test *test,
|
||||
|
||||
setup_mock (test, data);
|
||||
|
||||
test->service = gsecret_service_get_sync (GSECRET_SERVICE_NONE, NULL, &error);
|
||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ test_search_paths_sync (Test *test,
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "number", "1");
|
||||
|
||||
ret = gsecret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
&unlocked, &locked, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -147,12 +147,12 @@ test_search_paths_async (Test *test,
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "number", "1");
|
||||
|
||||
gsecret_service_search_for_paths (test->service, attributes, NULL,
|
||||
secret_service_search_for_paths (test->service, attributes, NULL,
|
||||
on_complete_get_result, &result);
|
||||
egg_test_wait ();
|
||||
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
ret = gsecret_service_search_for_paths_finish (test->service, result,
|
||||
ret = secret_service_search_for_paths_finish (test->service, result,
|
||||
&unlocked, &locked,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
@ -184,7 +184,7 @@ test_search_paths_nulls (Test *test,
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "number", "1");
|
||||
|
||||
ret = gsecret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
&paths, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -192,7 +192,7 @@ test_search_paths_nulls (Test *test,
|
||||
g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/english/1");
|
||||
g_strfreev (paths);
|
||||
|
||||
ret = gsecret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
NULL, &paths, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -200,16 +200,16 @@ test_search_paths_nulls (Test *test,
|
||||
g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/spanish/10");
|
||||
g_strfreev (paths);
|
||||
|
||||
ret = gsecret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
NULL, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
gsecret_service_search_for_paths (test->service, attributes, NULL,
|
||||
secret_service_search_for_paths (test->service, attributes, NULL,
|
||||
on_complete_get_result, &result);
|
||||
egg_test_wait ();
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
ret = gsecret_service_search_for_paths_finish (test->service, result,
|
||||
ret = secret_service_search_for_paths_finish (test->service, result,
|
||||
&paths, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -218,11 +218,11 @@ test_search_paths_nulls (Test *test,
|
||||
g_strfreev (paths);
|
||||
g_clear_object (&result);
|
||||
|
||||
gsecret_service_search_for_paths (test->service, attributes, NULL,
|
||||
secret_service_search_for_paths (test->service, attributes, NULL,
|
||||
on_complete_get_result, &result);
|
||||
egg_test_wait ();
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
ret = gsecret_service_search_for_paths_finish (test->service, result,
|
||||
ret = secret_service_search_for_paths_finish (test->service, result,
|
||||
NULL, &paths, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -231,11 +231,11 @@ test_search_paths_nulls (Test *test,
|
||||
g_strfreev (paths);
|
||||
g_clear_object (&result);
|
||||
|
||||
gsecret_service_search_for_paths (test->service, attributes, NULL,
|
||||
secret_service_search_for_paths (test->service, attributes, NULL,
|
||||
on_complete_get_result, &result);
|
||||
egg_test_wait ();
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
ret = gsecret_service_search_for_paths_finish (test->service, result,
|
||||
ret = secret_service_search_for_paths_finish (test->service, result,
|
||||
NULL, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -257,7 +257,7 @@ test_search_sync (Test *test,
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "number", "1");
|
||||
|
||||
ret = gsecret_service_search_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_sync (test->service, attributes, NULL,
|
||||
&unlocked, &locked, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -288,12 +288,12 @@ test_search_async (Test *test,
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "number", "1");
|
||||
|
||||
gsecret_service_search (test->service, attributes, NULL,
|
||||
secret_service_search (test->service, attributes, NULL,
|
||||
on_complete_get_result, &result);
|
||||
egg_test_wait ();
|
||||
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
ret = gsecret_service_search_finish (test->service, result,
|
||||
ret = secret_service_search_finish (test->service, result,
|
||||
&unlocked, &locked,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
@ -325,7 +325,7 @@ test_search_nulls (Test *test,
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "number", "1");
|
||||
|
||||
ret = gsecret_service_search_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_sync (test->service, attributes, NULL,
|
||||
&items, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -333,7 +333,7 @@ test_search_nulls (Test *test,
|
||||
g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1");
|
||||
g_list_free_full (items, g_object_unref);
|
||||
|
||||
ret = gsecret_service_search_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_sync (test->service, attributes, NULL,
|
||||
NULL, &items, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -341,16 +341,16 @@ test_search_nulls (Test *test,
|
||||
g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/spanish/10");
|
||||
g_list_free_full (items, g_object_unref);
|
||||
|
||||
ret = gsecret_service_search_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_sync (test->service, attributes, NULL,
|
||||
NULL, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
gsecret_service_search (test->service, attributes, NULL,
|
||||
secret_service_search (test->service, attributes, NULL,
|
||||
on_complete_get_result, &result);
|
||||
egg_test_wait ();
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
ret = gsecret_service_search_finish (test->service, result,
|
||||
ret = secret_service_search_finish (test->service, result,
|
||||
&items, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -359,11 +359,11 @@ test_search_nulls (Test *test,
|
||||
g_list_free_full (items, g_object_unref);
|
||||
g_clear_object (&result);
|
||||
|
||||
gsecret_service_search (test->service, attributes, NULL,
|
||||
secret_service_search (test->service, attributes, NULL,
|
||||
on_complete_get_result, &result);
|
||||
egg_test_wait ();
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
ret = gsecret_service_search_finish (test->service, result,
|
||||
ret = secret_service_search_finish (test->service, result,
|
||||
NULL, &items, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -372,11 +372,11 @@ test_search_nulls (Test *test,
|
||||
g_list_free_full (items, g_object_unref);
|
||||
g_clear_object (&result);
|
||||
|
||||
gsecret_service_search (test->service, attributes, NULL,
|
||||
secret_service_search (test->service, attributes, NULL,
|
||||
on_complete_get_result, &result);
|
||||
egg_test_wait ();
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
ret = gsecret_service_search_finish (test->service, result,
|
||||
ret = secret_service_search_finish (test->service, result,
|
||||
NULL, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
@ -389,32 +389,32 @@ static void
|
||||
test_secret_for_path_sync (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
const gchar *password;
|
||||
gsize length;
|
||||
|
||||
path = "/org/freedesktop/secrets/collection/english/1";
|
||||
value = gsecret_service_get_secret_for_path_sync (test->service, path, NULL, &error);
|
||||
value = secret_service_get_secret_for_path_sync (test->service, path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (value != NULL);
|
||||
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
|
||||
password = gsecret_value_get (value, NULL);
|
||||
password = secret_value_get (value, NULL);
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
}
|
||||
|
||||
static void
|
||||
test_secret_for_path_async (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
const gchar *password;
|
||||
@ -422,24 +422,24 @@ test_secret_for_path_async (Test *test,
|
||||
gsize length;
|
||||
|
||||
path = "/org/freedesktop/secrets/collection/english/1";
|
||||
gsecret_service_get_secret_for_path (test->service, path, NULL,
|
||||
secret_service_get_secret_for_path (test->service, path, NULL,
|
||||
on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
egg_test_wait ();
|
||||
|
||||
value = gsecret_service_get_secret_for_path_finish (test->service, result, &error);
|
||||
value = secret_service_get_secret_for_path_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (value != NULL);
|
||||
g_object_unref (result);
|
||||
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
|
||||
password = gsecret_value_get (value, NULL);
|
||||
password = secret_value_get (value, NULL);
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -457,13 +457,13 @@ test_secrets_for_paths_sync (Test *test,
|
||||
NULL
|
||||
};
|
||||
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
GHashTable *values;
|
||||
GError *error = NULL;
|
||||
const gchar *password;
|
||||
gsize length;
|
||||
|
||||
values = gsecret_service_get_secrets_for_paths_sync (test->service, paths, NULL, &error);
|
||||
values = secret_service_get_secrets_for_paths_sync (test->service, paths, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (values != NULL);
|
||||
@ -471,13 +471,13 @@ test_secrets_for_paths_sync (Test *test,
|
||||
|
||||
value = g_hash_table_lookup (values, path_item_one);
|
||||
g_assert (value != NULL);
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
|
||||
value = g_hash_table_lookup (values, path_item_two);
|
||||
g_assert (value != NULL);
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "222");
|
||||
|
||||
@ -499,19 +499,19 @@ test_secrets_for_paths_async (Test *test,
|
||||
NULL
|
||||
};
|
||||
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
GHashTable *values;
|
||||
GError *error = NULL;
|
||||
const gchar *password;
|
||||
GAsyncResult *result = NULL;
|
||||
gsize length;
|
||||
|
||||
gsecret_service_get_secrets_for_paths (test->service, paths, NULL,
|
||||
secret_service_get_secrets_for_paths (test->service, paths, NULL,
|
||||
on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
egg_test_wait ();
|
||||
|
||||
values = gsecret_service_get_secrets_for_paths_finish (test->service, result, &error);
|
||||
values = secret_service_get_secrets_for_paths_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
@ -520,13 +520,13 @@ test_secrets_for_paths_async (Test *test,
|
||||
|
||||
value = g_hash_table_lookup (values, path_item_one);
|
||||
g_assert (value != NULL);
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
|
||||
value = g_hash_table_lookup (values, path_item_two);
|
||||
g_assert (value != NULL);
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "222");
|
||||
|
||||
@ -541,23 +541,23 @@ test_secrets_sync (Test *test,
|
||||
const gchar *path_item_two = "/org/freedesktop/secrets/collection/english/2";
|
||||
const gchar *path_item_three = "/org/freedesktop/secrets/collection/spanish/10";
|
||||
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
GHashTable *values;
|
||||
GError *error = NULL;
|
||||
const gchar *password;
|
||||
GSecretItem *item_one, *item_two, *item_three;
|
||||
SecretItem *item_one, *item_two, *item_three;
|
||||
GList *items = NULL;
|
||||
gsize length;
|
||||
|
||||
item_one = gsecret_item_new_sync (test->service, path_item_one, NULL, &error);
|
||||
item_two = gsecret_item_new_sync (test->service, path_item_two, NULL, &error);
|
||||
item_three = gsecret_item_new_sync (test->service, path_item_three, NULL, &error);
|
||||
item_one = secret_item_new_sync (test->service, path_item_one, NULL, &error);
|
||||
item_two = secret_item_new_sync (test->service, path_item_two, NULL, &error);
|
||||
item_three = secret_item_new_sync (test->service, path_item_three, NULL, &error);
|
||||
|
||||
items = g_list_append (items, item_one);
|
||||
items = g_list_append (items, item_two);
|
||||
items = g_list_append (items, item_three);
|
||||
|
||||
values = gsecret_service_get_secrets_sync (test->service, items, NULL, &error);
|
||||
values = secret_service_get_secrets_sync (test->service, items, NULL, &error);
|
||||
g_list_free_full (items, g_object_unref);
|
||||
g_assert_no_error (error);
|
||||
|
||||
@ -566,13 +566,13 @@ test_secrets_sync (Test *test,
|
||||
|
||||
value = g_hash_table_lookup (values, item_one);
|
||||
g_assert (value != NULL);
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
|
||||
value = g_hash_table_lookup (values, item_two);
|
||||
g_assert (value != NULL);
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "222");
|
||||
|
||||
@ -587,22 +587,22 @@ test_secrets_async (Test *test,
|
||||
const gchar *path_item_two = "/org/freedesktop/secrets/collection/english/2";
|
||||
const gchar *path_item_three = "/org/freedesktop/secrets/collection/spanish/10";
|
||||
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
GHashTable *values;
|
||||
GError *error = NULL;
|
||||
const gchar *password;
|
||||
GAsyncResult *result = NULL;
|
||||
GSecretItem *item_one, *item_two, *item_three;
|
||||
SecretItem *item_one, *item_two, *item_three;
|
||||
GList *items = NULL;
|
||||
gsize length;
|
||||
|
||||
item_one = gsecret_item_new_sync (test->service, path_item_one, NULL, &error);
|
||||
item_one = secret_item_new_sync (test->service, path_item_one, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
item_two = gsecret_item_new_sync (test->service, path_item_two, NULL, &error);
|
||||
item_two = secret_item_new_sync (test->service, path_item_two, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
item_three = gsecret_item_new_sync (test->service, path_item_three, NULL, &error);
|
||||
item_three = secret_item_new_sync (test->service, path_item_three, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
|
||||
@ -610,14 +610,14 @@ test_secrets_async (Test *test,
|
||||
items = g_list_append (items, item_two);
|
||||
items = g_list_append (items, item_three);
|
||||
|
||||
gsecret_service_get_secrets (test->service, items, NULL,
|
||||
secret_service_get_secrets (test->service, items, NULL,
|
||||
on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
g_list_free (items);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
values = gsecret_service_get_secrets_finish (test->service, result, &error);
|
||||
values = secret_service_get_secrets_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
@ -626,13 +626,13 @@ test_secrets_async (Test *test,
|
||||
|
||||
value = g_hash_table_lookup (values, item_one);
|
||||
g_assert (value != NULL);
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
|
||||
value = g_hash_table_lookup (values, item_two);
|
||||
g_assert (value != NULL);
|
||||
password = gsecret_value_get (value, &length);
|
||||
password = secret_value_get (value, &length);
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
g_assert_cmpstr (password, ==, "222");
|
||||
|
||||
@ -652,7 +652,7 @@ test_delete_for_path_sync (Test *test,
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_service_delete_path_sync (test->service, path_item_one, NULL, &error);
|
||||
ret = secret_service_delete_path_sync (test->service, path_item_one, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
}
|
||||
@ -666,7 +666,7 @@ test_delete_for_path_sync_prompt (Test *test,
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_service_delete_path_sync (test->service, path_item_one, NULL, &error);
|
||||
ret = secret_service_delete_path_sync (test->service, path_item_one, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
}
|
||||
@ -685,7 +685,7 @@ test_lock_paths_sync (Test *test,
|
||||
gchar **locked = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_service_lock_paths_sync (test->service, paths, NULL, &locked, &error);
|
||||
ret = secret_service_lock_paths_sync (test->service, paths, NULL, &locked, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -709,7 +709,7 @@ test_lock_prompt_sync (Test *test,
|
||||
gchar **locked = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_service_lock_paths_sync (test->service, paths, NULL, &locked, &error);
|
||||
ret = secret_service_lock_paths_sync (test->service, paths, NULL, &locked, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -724,18 +724,18 @@ test_lock_sync (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/lockone";
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GError *error = NULL;
|
||||
GList *locked;
|
||||
GList *objects;
|
||||
gboolean ret;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
objects = g_list_append (NULL, collection);
|
||||
|
||||
ret = gsecret_service_lock_sync (test->service, objects, NULL, &locked, &error);
|
||||
ret = secret_service_lock_sync (test->service, objects, NULL, &locked, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -762,7 +762,7 @@ test_unlock_paths_sync (Test *test,
|
||||
gchar **unlocked = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_service_unlock_paths_sync (test->service, paths, NULL, &unlocked, &error);
|
||||
ret = secret_service_unlock_paths_sync (test->service, paths, NULL, &unlocked, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -786,7 +786,7 @@ test_unlock_prompt_sync (Test *test,
|
||||
gchar **unlocked = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_service_unlock_paths_sync (test->service, paths, NULL, &unlocked, &error);
|
||||
ret = secret_service_unlock_paths_sync (test->service, paths, NULL, &unlocked, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -801,18 +801,18 @@ test_unlock_sync (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/lockone";
|
||||
GSecretCollection *collection;
|
||||
SecretCollection *collection;
|
||||
GError *error = NULL;
|
||||
GList *unlocked;
|
||||
GList *objects;
|
||||
gboolean ret;
|
||||
|
||||
collection = gsecret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
collection = secret_collection_new_sync (test->service, collection_path, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
objects = g_list_append (NULL, collection);
|
||||
|
||||
ret = gsecret_service_unlock_sync (test->service, objects, NULL, &unlocked, &error);
|
||||
ret = secret_service_unlock_sync (test->service, objects, NULL, &unlocked, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -835,10 +835,10 @@ test_collection_sync (Test *test,
|
||||
|
||||
properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
|
||||
(GDestroyNotify)g_variant_unref);
|
||||
g_hash_table_insert (properties, GSECRET_COLLECTION_INTERFACE ".Label",
|
||||
g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label",
|
||||
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
|
||||
|
||||
path = gsecret_service_create_collection_path_sync (test->service, properties,
|
||||
path = secret_service_create_collection_path_sync (test->service, properties,
|
||||
NULL, NULL, &error);
|
||||
|
||||
g_hash_table_unref (properties);
|
||||
@ -861,10 +861,10 @@ test_collection_async (Test *test,
|
||||
|
||||
properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
|
||||
(GDestroyNotify)g_variant_unref);
|
||||
g_hash_table_insert (properties, GSECRET_COLLECTION_INTERFACE ".Label",
|
||||
g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label",
|
||||
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
|
||||
|
||||
gsecret_service_create_collection_path (test->service, properties,
|
||||
secret_service_create_collection_path (test->service, properties,
|
||||
NULL, NULL, on_complete_get_result, &result);
|
||||
|
||||
g_hash_table_unref (properties);
|
||||
@ -872,7 +872,7 @@ test_collection_async (Test *test,
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
path = gsecret_service_create_collection_path_finish (test->service, result, &error);
|
||||
path = secret_service_create_collection_path_finish (test->service, result, &error);
|
||||
g_object_unref (result);
|
||||
|
||||
g_assert_no_error (error);
|
||||
@ -889,7 +889,7 @@ test_item_sync (Test *test,
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GHashTable *properties;
|
||||
GHashTable *attributes;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
GError *error = NULL;
|
||||
gchar *path;
|
||||
|
||||
@ -900,22 +900,22 @@ test_item_sync (Test *test,
|
||||
|
||||
properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
|
||||
(GDestroyNotify)g_variant_unref);
|
||||
g_hash_table_insert (properties, GSECRET_COLLECTION_INTERFACE ".Label",
|
||||
g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label",
|
||||
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
|
||||
g_hash_table_insert (properties, GSECRET_COLLECTION_INTERFACE ".Attributes",
|
||||
g_variant_ref_sink (_gsecret_util_variant_for_attributes (attributes)));
|
||||
g_hash_table_insert (properties, GSECRET_COLLECTION_INTERFACE ".Type",
|
||||
g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Attributes",
|
||||
g_variant_ref_sink (_secret_util_variant_for_attributes (attributes)));
|
||||
g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Type",
|
||||
g_variant_ref_sink (g_variant_new_string ("org.gnome.Test")));
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
|
||||
value = gsecret_value_new ("andmoreandmore", -1, "text/plain");
|
||||
value = secret_value_new ("andmoreandmore", -1, "text/plain");
|
||||
|
||||
path = gsecret_service_create_item_path_sync (test->service, collection_path,
|
||||
path = secret_service_create_item_path_sync (test->service, collection_path,
|
||||
properties, value, FALSE,
|
||||
NULL, &error);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
g_hash_table_unref (properties);
|
||||
|
||||
g_assert_no_error (error);
|
||||
@ -932,7 +932,7 @@ test_item_async (Test *test,
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GHashTable *properties;
|
||||
GHashTable *attributes;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
gchar *path;
|
||||
@ -944,28 +944,28 @@ test_item_async (Test *test,
|
||||
|
||||
properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
|
||||
(GDestroyNotify)g_variant_unref);
|
||||
g_hash_table_insert (properties, GSECRET_COLLECTION_INTERFACE ".Label",
|
||||
g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label",
|
||||
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
|
||||
g_hash_table_insert (properties, GSECRET_COLLECTION_INTERFACE ".Attributes",
|
||||
g_variant_ref_sink (_gsecret_util_variant_for_attributes (attributes)));
|
||||
g_hash_table_insert (properties, GSECRET_COLLECTION_INTERFACE ".Type",
|
||||
g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Attributes",
|
||||
g_variant_ref_sink (_secret_util_variant_for_attributes (attributes)));
|
||||
g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Type",
|
||||
g_variant_ref_sink (g_variant_new_string ("org.gnome.Test")));
|
||||
|
||||
g_hash_table_unref (attributes);
|
||||
|
||||
value = gsecret_value_new ("andmoreandmore", -1, "text/plain");
|
||||
value = secret_value_new ("andmoreandmore", -1, "text/plain");
|
||||
|
||||
gsecret_service_create_item_path (test->service, collection_path,
|
||||
secret_service_create_item_path (test->service, collection_path,
|
||||
properties, value, FALSE,
|
||||
NULL, on_complete_get_result, &result);
|
||||
|
||||
g_assert (result == NULL);
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
g_hash_table_unref (properties);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
path = gsecret_service_create_item_path_finish (test->service, result, &error);
|
||||
path = secret_service_create_item_path_finish (test->service, result, &error);
|
||||
g_object_unref (result);
|
||||
|
||||
g_assert_no_error (error);
|
||||
@ -982,7 +982,7 @@ test_remove_sync (Test *test,
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_service_remove_sync (test->service, &DELETE_SCHEMA, NULL, &error,
|
||||
ret = secret_service_remove_sync (test->service, &DELETE_SCHEMA, NULL, &error,
|
||||
"even", FALSE,
|
||||
"string", "one",
|
||||
"number", 1,
|
||||
@ -1000,7 +1000,7 @@ test_remove_async (Test *test,
|
||||
GAsyncResult *result = NULL;
|
||||
gboolean ret;
|
||||
|
||||
gsecret_service_remove (test->service, &DELETE_SCHEMA, NULL,
|
||||
secret_service_remove (test->service, &DELETE_SCHEMA, NULL,
|
||||
on_complete_get_result, &result,
|
||||
"even", FALSE,
|
||||
"string", "one",
|
||||
@ -1011,7 +1011,7 @@ test_remove_async (Test *test,
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_service_remove_finish (test->service, result, &error);
|
||||
ret = secret_service_remove_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -1025,7 +1025,7 @@ test_remove_locked (Test *test,
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_service_remove_sync (test->service, &DELETE_SCHEMA, NULL, &error,
|
||||
ret = secret_service_remove_sync (test->service, &DELETE_SCHEMA, NULL, &error,
|
||||
"even", FALSE,
|
||||
"string", "tres",
|
||||
"number", 3,
|
||||
@ -1043,7 +1043,7 @@ test_remove_no_match (Test *test,
|
||||
gboolean ret;
|
||||
|
||||
/* Won't match anything */
|
||||
ret = gsecret_service_remove_sync (test->service, &DELETE_SCHEMA, NULL, &error,
|
||||
ret = secret_service_remove_sync (test->service, &DELETE_SCHEMA, NULL, &error,
|
||||
"even", TRUE,
|
||||
"string", "one",
|
||||
NULL);
|
||||
@ -1057,10 +1057,10 @@ test_lookup_sync (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gsize length;
|
||||
|
||||
value = gsecret_service_lookup_sync (test->service, &STORE_SCHEMA, NULL, &error,
|
||||
value = secret_service_lookup_sync (test->service, &STORE_SCHEMA, NULL, &error,
|
||||
"even", FALSE,
|
||||
"string", "one",
|
||||
"number", 1,
|
||||
@ -1069,10 +1069,10 @@ test_lookup_sync (Test *test,
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (value != NULL);
|
||||
g_assert_cmpstr (gsecret_value_get (value, &length), ==, "111");
|
||||
g_assert_cmpstr (secret_value_get (value, &length), ==, "111");
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1081,10 +1081,10 @@ test_lookup_async (Test *test,
|
||||
{
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gsize length;
|
||||
|
||||
gsecret_service_lookup (test->service, &STORE_SCHEMA, NULL,
|
||||
secret_service_lookup (test->service, &STORE_SCHEMA, NULL,
|
||||
on_complete_get_result, &result,
|
||||
"even", FALSE,
|
||||
"string", "one",
|
||||
@ -1095,14 +1095,14 @@ test_lookup_async (Test *test,
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
value = gsecret_service_lookup_finish (test->service, result, &error);
|
||||
value = secret_service_lookup_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (value != NULL);
|
||||
g_assert_cmpstr (gsecret_value_get (value, &length), ==, "111");
|
||||
g_assert_cmpstr (secret_value_get (value, &length), ==, "111");
|
||||
g_assert_cmpuint (length, ==, 3);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
g_object_unref (result);
|
||||
}
|
||||
|
||||
@ -1111,10 +1111,10 @@ test_lookup_locked (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gsize length;
|
||||
|
||||
value = gsecret_service_lookup_sync (test->service, &STORE_SCHEMA, NULL, &error,
|
||||
value = secret_service_lookup_sync (test->service, &STORE_SCHEMA, NULL, &error,
|
||||
"even", FALSE,
|
||||
"string", "tres",
|
||||
"number", 3,
|
||||
@ -1123,10 +1123,10 @@ test_lookup_locked (Test *test,
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (value != NULL);
|
||||
g_assert_cmpstr (gsecret_value_get (value, &length), ==, "3333");
|
||||
g_assert_cmpstr (secret_value_get (value, &length), ==, "3333");
|
||||
g_assert_cmpuint (length, ==, 4);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1134,10 +1134,10 @@ test_lookup_no_match (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
|
||||
/* Won't match anything */
|
||||
value = gsecret_service_lookup_sync (test->service, &STORE_SCHEMA, NULL, &error,
|
||||
value = secret_service_lookup_sync (test->service, &STORE_SCHEMA, NULL, &error,
|
||||
"even", TRUE,
|
||||
"string", "one",
|
||||
NULL);
|
||||
@ -1151,28 +1151,28 @@ test_store_sync (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GSecretValue *value = gsecret_value_new ("apassword", -1, "text/plain");
|
||||
SecretValue *value = secret_value_new ("apassword", -1, "text/plain");
|
||||
GHashTable *attributes;
|
||||
GError *error = NULL;
|
||||
gchar **paths;
|
||||
gboolean ret;
|
||||
gsize length;
|
||||
|
||||
ret = gsecret_service_store_sync (test->service, &STORE_SCHEMA, collection_path,
|
||||
ret = secret_service_store_sync (test->service, &STORE_SCHEMA, collection_path,
|
||||
"New Item Label", value, NULL, &error,
|
||||
"even", FALSE,
|
||||
"string", "seventeen",
|
||||
"number", 17,
|
||||
NULL);
|
||||
g_assert_no_error (error);
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "even", "false");
|
||||
g_hash_table_insert (attributes, "string", "seventeen");
|
||||
g_hash_table_insert (attributes, "number", "17");
|
||||
|
||||
ret = gsecret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
&paths, NULL, &error);
|
||||
g_hash_table_unref (attributes);
|
||||
g_assert (ret == TRUE);
|
||||
@ -1181,15 +1181,15 @@ test_store_sync (Test *test,
|
||||
g_assert (paths[0] != NULL);
|
||||
g_assert (paths[1] == NULL);
|
||||
|
||||
value = gsecret_service_get_secret_for_path_sync (test->service, paths[0],
|
||||
value = secret_service_get_secret_for_path_sync (test->service, paths[0],
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (value != NULL);
|
||||
g_assert_cmpstr (gsecret_value_get (value, &length), ==, "apassword");
|
||||
g_assert_cmpstr (secret_value_get (value, &length), ==, "apassword");
|
||||
g_assert_cmpuint (length, ==, 9);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
g_strfreev (paths);
|
||||
}
|
||||
|
||||
@ -1198,13 +1198,13 @@ test_store_replace (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GSecretValue *value = gsecret_value_new ("apassword", -1, "text/plain");
|
||||
SecretValue *value = secret_value_new ("apassword", -1, "text/plain");
|
||||
GHashTable *attributes;
|
||||
GError *error = NULL;
|
||||
gchar **paths;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_service_store_sync (test->service, &STORE_SCHEMA, collection_path,
|
||||
ret = secret_service_store_sync (test->service, &STORE_SCHEMA, collection_path,
|
||||
"New Item Label", value, NULL, &error,
|
||||
"even", FALSE,
|
||||
"string", "seventeen",
|
||||
@ -1212,21 +1212,21 @@ test_store_replace (Test *test,
|
||||
NULL);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ret = gsecret_service_store_sync (test->service, &STORE_SCHEMA, collection_path,
|
||||
ret = secret_service_store_sync (test->service, &STORE_SCHEMA, collection_path,
|
||||
"Another Label", value, NULL, &error,
|
||||
"even", FALSE,
|
||||
"string", "seventeen",
|
||||
"number", 17,
|
||||
NULL);
|
||||
g_assert_no_error (error);
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
|
||||
attributes = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_hash_table_insert (attributes, "even", "false");
|
||||
g_hash_table_insert (attributes, "string", "seventeen");
|
||||
g_hash_table_insert (attributes, "number", "17");
|
||||
|
||||
ret = gsecret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
&paths, NULL, &error);
|
||||
g_hash_table_unref (attributes);
|
||||
g_assert (ret == TRUE);
|
||||
@ -1243,7 +1243,7 @@ test_store_async (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||
GSecretValue *value = gsecret_value_new ("apassword", -1, "text/plain");
|
||||
SecretValue *value = secret_value_new ("apassword", -1, "text/plain");
|
||||
GAsyncResult *result = NULL;
|
||||
GHashTable *attributes;
|
||||
GError *error = NULL;
|
||||
@ -1251,18 +1251,18 @@ test_store_async (Test *test,
|
||||
gboolean ret;
|
||||
gsize length;
|
||||
|
||||
gsecret_service_store (test->service, &STORE_SCHEMA, collection_path,
|
||||
secret_service_store (test->service, &STORE_SCHEMA, collection_path,
|
||||
"New Item Label", value, NULL, on_complete_get_result, &result,
|
||||
"even", FALSE,
|
||||
"string", "seventeen",
|
||||
"number", 17,
|
||||
NULL);
|
||||
g_assert (result == NULL);
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_service_store_finish (test->service, result, &error);
|
||||
ret = secret_service_store_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
@ -1271,7 +1271,7 @@ test_store_async (Test *test,
|
||||
g_hash_table_insert (attributes, "string", "seventeen");
|
||||
g_hash_table_insert (attributes, "number", "17");
|
||||
|
||||
ret = gsecret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
ret = secret_service_search_for_paths_sync (test->service, attributes, NULL,
|
||||
&paths, NULL, &error);
|
||||
g_hash_table_unref (attributes);
|
||||
g_assert (ret == TRUE);
|
||||
@ -1280,15 +1280,15 @@ test_store_async (Test *test,
|
||||
g_assert (paths[0] != NULL);
|
||||
g_assert (paths[1] == NULL);
|
||||
|
||||
value = gsecret_service_get_secret_for_path_sync (test->service, paths[0],
|
||||
value = secret_service_get_secret_for_path_sync (test->service, paths[0],
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (value != NULL);
|
||||
g_assert_cmpstr (gsecret_value_get (value, &length), ==, "apassword");
|
||||
g_assert_cmpstr (secret_value_get (value, &length), ==, "apassword");
|
||||
g_assert_cmpuint (length, ==, 9);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
g_strfreev (paths);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
*
|
||||
@ -14,8 +14,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-password.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "secret-password.h"
|
||||
#include "secret-private.h"
|
||||
|
||||
#include "mock-service.h"
|
||||
|
||||
@ -26,12 +26,12 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static const GSecretSchema PASSWORD_SCHEMA = {
|
||||
static const SecretSchema PASSWORD_SCHEMA = {
|
||||
"org.mock.schema.Password",
|
||||
{
|
||||
{ "number", GSECRET_ATTRIBUTE_INTEGER },
|
||||
{ "string", GSECRET_ATTRIBUTE_STRING },
|
||||
{ "even", GSECRET_ATTRIBUTE_BOOLEAN },
|
||||
{ "number", SECRET_ATTRIBUTE_INTEGER },
|
||||
{ "string", SECRET_ATTRIBUTE_STRING },
|
||||
{ "even", SECRET_ATTRIBUTE_BOOLEAN },
|
||||
}
|
||||
};
|
||||
|
||||
@ -76,7 +76,7 @@ test_lookup_sync (Test *test,
|
||||
gchar *password;
|
||||
GError *error = NULL;
|
||||
|
||||
password = gsecret_password_lookup_sync (&PASSWORD_SCHEMA, NULL, &error,
|
||||
password = secret_password_lookup_sync (&PASSWORD_SCHEMA, NULL, &error,
|
||||
"even", FALSE,
|
||||
"string", "one",
|
||||
"number", 1,
|
||||
@ -85,7 +85,7 @@ test_lookup_sync (Test *test,
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
|
||||
gsecret_password_free (password);
|
||||
secret_password_free (password);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -96,7 +96,7 @@ test_lookup_async (Test *test,
|
||||
GError *error = NULL;
|
||||
gchar *password;
|
||||
|
||||
gsecret_password_lookup (&PASSWORD_SCHEMA, NULL, on_complete_get_result, &result,
|
||||
secret_password_lookup (&PASSWORD_SCHEMA, NULL, on_complete_get_result, &result,
|
||||
"even", FALSE,
|
||||
"string", "one",
|
||||
"number", 1,
|
||||
@ -105,12 +105,12 @@ test_lookup_async (Test *test,
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
password = gsecret_password_lookup_finish (result, &error);
|
||||
password = secret_password_lookup_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
g_assert_cmpstr (password, ==, "111");
|
||||
gsecret_password_free (password);
|
||||
secret_password_free (password);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -122,7 +122,7 @@ test_store_sync (Test *test,
|
||||
gchar *password;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_password_store_sync (&PASSWORD_SCHEMA, collection_path,
|
||||
ret = secret_password_store_sync (&PASSWORD_SCHEMA, collection_path,
|
||||
"Label here", "the password", NULL, &error,
|
||||
"even", TRUE,
|
||||
"string", "twelve",
|
||||
@ -132,14 +132,14 @@ test_store_sync (Test *test,
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
password = gsecret_password_lookup_sync (&PASSWORD_SCHEMA, NULL, &error,
|
||||
password = secret_password_lookup_sync (&PASSWORD_SCHEMA, NULL, &error,
|
||||
"string", "twelve",
|
||||
NULL);
|
||||
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpstr (password, ==, "the password");
|
||||
|
||||
gsecret_password_free (password);
|
||||
secret_password_free (password);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -152,7 +152,7 @@ test_store_async (Test *test,
|
||||
gchar *password;
|
||||
gboolean ret;
|
||||
|
||||
gsecret_password_store (&PASSWORD_SCHEMA, collection_path, "Label here",
|
||||
secret_password_store (&PASSWORD_SCHEMA, collection_path, "Label here",
|
||||
"the password", NULL, on_complete_get_result, &result,
|
||||
"even", TRUE,
|
||||
"string", "twelve",
|
||||
@ -162,19 +162,19 @@ test_store_async (Test *test,
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_password_store_finish (result, &error);
|
||||
ret = secret_password_store_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
g_object_unref (result);
|
||||
|
||||
password = gsecret_password_lookup_sync (&PASSWORD_SCHEMA, NULL, &error,
|
||||
password = secret_password_lookup_sync (&PASSWORD_SCHEMA, NULL, &error,
|
||||
"string", "twelve",
|
||||
NULL);
|
||||
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpstr (password, ==, "the password");
|
||||
|
||||
gsecret_password_free (password);
|
||||
secret_password_free (password);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -184,7 +184,7 @@ test_delete_sync (Test *test,
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gsecret_password_remove_sync (&PASSWORD_SCHEMA, NULL, &error,
|
||||
ret = secret_password_remove_sync (&PASSWORD_SCHEMA, NULL, &error,
|
||||
"even", FALSE,
|
||||
"string", "one",
|
||||
"number", 1,
|
||||
@ -202,7 +202,7 @@ test_delete_async (Test *test,
|
||||
GAsyncResult *result = NULL;
|
||||
gboolean ret;
|
||||
|
||||
gsecret_password_remove (&PASSWORD_SCHEMA, NULL,
|
||||
secret_password_remove (&PASSWORD_SCHEMA, NULL,
|
||||
on_complete_get_result, &result,
|
||||
"even", FALSE,
|
||||
"string", "one",
|
||||
@ -213,7 +213,7 @@ test_delete_async (Test *test,
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_password_remove_finish (result, &error);
|
||||
ret = secret_password_remove_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -223,7 +223,7 @@ test_delete_async (Test *test,
|
||||
static void
|
||||
test_password_free_null (void)
|
||||
{
|
||||
gsecret_password_free (NULL);
|
||||
secret_password_free (NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Red Hat Inc.
|
||||
*
|
||||
@ -15,10 +15,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-item.h"
|
||||
#include "gsecret-service.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "gsecret-prompt.h"
|
||||
#include "secret-item.h"
|
||||
#include "secret-service.h"
|
||||
#include "secret-private.h"
|
||||
#include "secret-prompt.h"
|
||||
|
||||
#include "mock-service.h"
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
} Test;
|
||||
|
||||
static void
|
||||
@ -43,7 +43,7 @@ setup (Test *test,
|
||||
mock_service_start (mock_script, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
test->service = gsecret_service_get_sync (GSECRET_SERVICE_NONE, NULL, &error);
|
||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ static void
|
||||
test_perform_sync (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
guint value = 0;
|
||||
@ -90,9 +90,9 @@ test_perform_sync (Test *test,
|
||||
/* Verify that main loop does not run during this call */
|
||||
increment_id = g_idle_add (on_idle_increment, &value);
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
|
||||
ret = gsecret_prompt_perform_sync (prompt, 0, NULL, &error);
|
||||
ret = secret_prompt_perform_sync (prompt, 0, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -107,7 +107,7 @@ static void
|
||||
test_perform_run (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
guint value = 0;
|
||||
@ -116,9 +116,9 @@ test_perform_run (Test *test,
|
||||
/* Verify that main loop does run during this call */
|
||||
increment_id = g_idle_add (on_idle_increment, &value);
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
|
||||
ret = gsecret_prompt_run (prompt, 0, NULL, &error);
|
||||
ret = secret_prompt_run (prompt, 0, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret);
|
||||
|
||||
@ -136,19 +136,19 @@ static void
|
||||
test_perform_async (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
gboolean ret;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
|
||||
gsecret_prompt_perform (prompt, 0, NULL, on_async_result, &result);
|
||||
secret_prompt_perform (prompt, 0, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_prompt_perform_finish (prompt, result, &error);
|
||||
ret = secret_prompt_perform_finish (prompt, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
g_object_unref (result);
|
||||
@ -164,16 +164,16 @@ static void
|
||||
test_perform_cancel (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
GCancellable *cancellable;
|
||||
gboolean ret;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/delay");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/delay");
|
||||
|
||||
cancellable = g_cancellable_new ();
|
||||
gsecret_prompt_perform (prompt, 0, cancellable, on_async_result, &result);
|
||||
secret_prompt_perform (prompt, 0, cancellable, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
g_cancellable_cancel (cancellable);
|
||||
@ -181,7 +181,7 @@ test_perform_cancel (Test *test,
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_prompt_perform_finish (prompt, result, &error);
|
||||
ret = secret_prompt_perform_finish (prompt, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -198,13 +198,13 @@ static void
|
||||
test_perform_fail (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/error");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/error");
|
||||
|
||||
ret = gsecret_prompt_perform_sync (prompt, 0, NULL, &error);
|
||||
ret = secret_prompt_perform_sync (prompt, 0, NULL, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED);
|
||||
g_assert (ret == FALSE);
|
||||
|
||||
@ -216,13 +216,13 @@ static void
|
||||
test_perform_vanish (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/vanish");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/vanish");
|
||||
|
||||
ret = gsecret_prompt_perform_sync (prompt, 0, NULL, &error);
|
||||
ret = secret_prompt_perform_sync (prompt, 0, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == FALSE);
|
||||
|
||||
@ -234,21 +234,21 @@ static void
|
||||
test_prompt_result (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
GVariant *result;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/result");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/result");
|
||||
|
||||
result = gsecret_prompt_get_result_value (prompt, NULL);
|
||||
result = secret_prompt_get_result_value (prompt, NULL);
|
||||
g_assert (result == NULL);
|
||||
|
||||
ret = gsecret_prompt_perform_sync (prompt, 0, NULL, &error);
|
||||
ret = secret_prompt_perform_sync (prompt, 0, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
result = gsecret_prompt_get_result_value (prompt, G_VARIANT_TYPE_STRING);
|
||||
result = secret_prompt_get_result_value (prompt, G_VARIANT_TYPE_STRING);
|
||||
g_assert (result != NULL);
|
||||
g_assert_cmpstr (g_variant_get_string (result, NULL), ==, "Special Result");
|
||||
g_variant_unref (result);
|
||||
@ -261,18 +261,18 @@ static void
|
||||
test_prompt_window_id (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
GVariant *result;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/window");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/window");
|
||||
|
||||
ret = gsecret_prompt_perform_sync (prompt, 555, NULL, &error);
|
||||
ret = secret_prompt_perform_sync (prompt, 555, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
result = gsecret_prompt_get_result_value (prompt, G_VARIANT_TYPE_STRING);
|
||||
result = secret_prompt_get_result_value (prompt, G_VARIANT_TYPE_STRING);
|
||||
g_assert (result != NULL);
|
||||
g_assert_cmpstr (g_variant_get_string (result, NULL), ==, "555");
|
||||
g_variant_unref (result);
|
||||
@ -285,13 +285,13 @@ static void
|
||||
test_service_sync (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
gboolean ret;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
|
||||
ret = gsecret_service_prompt_sync (test->service, prompt, NULL, &error);
|
||||
ret = secret_service_prompt_sync (test->service, prompt, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
@ -303,19 +303,19 @@ static void
|
||||
test_service_async (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
gboolean ret;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
|
||||
gsecret_service_prompt (test->service, prompt, NULL, on_async_result, &result);
|
||||
secret_service_prompt (test->service, prompt, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_service_prompt_finish (test->service, result, &error);
|
||||
ret = secret_service_prompt_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
g_object_unref (result);
|
||||
@ -331,19 +331,19 @@ static void
|
||||
test_service_fail (Test *test,
|
||||
gconstpointer unused)
|
||||
{
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
gboolean ret;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/error");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/error");
|
||||
|
||||
gsecret_service_prompt (test->service, prompt, NULL, on_async_result, &result);
|
||||
secret_service_prompt (test->service, prompt, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_service_prompt_finish (test->service, result, &error);
|
||||
ret = secret_service_prompt_finish (test->service, result, &error);
|
||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED);
|
||||
g_assert (ret == FALSE);
|
||||
g_object_unref (result);
|
||||
@ -361,18 +361,18 @@ test_service_path (Test *test,
|
||||
{
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
GSecretPrompt *prompt;
|
||||
SecretPrompt *prompt;
|
||||
gboolean ret;
|
||||
|
||||
prompt = gsecret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
prompt = secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||
|
||||
gsecret_service_prompt (test->service, prompt, NULL, on_async_result, &result);
|
||||
secret_service_prompt (test->service, prompt, NULL, on_async_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
g_object_unref (prompt);
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_service_prompt_finish (test->service, result, &error);
|
||||
ret = secret_service_prompt_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
g_object_unref (result);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -13,10 +13,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-collection.h"
|
||||
#include "gsecret-item.h"
|
||||
#include "gsecret-service.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "secret-collection.h"
|
||||
#include "secret-item.h"
|
||||
#include "secret-service.h"
|
||||
#include "secret-private.h"
|
||||
|
||||
#include "mock-service.h"
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
} Test;
|
||||
|
||||
static void
|
||||
@ -64,20 +64,20 @@ on_complete_get_result (GObject *source,
|
||||
static void
|
||||
test_get_sync (void)
|
||||
{
|
||||
GSecretService *service1;
|
||||
GSecretService *service2;
|
||||
GSecretService *service3;
|
||||
SecretService *service1;
|
||||
SecretService *service2;
|
||||
SecretService *service3;
|
||||
GError *error = NULL;
|
||||
|
||||
/* Both these sohuld point to the same thing */
|
||||
|
||||
service1 = gsecret_service_get_sync (GSECRET_SERVICE_NONE, NULL, &error);
|
||||
service1 = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
service2 = gsecret_service_get_sync (GSECRET_SERVICE_NONE, NULL, &error);
|
||||
service2 = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (GSECRET_IS_SERVICE (service1));
|
||||
g_assert (SECRET_IS_SERVICE (service1));
|
||||
g_assert (service1 == service2);
|
||||
|
||||
g_object_unref (service1);
|
||||
@ -87,8 +87,8 @@ test_get_sync (void)
|
||||
egg_assert_not_object (service2);
|
||||
|
||||
/* Services were unreffed, so this should create a new one */
|
||||
service3 = gsecret_service_get_sync (GSECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert (GSECRET_IS_SERVICE (service3));
|
||||
service3 = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert (SECRET_IS_SERVICE (service3));
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_object_unref (service3);
|
||||
@ -98,29 +98,29 @@ test_get_sync (void)
|
||||
static void
|
||||
test_get_async (void)
|
||||
{
|
||||
GSecretService *service1;
|
||||
GSecretService *service2;
|
||||
GSecretService *service3;
|
||||
SecretService *service1;
|
||||
SecretService *service2;
|
||||
SecretService *service3;
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
/* Both these sohuld point to the same thing */
|
||||
|
||||
gsecret_service_get (GSECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
egg_test_wait ();
|
||||
service1 = gsecret_service_get_finish (result, &error);
|
||||
service1 = secret_service_get_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_clear_object (&result);
|
||||
|
||||
gsecret_service_get (GSECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
egg_test_wait ();
|
||||
service2 = gsecret_service_get_finish (result, &error);
|
||||
service2 = secret_service_get_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_clear_object (&result);
|
||||
|
||||
g_assert (GSECRET_IS_SERVICE (service1));
|
||||
g_assert (SECRET_IS_SERVICE (service1));
|
||||
g_assert (service1 == service2);
|
||||
|
||||
g_object_unref (service1);
|
||||
@ -130,10 +130,10 @@ test_get_async (void)
|
||||
egg_assert_not_object (service2);
|
||||
|
||||
/* Services were unreffed, so this should create a new one */
|
||||
gsecret_service_get (GSECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
egg_test_wait ();
|
||||
service3 = gsecret_service_get_finish (result, &error);
|
||||
service3 = secret_service_get_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_clear_object (&result);
|
||||
|
||||
@ -145,35 +145,35 @@ static void
|
||||
test_get_more_sync (Test *test,
|
||||
gconstpointer data)
|
||||
{
|
||||
GSecretService *service;
|
||||
GSecretService *service2;
|
||||
SecretService *service;
|
||||
SecretService *service2;
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
GList *collections;
|
||||
|
||||
service = gsecret_service_get_sync (GSECRET_SERVICE_NONE, NULL, &error);
|
||||
service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_NONE);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_NONE);
|
||||
|
||||
service2 = gsecret_service_get_sync (GSECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
|
||||
service2 = secret_service_get_sync (SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (GSECRET_IS_SERVICE (service));
|
||||
g_assert (SECRET_IS_SERVICE (service));
|
||||
g_assert (service == service2);
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
collections = gsecret_service_get_collections (service);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
collections = secret_service_get_collections (service);
|
||||
g_assert (collections != NULL);
|
||||
g_list_free_full (collections, g_object_unref);
|
||||
|
||||
g_object_unref (service2);
|
||||
|
||||
service2 = gsecret_service_get_sync (GSECRET_SERVICE_OPEN_SESSION, NULL, &error);
|
||||
service2 = secret_service_get_sync (SECRET_SERVICE_OPEN_SESSION, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_OPEN_SESSION | GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = gsecret_service_get_session_path (service);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = secret_service_get_session_path (service);
|
||||
g_assert (path != NULL);
|
||||
|
||||
g_object_unref (service2);
|
||||
@ -187,26 +187,26 @@ test_get_more_async (Test *test,
|
||||
gconstpointer data)
|
||||
{
|
||||
GAsyncResult *result = NULL;
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
GList *collections;
|
||||
|
||||
gsecret_service_get (GSECRET_SERVICE_LOAD_COLLECTIONS | GSECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result);
|
||||
secret_service_get (SECRET_SERVICE_LOAD_COLLECTIONS | SECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
service = gsecret_service_get_finish (result, &error);
|
||||
service = secret_service_get_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
result = NULL;
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_OPEN_SESSION | GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = gsecret_service_get_session_path (service);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = secret_service_get_session_path (service);
|
||||
g_assert (path != NULL);
|
||||
|
||||
collections = gsecret_service_get_collections (service);
|
||||
collections = secret_service_get_collections (service);
|
||||
g_assert (collections != NULL);
|
||||
g_list_free_full (collections, g_object_unref);
|
||||
|
||||
@ -215,20 +215,20 @@ test_get_more_async (Test *test,
|
||||
|
||||
/* Now get a session with just collections */
|
||||
|
||||
gsecret_service_get (GSECRET_SERVICE_LOAD_COLLECTIONS, NULL, on_complete_get_result, &result);
|
||||
secret_service_get (SECRET_SERVICE_LOAD_COLLECTIONS, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
service = gsecret_service_get_finish (result, &error);
|
||||
service = secret_service_get_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = gsecret_service_get_session_path (service);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = secret_service_get_session_path (service);
|
||||
g_assert (path == NULL);
|
||||
|
||||
collections = gsecret_service_get_collections (service);
|
||||
collections = secret_service_get_collections (service);
|
||||
g_assert (collections != NULL);
|
||||
g_list_free_full (collections, g_object_unref);
|
||||
|
||||
@ -239,20 +239,20 @@ test_get_more_async (Test *test,
|
||||
static void
|
||||
test_new_sync (void)
|
||||
{
|
||||
GSecretService *service1;
|
||||
GSecretService *service2;
|
||||
SecretService *service1;
|
||||
SecretService *service2;
|
||||
GError *error = NULL;
|
||||
|
||||
/* Both these sohuld point to different things */
|
||||
|
||||
service1 = gsecret_service_new_sync (NULL, GSECRET_SERVICE_NONE, NULL, &error);
|
||||
service1 = secret_service_new_sync (NULL, SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
service2 = gsecret_service_new_sync (NULL, GSECRET_SERVICE_NONE, NULL, &error);
|
||||
service2 = secret_service_new_sync (NULL, SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (GSECRET_IS_SERVICE (service1));
|
||||
g_assert (GSECRET_IS_SERVICE (service2));
|
||||
g_assert (SECRET_IS_SERVICE (service1));
|
||||
g_assert (SECRET_IS_SERVICE (service2));
|
||||
g_assert (service1 != service2);
|
||||
|
||||
g_object_unref (service1);
|
||||
@ -265,29 +265,29 @@ test_new_sync (void)
|
||||
static void
|
||||
test_new_async (void)
|
||||
{
|
||||
GSecretService *service1;
|
||||
GSecretService *service2;
|
||||
SecretService *service1;
|
||||
SecretService *service2;
|
||||
GAsyncResult *result = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
/* Both these sohuld point to different things */
|
||||
|
||||
gsecret_service_new (NULL, GSECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
secret_service_new (NULL, SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
egg_test_wait ();
|
||||
service1 = gsecret_service_new_finish (result, &error);
|
||||
service1 = secret_service_new_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_clear_object (&result);
|
||||
|
||||
gsecret_service_new (NULL, GSECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
secret_service_new (NULL, SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
egg_test_wait ();
|
||||
service2 = gsecret_service_new_finish (result, &error);
|
||||
service2 = secret_service_new_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_clear_object (&result);
|
||||
|
||||
g_assert (GSECRET_IS_SERVICE (service1));
|
||||
g_assert (GSECRET_IS_SERVICE (service2));
|
||||
g_assert (SECRET_IS_SERVICE (service1));
|
||||
g_assert (SECRET_IS_SERVICE (service2));
|
||||
g_assert (service1 != service2);
|
||||
|
||||
g_object_unref (service1);
|
||||
@ -301,42 +301,42 @@ static void
|
||||
test_new_more_sync (Test *test,
|
||||
gconstpointer data)
|
||||
{
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
GList *collections;
|
||||
|
||||
service = gsecret_service_new_sync (NULL, GSECRET_SERVICE_NONE, NULL, &error);
|
||||
service = secret_service_new_sync (NULL, SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (GSECRET_IS_SERVICE (service));
|
||||
g_assert (SECRET_IS_SERVICE (service));
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_NONE);
|
||||
g_assert (gsecret_service_get_collections (service) == NULL);
|
||||
g_assert (gsecret_service_get_session_path (service) == NULL);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_NONE);
|
||||
g_assert (secret_service_get_collections (service) == NULL);
|
||||
g_assert (secret_service_get_session_path (service) == NULL);
|
||||
|
||||
g_object_unref (service);
|
||||
egg_assert_not_object (service);
|
||||
|
||||
service = gsecret_service_new_sync (NULL, GSECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
|
||||
service = secret_service_new_sync (NULL, SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (GSECRET_IS_SERVICE (service));
|
||||
g_assert (SECRET_IS_SERVICE (service));
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
collections = gsecret_service_get_collections (service);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
collections = secret_service_get_collections (service);
|
||||
g_assert (collections != NULL);
|
||||
g_list_free_full (collections, g_object_unref);
|
||||
g_assert (gsecret_service_get_session_path (service) == NULL);
|
||||
g_assert (secret_service_get_session_path (service) == NULL);
|
||||
|
||||
g_object_unref (service);
|
||||
egg_assert_not_object (service);
|
||||
|
||||
service = gsecret_service_new_sync (NULL, GSECRET_SERVICE_OPEN_SESSION, NULL, &error);
|
||||
service = secret_service_new_sync (NULL, SECRET_SERVICE_OPEN_SESSION, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (GSECRET_IS_SERVICE (service));
|
||||
g_assert (SECRET_IS_SERVICE (service));
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_OPEN_SESSION);
|
||||
g_assert (gsecret_service_get_collections (service) == NULL);
|
||||
path = gsecret_service_get_session_path (service);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION);
|
||||
g_assert (secret_service_get_collections (service) == NULL);
|
||||
path = secret_service_get_session_path (service);
|
||||
g_assert (path != NULL);
|
||||
|
||||
g_object_unref (service);
|
||||
@ -348,26 +348,26 @@ test_new_more_async (Test *test,
|
||||
gconstpointer data)
|
||||
{
|
||||
GAsyncResult *result = NULL;
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
GList *collections;
|
||||
|
||||
gsecret_service_new (NULL, GSECRET_SERVICE_LOAD_COLLECTIONS | GSECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result);
|
||||
secret_service_new (NULL, SECRET_SERVICE_LOAD_COLLECTIONS | SECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
service = gsecret_service_new_finish (result, &error);
|
||||
service = secret_service_new_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
result = NULL;
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_OPEN_SESSION | GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = gsecret_service_get_session_path (service);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = secret_service_get_session_path (service);
|
||||
g_assert (path != NULL);
|
||||
|
||||
collections = gsecret_service_get_collections (service);
|
||||
collections = secret_service_get_collections (service);
|
||||
g_assert (collections != NULL);
|
||||
g_list_free_full (collections, g_object_unref);
|
||||
|
||||
@ -376,20 +376,20 @@ test_new_more_async (Test *test,
|
||||
|
||||
/* Now get a session with just collections */
|
||||
|
||||
gsecret_service_new (NULL, GSECRET_SERVICE_LOAD_COLLECTIONS, NULL, on_complete_get_result, &result);
|
||||
secret_service_new (NULL, SECRET_SERVICE_LOAD_COLLECTIONS, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
service = gsecret_service_new_finish (result, &error);
|
||||
service = secret_service_new_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
g_assert_cmpuint (gsecret_service_get_flags (service), ==, GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = gsecret_service_get_session_path (service);
|
||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
path = secret_service_get_session_path (service);
|
||||
g_assert (path == NULL);
|
||||
|
||||
collections = gsecret_service_get_collections (service);
|
||||
collections = secret_service_get_collections (service);
|
||||
g_assert (collections != NULL);
|
||||
g_list_free_full (collections, g_object_unref);
|
||||
|
||||
@ -403,21 +403,21 @@ test_connect_async (Test *test,
|
||||
{
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
const gchar *path;
|
||||
|
||||
/* Passing false, not session */
|
||||
gsecret_service_get (GSECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
service = gsecret_service_get_finish (result, &error);
|
||||
g_assert (GSECRET_IS_SERVICE (service));
|
||||
service = secret_service_get_finish (result, &error);
|
||||
g_assert (SECRET_IS_SERVICE (service));
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
path = gsecret_service_get_session_path (service);
|
||||
path = secret_service_get_session_path (service);
|
||||
g_assert (path == NULL);
|
||||
|
||||
g_object_unref (service);
|
||||
@ -430,21 +430,21 @@ test_connect_ensure_async (Test *test,
|
||||
{
|
||||
GError *error = NULL;
|
||||
GAsyncResult *result = NULL;
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
const gchar *path;
|
||||
|
||||
/* Passing true, ensures session is established */
|
||||
gsecret_service_get (GSECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result);
|
||||
secret_service_get (SECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
service = gsecret_service_get_finish (result, &error);
|
||||
service = secret_service_get_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (GSECRET_IS_SERVICE (service));
|
||||
g_assert (SECRET_IS_SERVICE (service));
|
||||
g_object_unref (result);
|
||||
|
||||
path = gsecret_service_get_session_path (service);
|
||||
path = secret_service_get_session_path (service);
|
||||
g_assert (path != NULL);
|
||||
|
||||
g_object_unref (service);
|
||||
@ -456,32 +456,32 @@ test_ensure_sync (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GSecretService *service;
|
||||
GSecretServiceFlags flags;
|
||||
SecretService *service;
|
||||
SecretServiceFlags flags;
|
||||
const gchar *path;
|
||||
gboolean ret;
|
||||
|
||||
/* Passing true, ensures session is established */
|
||||
service = gsecret_service_new_sync (NULL, GSECRET_SERVICE_NONE, NULL, &error);
|
||||
service = secret_service_new_sync (NULL, SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (service != NULL);
|
||||
|
||||
flags = gsecret_service_get_flags (service);
|
||||
g_assert_cmpuint (flags, ==, GSECRET_SERVICE_NONE);
|
||||
flags = secret_service_get_flags (service);
|
||||
g_assert_cmpuint (flags, ==, SECRET_SERVICE_NONE);
|
||||
|
||||
ret = gsecret_service_ensure_collections_sync (service, NULL, &error);
|
||||
ret = secret_service_ensure_collections_sync (service, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
|
||||
g_object_get (service, "flags", &flags, NULL);
|
||||
g_assert_cmpuint (flags, ==, GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
g_assert_cmpuint (flags, ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
|
||||
path = gsecret_service_ensure_session_sync (service, NULL, &error);
|
||||
path = secret_service_ensure_session_sync (service, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (path != NULL);
|
||||
|
||||
flags = gsecret_service_get_flags (service);
|
||||
g_assert_cmpuint (flags, ==, GSECRET_SERVICE_OPEN_SESSION | GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
flags = secret_service_get_flags (service);
|
||||
g_assert_cmpuint (flags, ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
|
||||
g_object_unref (service);
|
||||
egg_assert_not_object (service);
|
||||
@ -492,47 +492,47 @@ test_ensure_async (Test *test,
|
||||
gconstpointer used)
|
||||
{
|
||||
GAsyncResult *result = NULL;
|
||||
GSecretServiceFlags flags;
|
||||
GSecretService *service;
|
||||
SecretServiceFlags flags;
|
||||
SecretService *service;
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
gboolean ret;
|
||||
|
||||
/* Passing true, ensures session is established */
|
||||
service = gsecret_service_new_sync (NULL, GSECRET_SERVICE_NONE, NULL, &error);
|
||||
service = secret_service_new_sync (NULL, SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (service != NULL);
|
||||
|
||||
flags = gsecret_service_get_flags (service);
|
||||
g_assert_cmpuint (flags, ==, GSECRET_SERVICE_NONE);
|
||||
flags = secret_service_get_flags (service);
|
||||
g_assert_cmpuint (flags, ==, SECRET_SERVICE_NONE);
|
||||
|
||||
gsecret_service_ensure_collections (service, NULL, on_complete_get_result, &result);
|
||||
secret_service_ensure_collections (service, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
ret = gsecret_service_ensure_collections_finish (service, result, &error);
|
||||
ret = secret_service_ensure_collections_finish (service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret == TRUE);
|
||||
g_object_unref (result);
|
||||
result = NULL;
|
||||
|
||||
g_object_get (service, "flags", &flags, NULL);
|
||||
g_assert_cmpuint (flags, ==, GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
g_assert_cmpuint (flags, ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
|
||||
gsecret_service_ensure_session (service, NULL, on_complete_get_result, &result);
|
||||
secret_service_ensure_session (service, NULL, on_complete_get_result, &result);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
path = gsecret_service_ensure_session_finish (service, result, &error);
|
||||
path = secret_service_ensure_session_finish (service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (path != NULL);
|
||||
g_object_unref (result);
|
||||
result = NULL;
|
||||
|
||||
flags = gsecret_service_get_flags (service);
|
||||
g_assert_cmpuint (flags, ==, GSECRET_SERVICE_OPEN_SESSION | GSECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
flags = secret_service_get_flags (service);
|
||||
g_assert_cmpuint (flags, ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||
|
||||
g_object_unref (service);
|
||||
egg_assert_not_object (service);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2011 Collabora Ltd.
|
||||
*
|
||||
@ -13,9 +13,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-item.h"
|
||||
#include "gsecret-service.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "secret-item.h"
|
||||
#include "secret-service.h"
|
||||
#include "secret-private.h"
|
||||
|
||||
#include "mock-service.h"
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
GSecretService *service;
|
||||
SecretService *service;
|
||||
} Test;
|
||||
|
||||
static void
|
||||
@ -40,7 +40,7 @@ setup (Test *test,
|
||||
mock_service_start (mock_script, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
test->service = gsecret_service_get_sync (GSECRET_SERVICE_NONE, NULL, &error);
|
||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
@ -61,14 +61,14 @@ test_ensure (Test *test,
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, NULL);
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, NULL);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, NULL);
|
||||
|
||||
path = gsecret_service_ensure_session_sync (test->service, NULL, &error);
|
||||
path = secret_service_ensure_session_sync (test->service, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (path != NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -78,20 +78,20 @@ test_ensure_twice (Test *test,
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, NULL);
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, NULL);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, NULL);
|
||||
|
||||
path = gsecret_service_ensure_session_sync (test->service, NULL, &error);
|
||||
path = secret_service_ensure_session_sync (test->service, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (path != NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
||||
|
||||
path = gsecret_service_ensure_session_sync (test->service, NULL, &error);
|
||||
path = secret_service_ensure_session_sync (test->service, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (path != NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -101,15 +101,15 @@ test_ensure_plain (Test *test,
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, NULL);
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, NULL);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, NULL);
|
||||
|
||||
path = gsecret_service_ensure_session_sync (test->service, NULL, &error);
|
||||
path = secret_service_ensure_session_sync (test->service, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (path != NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, "plain");
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -132,16 +132,16 @@ test_ensure_async_plain (Test *test,
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
|
||||
gsecret_service_ensure_session (test->service, NULL, on_complete_get_result, &result);
|
||||
secret_service_ensure_session (test->service, NULL, on_complete_get_result, &result);
|
||||
egg_test_wait ();
|
||||
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
path = gsecret_service_ensure_session_finish (test->service, result, &error);
|
||||
path = secret_service_ensure_session_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (path != NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, "plain");
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain");
|
||||
|
||||
g_object_unref (result);
|
||||
}
|
||||
@ -154,16 +154,16 @@ test_ensure_async_aes (Test *test,
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
|
||||
gsecret_service_ensure_session (test->service, NULL, on_complete_get_result, &result);
|
||||
secret_service_ensure_session (test->service, NULL, on_complete_get_result, &result);
|
||||
egg_test_wait_until (500);
|
||||
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
path = gsecret_service_ensure_session_finish (test->service, result, &error);
|
||||
path = secret_service_ensure_session_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (path != NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7");
|
||||
|
||||
g_object_unref (result);
|
||||
}
|
||||
@ -176,30 +176,30 @@ test_ensure_async_twice (Test *test,
|
||||
GError *error = NULL;
|
||||
const gchar *path;
|
||||
|
||||
gsecret_service_ensure_session (test->service, NULL, on_complete_get_result, &result);
|
||||
secret_service_ensure_session (test->service, NULL, on_complete_get_result, &result);
|
||||
egg_test_wait_until (500);
|
||||
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
path = gsecret_service_ensure_session_finish (test->service, result, &error);
|
||||
path = secret_service_ensure_session_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (path != NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, "plain");
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain");
|
||||
|
||||
g_object_unref (result);
|
||||
result = NULL;
|
||||
|
||||
gsecret_service_ensure_session (test->service, NULL, on_complete_get_result, &result);
|
||||
secret_service_ensure_session (test->service, NULL, on_complete_get_result, &result);
|
||||
egg_test_wait_until (500);
|
||||
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
path = gsecret_service_ensure_session_finish (test->service, result, &error);
|
||||
path = secret_service_ensure_session_finish (test->service, result, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (path != NULL);
|
||||
g_assert_cmpstr (gsecret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (gsecret_service_get_session_algorithms (test->service), ==, "plain");
|
||||
g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path);
|
||||
g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain");
|
||||
|
||||
g_object_unref (result);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* GSecret - GLib wrapper for Secret Service
|
||||
/* libsecret - GLib wrapper for Secret Service
|
||||
*
|
||||
* Copyright 2012 Red Hat Inc.
|
||||
*
|
||||
@ -13,8 +13,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsecret-value.h"
|
||||
#include "gsecret-private.h"
|
||||
#include "secret-value.h"
|
||||
#include "secret-private.h"
|
||||
|
||||
#include "egg/egg-testing.h"
|
||||
#include "egg/egg-secure-memory.h"
|
||||
@ -29,115 +29,115 @@ EGG_SECURE_DECLARE (test_value);
|
||||
static void
|
||||
test_new (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gsize length;
|
||||
|
||||
value = gsecret_value_new ("blahblah", 4, "text/plain");
|
||||
value = secret_value_new ("blahblah", 4, "text/plain");
|
||||
|
||||
g_assert_cmpstr (gsecret_value_get (value, &length), ==, "blah");
|
||||
g_assert_cmpstr (secret_value_get (value, &length), ==, "blah");
|
||||
g_assert_cmpuint (length, ==, 4);
|
||||
|
||||
g_assert_cmpstr (gsecret_value_get_content_type (value), ==, "text/plain");
|
||||
g_assert_cmpstr (secret_value_get_content_type (value), ==, "text/plain");
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
}
|
||||
|
||||
static void
|
||||
test_new_terminated (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gsize length;
|
||||
|
||||
value = gsecret_value_new ("blah", -1, "text/plain");
|
||||
value = secret_value_new ("blah", -1, "text/plain");
|
||||
|
||||
g_assert_cmpstr (gsecret_value_get (value, &length), ==, "blah");
|
||||
g_assert_cmpstr (secret_value_get (value, &length), ==, "blah");
|
||||
g_assert_cmpuint (length, ==, 4);
|
||||
|
||||
g_assert_cmpstr (gsecret_value_get_content_type (value), ==, "text/plain");
|
||||
g_assert_cmpstr (secret_value_get_content_type (value), ==, "text/plain");
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
}
|
||||
|
||||
static void
|
||||
test_new_full (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gchar *data = g_strdup ("blah");
|
||||
gsize length;
|
||||
|
||||
value = gsecret_value_new_full (data, 4, "text/plain", g_free);
|
||||
value = secret_value_new_full (data, 4, "text/plain", g_free);
|
||||
|
||||
g_assert_cmpstr (gsecret_value_get (value, &length), ==, "blah");
|
||||
g_assert_cmpstr (secret_value_get (value, &length), ==, "blah");
|
||||
g_assert_cmpuint (length, ==, 4);
|
||||
|
||||
/* No copy done here */
|
||||
g_assert (gsecret_value_get (value, NULL) == data);
|
||||
g_assert (secret_value_get (value, NULL) == data);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
}
|
||||
|
||||
static void
|
||||
test_new_full_terminated (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gchar *data = g_strdup ("blah");
|
||||
gsize length;
|
||||
|
||||
value = gsecret_value_new_full (data, -1, "text/plain", g_free);
|
||||
value = secret_value_new_full (data, -1, "text/plain", g_free);
|
||||
|
||||
g_assert_cmpstr (gsecret_value_get (value, &length), ==, "blah");
|
||||
g_assert_cmpstr (secret_value_get (value, &length), ==, "blah");
|
||||
g_assert_cmpuint (length, ==, 4);
|
||||
|
||||
/* No copy done here */
|
||||
g_assert (gsecret_value_get (value, NULL) == data);
|
||||
g_assert (secret_value_get (value, NULL) == data);
|
||||
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ref_unref (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
GSecretValue *value2;
|
||||
SecretValue *value;
|
||||
SecretValue *value2;
|
||||
gsize length;
|
||||
|
||||
value = gsecret_value_new ("blah", 4, "text/plain");
|
||||
value2 = gsecret_value_ref(value);
|
||||
gsecret_value_unref (value);
|
||||
value = secret_value_new ("blah", 4, "text/plain");
|
||||
value2 = secret_value_ref(value);
|
||||
secret_value_unref (value);
|
||||
|
||||
g_assert_cmpstr (gsecret_value_get (value2, &length), ==, "blah");
|
||||
g_assert_cmpstr (secret_value_get (value2, &length), ==, "blah");
|
||||
g_assert_cmpuint (length, ==, 4);
|
||||
|
||||
gsecret_value_unref (value2);
|
||||
secret_value_unref (value2);
|
||||
}
|
||||
|
||||
static void
|
||||
test_boxed (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
GSecretValue *value2;
|
||||
SecretValue *value;
|
||||
SecretValue *value2;
|
||||
gsize length;
|
||||
|
||||
value = gsecret_value_new ("blah", 4, "text/plain");
|
||||
value2 = g_boxed_copy (GSECRET_TYPE_VALUE, value);
|
||||
g_boxed_free (GSECRET_TYPE_VALUE, value);
|
||||
value = secret_value_new ("blah", 4, "text/plain");
|
||||
value2 = g_boxed_copy (SECRET_TYPE_VALUE, value);
|
||||
g_boxed_free (SECRET_TYPE_VALUE, value);
|
||||
|
||||
g_assert_cmpstr (gsecret_value_get (value2, &length), ==, "blah");
|
||||
g_assert_cmpstr (secret_value_get (value2, &length), ==, "blah");
|
||||
g_assert_cmpuint (length, ==, 4);
|
||||
|
||||
g_boxed_free (GSECRET_TYPE_VALUE, value2);
|
||||
g_boxed_free (SECRET_TYPE_VALUE, value2);
|
||||
}
|
||||
|
||||
static void
|
||||
test_to_password (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gchar *password;
|
||||
|
||||
value = gsecret_value_new_full (egg_secure_strdup ("blah"), -1,
|
||||
value = secret_value_new_full (egg_secure_strdup ("blah"), -1,
|
||||
"text/plain", egg_secure_free);
|
||||
|
||||
password = _gsecret_value_unref_to_password (value);
|
||||
password = _secret_value_unref_to_password (value);
|
||||
g_assert_cmpstr (password, ==, "blah");
|
||||
|
||||
egg_secure_free (password);
|
||||
@ -146,13 +146,13 @@ test_to_password (void)
|
||||
static void
|
||||
test_to_password_bad_destroy (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gchar *password;
|
||||
|
||||
value = gsecret_value_new_full (g_strdup ("blah"), -1,
|
||||
value = secret_value_new_full (g_strdup ("blah"), -1,
|
||||
"text/plain", g_free);
|
||||
|
||||
password = _gsecret_value_unref_to_password (value);
|
||||
password = _secret_value_unref_to_password (value);
|
||||
g_assert_cmpstr (password, ==, "blah");
|
||||
|
||||
egg_secure_free (password);
|
||||
@ -161,31 +161,31 @@ test_to_password_bad_destroy (void)
|
||||
static void
|
||||
test_to_password_bad_content (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gchar *password;
|
||||
|
||||
value = gsecret_value_new_full (g_strdup ("wooowhee"), -1,
|
||||
value = secret_value_new_full (g_strdup ("wooowhee"), -1,
|
||||
"application/octet-stream", g_free);
|
||||
|
||||
password = _gsecret_value_unref_to_password (value);
|
||||
password = _secret_value_unref_to_password (value);
|
||||
g_assert_cmpstr (password, ==, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_to_password_extra_ref (void)
|
||||
{
|
||||
GSecretValue *value;
|
||||
SecretValue *value;
|
||||
gchar *password;
|
||||
|
||||
value = gsecret_value_new_full (egg_secure_strdup ("blah"), -1,
|
||||
value = secret_value_new_full (egg_secure_strdup ("blah"), -1,
|
||||
"text/plain", egg_secure_free);
|
||||
gsecret_value_ref (value);
|
||||
secret_value_ref (value);
|
||||
|
||||
password = _gsecret_value_unref_to_password (value);
|
||||
password = _secret_value_unref_to_password (value);
|
||||
g_assert_cmpstr (password, ==, "blah");
|
||||
|
||||
egg_secure_free (password);
|
||||
gsecret_value_unref (value);
|
||||
secret_value_unref (value);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1,2 +1,2 @@
|
||||
library/gsecret-item.c
|
||||
library/gsecret-session.c
|
||||
library/secret-item.c
|
||||
library/secret-session.c
|
||||
|
Loading…
Reference in New Issue
Block a user