diff --git a/.gitignore b/.gitignore index 27ba13e..94adb16 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/ChangeLog b/ChangeLog index 34fa05b..9cdd7c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 === diff --git a/autogen.sh b/autogen.sh index 3773941..b862795 100755 --- a/autogen.sh +++ b/autogen.sh @@ -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 diff --git a/configure.ac b/configure.ac index b20e5f5..0c586c3 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/library/Makefile.am b/library/Makefile.am index 2d8c783..086a3da 100644 --- a/library/Makefile.am +++ b/library/Makefile.am @@ -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 \ No newline at end of file diff --git a/library/gsecret-collection.c b/library/secret-collection.c similarity index 72% rename from library/gsecret-collection.c rename to library/secret-collection.c index 54d789e..4033917 100644 --- a/library/gsecret-collection.c +++ b/library/secret-collection.c @@ -1,4 +1,4 @@ -/* GSecret - GLib wrapper for Secret Service +/* libsecret - GLib wrapper for Secret Service * * Copyright 2012 Red Hat Inc. * @@ -12,21 +12,21 @@ #include "config.h" -#include "gsecret-collection.h" -#include "gsecret-dbus-generated.h" -#include "gsecret-item.h" -#include "gsecret-private.h" -#include "gsecret-service.h" -#include "gsecret-types.h" +#include "secret-collection.h" +#include "secret-dbus-generated.h" +#include "secret-item.h" +#include "secret-private.h" +#include "secret-service.h" +#include "secret-types.h" #include /** - * SECTION:gsecret-collection + * SECTION:secret-collection */ /** - * GSecretCollection: + * SecretCollection: */ enum { @@ -39,9 +39,9 @@ enum { PROP_MODIFIED }; -struct _GSecretCollectionPrivate { +struct _SecretCollectionPrivate { /* Doesn't change between construct and finalize */ - GSecretService *service; + SecretService *service; GCancellable *cancellable; gboolean constructing; @@ -50,17 +50,17 @@ struct _GSecretCollectionPrivate { GHashTable *items; }; -static GInitableIface *gsecret_collection_initable_parent_iface = NULL; +static GInitableIface *secret_collection_initable_parent_iface = NULL; -static GAsyncInitableIface *gsecret_collection_async_initable_parent_iface = NULL; +static GAsyncInitableIface *secret_collection_async_initable_parent_iface = NULL; -static void gsecret_collection_initable_iface (GInitableIface *iface); +static void secret_collection_initable_iface (GInitableIface *iface); -static void gsecret_collection_async_initable_iface (GAsyncInitableIface *iface); +static void secret_collection_async_initable_iface (GAsyncInitableIface *iface); -G_DEFINE_TYPE_WITH_CODE (GSecretCollection, gsecret_collection, G_TYPE_DBUS_PROXY, - G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gsecret_collection_initable_iface); - G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, gsecret_collection_async_initable_iface); +G_DEFINE_TYPE_WITH_CODE (SecretCollection, secret_collection, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, secret_collection_initable_iface); + G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, secret_collection_async_initable_iface); ); static GHashTable * @@ -71,10 +71,10 @@ items_table_new (void) } static void -gsecret_collection_init (GSecretCollection *self) +secret_collection_init (SecretCollection *self) { - self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GSECRET_TYPE_COLLECTION, - GSecretCollectionPrivate); + self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SECRET_TYPE_COLLECTION, + SecretCollectionPrivate); g_mutex_init (&self->pv->mutex); self->pv->cancellable = g_cancellable_new (); @@ -87,12 +87,12 @@ on_set_label (GObject *source, GAsyncResult *result, gpointer user_data) { - GSecretCollection *self = GSECRET_COLLECTION (user_data); + SecretCollection *self = SECRET_COLLECTION (user_data); GError *error = NULL; - gsecret_collection_set_label_finish (self, result, &error); + secret_collection_set_label_finish (self, result, &error); if (error != NULL) { - g_warning ("couldn't set GSecretCollection Label: %s", error->message); + g_warning ("couldn't set SecretCollection Label: %s", error->message); g_error_free (error); } @@ -100,12 +100,12 @@ on_set_label (GObject *source, } static void -gsecret_collection_set_property (GObject *obj, +secret_collection_set_property (GObject *obj, guint prop_id, const GValue *value, GParamSpec *pspec) { - GSecretCollection *self = GSECRET_COLLECTION (obj); + SecretCollection *self = SECRET_COLLECTION (obj); switch (prop_id) { case PROP_SERVICE: @@ -116,7 +116,7 @@ gsecret_collection_set_property (GObject *obj, (gpointer *)&self->pv->service); break; case PROP_LABEL: - gsecret_collection_set_label (self, g_value_get_string (value), + secret_collection_set_label (self, g_value_get_string (value), self->pv->cancellable, on_set_label, g_object_ref (self)); break; @@ -127,31 +127,31 @@ gsecret_collection_set_property (GObject *obj, } static void -gsecret_collection_get_property (GObject *obj, +secret_collection_get_property (GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) { - GSecretCollection *self = GSECRET_COLLECTION (obj); + SecretCollection *self = SECRET_COLLECTION (obj); switch (prop_id) { case PROP_SERVICE: g_value_set_object (value, self->pv->service); break; case PROP_ITEMS: - g_value_take_boxed (value, gsecret_collection_get_items (self)); + g_value_take_boxed (value, secret_collection_get_items (self)); break; case PROP_LABEL: - g_value_take_string (value, gsecret_collection_get_label (self)); + g_value_take_string (value, secret_collection_get_label (self)); break; case PROP_LOCKED: - g_value_set_boolean (value, gsecret_collection_get_locked (self)); + g_value_set_boolean (value, secret_collection_get_locked (self)); break; case PROP_CREATED: - g_value_set_uint64 (value, gsecret_collection_get_created (self)); + g_value_set_uint64 (value, secret_collection_get_created (self)); break; case PROP_MODIFIED: - g_value_set_uint64 (value, gsecret_collection_get_modified (self)); + g_value_set_uint64 (value, secret_collection_get_modified (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); @@ -160,19 +160,19 @@ gsecret_collection_get_property (GObject *obj, } static void -gsecret_collection_dispose (GObject *obj) +secret_collection_dispose (GObject *obj) { - GSecretCollection *self = GSECRET_COLLECTION (obj); + SecretCollection *self = SECRET_COLLECTION (obj); g_cancellable_cancel (self->pv->cancellable); - G_OBJECT_CLASS (gsecret_collection_parent_class)->dispose (obj); + G_OBJECT_CLASS (secret_collection_parent_class)->dispose (obj); } static void -gsecret_collection_finalize (GObject *obj) +secret_collection_finalize (GObject *obj) { - GSecretCollection *self = GSECRET_COLLECTION (obj); + SecretCollection *self = SECRET_COLLECTION (obj); if (self->pv->service) g_object_remove_weak_pointer (G_OBJECT (self->pv->service), @@ -182,14 +182,14 @@ gsecret_collection_finalize (GObject *obj) g_hash_table_destroy (self->pv->items); g_object_unref (self->pv->cancellable); - G_OBJECT_CLASS (gsecret_collection_parent_class)->finalize (obj); + G_OBJECT_CLASS (secret_collection_parent_class)->finalize (obj); } -static GSecretItem * -collection_lookup_item (GSecretCollection *self, +static SecretItem * +collection_lookup_item (SecretCollection *self, const gchar *path) { - GSecretItem *item = NULL; + SecretItem *item = NULL; g_mutex_lock (&self->pv->mutex); @@ -203,7 +203,7 @@ collection_lookup_item (GSecretCollection *self, } static void -collection_update_items (GSecretCollection *self, +collection_update_items (SecretCollection *self, GHashTable *items) { GHashTable *previous; @@ -240,14 +240,14 @@ on_load_item (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); ItemsClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretCollection *self = GSECRET_COLLECTION (g_async_result_get_source_object (user_data)); + SecretCollection *self = SECRET_COLLECTION (g_async_result_get_source_object (user_data)); const gchar *path; GError *error = NULL; - GSecretItem *item; + SecretItem *item; closure->items_loading--; - item = gsecret_item_new_finish (result, &error); + item = secret_item_new_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -267,13 +267,13 @@ on_load_item (GObject *source, } static void -collection_load_items_async (GSecretCollection *self, +collection_load_items_async (SecretCollection *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { ItemsClosure *closure; - GSecretItem *item; + SecretItem *item; GSimpleAsyncResult *res; const gchar *path; GVariant *paths; @@ -295,7 +295,7 @@ collection_load_items_async (GSecretCollection *self, /* No such collection yet create a new one */ if (item == NULL) { - gsecret_item_new (self->pv->service, path, cancellable, + secret_item_new (self->pv->service, path, cancellable, on_load_item, g_object_ref (res)); closure->items_loading++; @@ -314,7 +314,7 @@ collection_load_items_async (GSecretCollection *self, } static gboolean -collection_load_items_finish (GSecretCollection *self, +collection_load_items_finish (SecretCollection *self, GAsyncResult *result, GError **error) { @@ -326,11 +326,11 @@ collection_load_items_finish (GSecretCollection *self, static gboolean -collection_load_items_sync (GSecretCollection *self, +collection_load_items_sync (SecretCollection *self, GCancellable *cancellable, GError **error) { - GSecretItem *item; + SecretItem *item; GHashTable *items; GVariant *paths; GVariantIter iter; @@ -348,7 +348,7 @@ collection_load_items_sync (GSecretCollection *self, /* No such collection yet create a new one */ if (item == NULL) { - item = gsecret_item_new_sync (self->pv->service, path, + item = secret_item_new_sync (self->pv->service, path, cancellable, error); if (item == NULL) { ret = FALSE; @@ -368,7 +368,7 @@ collection_load_items_sync (GSecretCollection *self, } static void -handle_property_changed (GSecretCollection *self, +handle_property_changed (SecretCollection *self, const gchar *property_name, GVariant *value) { @@ -389,11 +389,11 @@ handle_property_changed (GSecretCollection *self, } static void -gsecret_collection_properties_changed (GDBusProxy *proxy, +secret_collection_properties_changed (GDBusProxy *proxy, GVariant *changed_properties, const gchar* const *invalidated_properties) { - GSecretCollection *self = GSECRET_COLLECTION (proxy); + SecretCollection *self = SECRET_COLLECTION (proxy); gchar *property_name; GVariantIter iter; GVariant *value; @@ -408,25 +408,25 @@ gsecret_collection_properties_changed (GDBusProxy *proxy, } static void -gsecret_collection_class_init (GSecretCollectionClass *klass) +secret_collection_class_init (SecretCollectionClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDBusProxyClass *proxy_class = G_DBUS_PROXY_CLASS (klass); - gobject_class->get_property = gsecret_collection_get_property; - gobject_class->set_property = gsecret_collection_set_property; - gobject_class->dispose = gsecret_collection_dispose; - gobject_class->finalize = gsecret_collection_finalize; + gobject_class->get_property = secret_collection_get_property; + gobject_class->set_property = secret_collection_set_property; + gobject_class->dispose = secret_collection_dispose; + gobject_class->finalize = secret_collection_finalize; - proxy_class->g_properties_changed = gsecret_collection_properties_changed; + proxy_class->g_properties_changed = secret_collection_properties_changed; g_object_class_install_property (gobject_class, PROP_SERVICE, g_param_spec_object ("service", "Service", "Secret Service", - GSECRET_TYPE_SERVICE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + SECRET_TYPE_SERVICE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ITEMS, g_param_spec_boxed ("items", "Items", "Items in collection", - _gsecret_list_get_type (), G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + _secret_list_get_type (), G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_LABEL, g_param_spec_string ("label", "Label", "Item label", @@ -444,30 +444,30 @@ gsecret_collection_class_init (GSecretCollectionClass *klass) g_param_spec_uint64 ("modified", "Modified", "Item modified date", 0UL, G_MAXUINT64, 0UL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_type_class_add_private (gobject_class, sizeof (GSecretCollectionPrivate)); + g_type_class_add_private (gobject_class, sizeof (SecretCollectionPrivate)); } static gboolean -gsecret_collection_initable_init (GInitable *initable, +secret_collection_initable_init (GInitable *initable, GCancellable *cancellable, GError **error) { - GSecretCollection *self; + SecretCollection *self; GDBusProxy *proxy; - if (!gsecret_collection_initable_parent_iface->init (initable, cancellable, error)) + if (!secret_collection_initable_parent_iface->init (initable, cancellable, error)) return FALSE; proxy = G_DBUS_PROXY (initable); - if (!_gsecret_util_have_cached_properties (proxy)) { + if (!_secret_util_have_cached_properties (proxy)) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "No such secret collection at path: %s", g_dbus_proxy_get_object_path (proxy)); return FALSE; } - self = GSECRET_COLLECTION (initable); + self = SECRET_COLLECTION (initable); if (!collection_load_items_sync (self, cancellable, error)) return FALSE; @@ -476,11 +476,11 @@ gsecret_collection_initable_init (GInitable *initable, } static void -gsecret_collection_initable_iface (GInitableIface *iface) +secret_collection_initable_iface (GInitableIface *iface) { - gsecret_collection_initable_parent_iface = g_type_interface_peek_parent (iface); + secret_collection_initable_parent_iface = g_type_interface_peek_parent (iface); - iface->init = gsecret_collection_initable_init; + iface->init = secret_collection_initable_init; } typedef struct { @@ -501,7 +501,7 @@ on_init_items (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretCollection *self = GSECRET_COLLECTION (source); + SecretCollection *self = SECRET_COLLECTION (source); GError *error = NULL; if (!collection_load_items_finish (self, result, &error)) @@ -517,17 +517,17 @@ on_init_base (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretCollection *self = GSECRET_COLLECTION (source); + SecretCollection *self = SECRET_COLLECTION (source); InitClosure *closure = g_simple_async_result_get_op_res_gpointer (res); GDBusProxy *proxy = G_DBUS_PROXY (self); GError *error = NULL; - if (!gsecret_collection_async_initable_parent_iface->init_finish (G_ASYNC_INITABLE (self), + if (!secret_collection_async_initable_parent_iface->init_finish (G_ASYNC_INITABLE (self), result, &error)) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); - } else if (!_gsecret_util_have_cached_properties (proxy)) { + } else if (!_secret_util_have_cached_properties (proxy)) { g_simple_async_result_set_error (res, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "No such secret collection at path: %s", g_dbus_proxy_get_object_path (proxy)); @@ -542,7 +542,7 @@ on_init_base (GObject *source, } static void -gsecret_collection_async_initable_init_async (GAsyncInitable *initable, +secret_collection_async_initable_init_async (GAsyncInitable *initable, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -552,12 +552,12 @@ gsecret_collection_async_initable_init_async (GAsyncInitable *initable, InitClosure *closure; res = g_simple_async_result_new (G_OBJECT (initable), callback, user_data, - gsecret_collection_async_initable_init_async); + secret_collection_async_initable_init_async); closure = g_slice_new0 (InitClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; g_simple_async_result_set_op_res_gpointer (res, closure, init_closure_free); - gsecret_collection_async_initable_parent_iface->init_async (initable, io_priority, + secret_collection_async_initable_parent_iface->init_async (initable, io_priority, cancellable, on_init_base, g_object_ref (res)); @@ -566,12 +566,12 @@ gsecret_collection_async_initable_init_async (GAsyncInitable *initable, } static gboolean -gsecret_collection_async_initable_init_finish (GAsyncInitable *initable, +secret_collection_async_initable_init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) { g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (initable), - gsecret_collection_async_initable_init_async), FALSE); + secret_collection_async_initable_init_async), FALSE); if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error)) return FALSE; @@ -580,16 +580,16 @@ gsecret_collection_async_initable_init_finish (GAsyncInitable *initable, } static void -gsecret_collection_async_initable_iface (GAsyncInitableIface *iface) +secret_collection_async_initable_iface (GAsyncInitableIface *iface) { - gsecret_collection_async_initable_parent_iface = g_type_interface_peek_parent (iface); + secret_collection_async_initable_parent_iface = g_type_interface_peek_parent (iface); - iface->init_async = gsecret_collection_async_initable_init_async; - iface->init_finish = gsecret_collection_async_initable_init_finish; + iface->init_async = secret_collection_async_initable_init_async; + iface->init_finish = secret_collection_async_initable_init_finish; } /** - * gsecret_collection_new: + * secret_collection_new: * @service: a secret service object * @collection_path: the dbus path of the collection * @cancellable: optional cancellation object @@ -604,7 +604,7 @@ gsecret_collection_async_initable_iface (GAsyncInitableIface *iface) * with g_object_unref() */ void -gsecret_collection_new (GSecretService *service, +secret_collection_new (SecretService *service, const gchar *collection_path, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -612,26 +612,26 @@ gsecret_collection_new (GSecretService *service, { GDBusProxy *proxy; - g_return_if_fail (GSECRET_IS_SERVICE (service)); + g_return_if_fail (SECRET_IS_SERVICE (service)); g_return_if_fail (collection_path != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); proxy = G_DBUS_PROXY (service); - g_async_initable_new_async (GSECRET_SERVICE_GET_CLASS (service)->collection_gtype, + g_async_initable_new_async (SECRET_SERVICE_GET_CLASS (service)->collection_gtype, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", G_DBUS_CALL_FLAGS_NONE, - "g-interface-info", _gsecret_gen_collection_interface_info (), + "g-interface-info", _secret_gen_collection_interface_info (), "g-name", g_dbus_proxy_get_name (proxy), "g-connection", g_dbus_proxy_get_connection (proxy), "g-object-path", collection_path, - "g-interface-name", GSECRET_COLLECTION_INTERFACE, + "g-interface-name", SECRET_COLLECTION_INTERFACE, "service", service, NULL); } /** - * gsecret_collection_new_finish: + * secret_collection_new_finish: * @result: the asynchronous result passed to the callback * @error: location to place an error on failure * @@ -642,8 +642,8 @@ gsecret_collection_new (GSecretService *service, * with g_object_unref() */ -GSecretCollection * -gsecret_collection_new_finish (GAsyncResult *result, +SecretCollection * +secret_collection_new_finish (GAsyncResult *result, GError **error) { GObject *source_object; @@ -660,11 +660,11 @@ gsecret_collection_new_finish (GAsyncResult *result, if (object == NULL) return NULL; - return GSECRET_COLLECTION (object); + return SECRET_COLLECTION (object); } /** - * gsecret_collection_new_sync: + * secret_collection_new_sync: * @service: a secret service object * @collection_path: the dbus path of the collection * @cancellable: optional cancellation object @@ -677,46 +677,46 @@ gsecret_collection_new_finish (GAsyncResult *result, * Returns: (transfer full): the new collection, which should be unreferenced * with g_object_unref() */ -GSecretCollection * -gsecret_collection_new_sync (GSecretService *service, +SecretCollection * +secret_collection_new_sync (SecretService *service, const gchar *collection_path, GCancellable *cancellable, GError **error) { GDBusProxy *proxy; - 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 (collection_path != NULL, NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); proxy = G_DBUS_PROXY (service); - return g_initable_new (GSECRET_SERVICE_GET_CLASS (service)->collection_gtype, + return g_initable_new (SECRET_SERVICE_GET_CLASS (service)->collection_gtype, cancellable, error, "g-flags", G_DBUS_CALL_FLAGS_NONE, - "g-interface-info", _gsecret_gen_collection_interface_info (), + "g-interface-info", _secret_gen_collection_interface_info (), "g-name", g_dbus_proxy_get_name (proxy), "g-connection", g_dbus_proxy_get_connection (proxy), "g-object-path", collection_path, - "g-interface-name", GSECRET_COLLECTION_INTERFACE, + "g-interface-name", SECRET_COLLECTION_INTERFACE, "service", service, NULL); } void -gsecret_collection_refresh (GSecretCollection *self) +secret_collection_refresh (SecretCollection *self) { - g_return_if_fail (GSECRET_IS_COLLECTION (self)); + g_return_if_fail (SECRET_IS_COLLECTION (self)); - _gsecret_util_get_properties (G_DBUS_PROXY (self), - gsecret_collection_refresh, + _secret_util_get_properties (G_DBUS_PROXY (self), + secret_collection_refresh, self->pv->cancellable, NULL, NULL); } typedef struct { GCancellable *cancellable; - GSecretCollection *collection; + SecretCollection *collection; } CreateClosure; static void @@ -737,7 +737,7 @@ on_create_collection (GObject *source, CreateClosure *closure = g_simple_async_result_get_op_res_gpointer (res); GError *error = NULL; - closure->collection = gsecret_collection_new_finish (result, &error); + closure->collection = secret_collection_new_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -752,13 +752,13 @@ on_create_path (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); CreateClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *service = GSECRET_SERVICE (source); + SecretService *service = SECRET_SERVICE (source); GError *error = NULL; gchar *path; - path = gsecret_service_create_collection_path_finish (service, result, &error); + path = secret_service_create_collection_path_finish (service, result, &error); if (error == NULL) { - gsecret_collection_new (service, path, closure->cancellable, + secret_collection_new (service, path, closure->cancellable, on_create_collection, g_object_ref (res)); } else { g_simple_async_result_take_error (res, error); @@ -778,14 +778,14 @@ collection_properties_new (const gchar *label) (GDestroyNotify)g_variant_unref); value = g_variant_new_string (label); g_hash_table_insert (properties, - GSECRET_COLLECTION_INTERFACE ".Label", + SECRET_COLLECTION_INTERFACE ".Label", g_variant_ref_sink (value)); return properties; } /** - * gsecret_collection_create: + * secret_collection_create: * @service: a secret service object * @label: label for the new collection * @alias: (allow-none): alias to assign to the collection @@ -796,11 +796,11 @@ collection_properties_new (const gchar *label) * Create a new collection in the secret service. * * This method returns immediately and completes asynchronously. The secret - * service may prompt the user. gsecret_service_prompt() will be used to handle + * service may prompt the user. secret_service_prompt() will be used to handle * any prompts that are required. */ void -gsecret_collection_create (GSecretService *service, +secret_collection_create (SecretService *service, const gchar *label, const gchar *alias, GCancellable *cancellable, @@ -811,19 +811,19 @@ gsecret_collection_create (GSecretService *service, CreateClosure *closure; GHashTable *properties; - g_return_if_fail (GSECRET_IS_SERVICE (service)); + g_return_if_fail (SECRET_IS_SERVICE (service)); g_return_if_fail (label != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (NULL, callback, user_data, - gsecret_collection_create); + secret_collection_create); closure = g_slice_new0 (CreateClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; g_simple_async_result_set_op_res_gpointer (res, closure, create_closure_free); properties = collection_properties_new (label); - gsecret_service_create_collection_path (service, properties, alias, cancellable, + secret_service_create_collection_path (service, properties, alias, cancellable, on_create_path, g_object_ref (res)); g_hash_table_unref (properties); @@ -831,7 +831,7 @@ gsecret_collection_create (GSecretService *service, } /** - * gsecret_collection_create_finish: + * secret_collection_create_finish: * @result: the asynchronous result passed to the callback * @error: location to place an error on failure * @@ -840,15 +840,15 @@ gsecret_collection_create (GSecretService *service, * Returns: (transfer full): the new collection, which should be unreferenced * with g_object_unref() */ -GSecretCollection * -gsecret_collection_create_finish (GAsyncResult *result, +SecretCollection * +secret_collection_create_finish (GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; CreateClosure *closure; g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL, - gsecret_collection_create), NULL); + secret_collection_create), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -864,7 +864,7 @@ gsecret_collection_create_finish (GAsyncResult *result, } /** - * gsecret_collection_create_sync: + * secret_collection_create_sync: * @service: a secret service object * @label: label for the new collection * @alias: (allow-none): alias to assign to the collection @@ -874,31 +874,31 @@ gsecret_collection_create_finish (GAsyncResult *result, * Create a new collection in the secret service. * * This method may block indefinitely. The secret service may prompt the - * user. gsecret_service_prompt() will be used to handle any prompts that + * user. secret_service_prompt() will be used to handle any prompts that * are required. * * Returns: (transfer full): the new collection, which should be unreferenced * with g_object_unref() */ -GSecretCollection * -gsecret_collection_create_sync (GSecretService *service, +SecretCollection * +secret_collection_create_sync (SecretService *service, const gchar *label, const gchar *alias, GCancellable *cancellable, GError **error) { - GSecretCollection *collection; + SecretCollection *collection; GHashTable *properties; gchar *path; - 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 (label != NULL, NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); properties = collection_properties_new (label); - path = gsecret_service_create_collection_path_sync (service, properties, alias, + path = secret_service_create_collection_path_sync (service, properties, alias, cancellable, error); g_hash_table_unref (properties); @@ -906,14 +906,14 @@ gsecret_collection_create_sync (GSecretService *service, if (path == NULL) return NULL; - collection = gsecret_collection_new_sync (service, path, cancellable, error); + collection = secret_collection_new_sync (service, path, cancellable, error); g_free (path); return collection; } /** - * gsecret_collection_delete: + * secret_collection_delete: * @self: a collection * @cancellable: optional cancellation object * @callback: called when the operation completes @@ -922,29 +922,29 @@ gsecret_collection_create_sync (GSecretService *service, * Delete this collection. * * This method returns immediately and completes asynchronously. The secret - * service may prompt the user. gsecret_service_prompt() will be used to handle + * service may prompt the user. secret_service_prompt() will be used to handle * any prompts that show up. * * Returns: whether the item was successfully deleted or not */ void -gsecret_collection_delete (GSecretCollection *self, +secret_collection_delete (SecretCollection *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { const gchar *object_path; - g_return_if_fail (GSECRET_IS_COLLECTION (self)); + g_return_if_fail (SECRET_IS_COLLECTION (self)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (self)); - _gsecret_service_delete_path (self->pv->service, object_path, FALSE, + _secret_service_delete_path (self->pv->service, object_path, FALSE, cancellable, callback, user_data); } /** - * gsecret_collection_delete_finish: + * secret_collection_delete_finish: * @self: a collection * @result: asynchronous result passed to the callback * @error: location to place an error on failure @@ -954,18 +954,18 @@ gsecret_collection_delete (GSecretCollection *self, * Returns: whether the item was successfully deleted or not */ gboolean -gsecret_collection_delete_finish (GSecretCollection *self, +secret_collection_delete_finish (SecretCollection *self, GAsyncResult *result, GError **error) { - g_return_val_if_fail (GSECRET_IS_COLLECTION (self), FALSE); + g_return_val_if_fail (SECRET_IS_COLLECTION (self), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - return gsecret_service_delete_path_finish (self->pv->service, result, error); + return secret_service_delete_path_finish (self->pv->service, result, error); } /** - * gsecret_collection_delete_sync: + * secret_collection_delete_sync: * @self: a collection * @cancellable: optional cancellation object * @error: location to place an error on failure @@ -973,54 +973,54 @@ gsecret_collection_delete_finish (GSecretCollection *self, * Delete this collection. * * This method may block indefinitely. The secret service may prompt the - * user. gsecret_service_prompt() will be used to handle any prompts that + * user. secret_service_prompt() will be used to handle any prompts that * show up. * * Returns: whether the item was successfully deleted or not */ gboolean -gsecret_collection_delete_sync (GSecretCollection *self, +secret_collection_delete_sync (SecretCollection *self, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; gboolean ret; - g_return_val_if_fail (GSECRET_IS_COLLECTION (self), FALSE); + g_return_val_if_fail (SECRET_IS_COLLECTION (self), 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_collection_delete (self, cancellable, _gsecret_sync_on_result, sync); + secret_collection_delete (self, cancellable, _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - ret = gsecret_collection_delete_finish (self, sync->result, error); + ret = secret_collection_delete_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return ret; } /** - * gsecret_collection_get_items: + * secret_collection_get_items: * @self: a collection * * Get the list of items in this collection. * - * Returns: (transfer full) (element-type GSecret.Item): a list of items, + * Returns: (transfer full) (element-type Secret.Item): a list of items, * when done, the list should be freed with g_list_free, and each item should * be released with g_object_unref() */ GList * -gsecret_collection_get_items (GSecretCollection *self) +secret_collection_get_items (SecretCollection *self) { GList *l, *items; - g_return_val_if_fail (GSECRET_IS_COLLECTION (self), NULL); + g_return_val_if_fail (SECRET_IS_COLLECTION (self), NULL); g_mutex_lock (&self->pv->mutex); items = g_hash_table_get_values (self->pv->items); @@ -1031,11 +1031,11 @@ gsecret_collection_get_items (GSecretCollection *self) return items; } -GSecretItem * -_gsecret_collection_find_item_instance (GSecretCollection *self, +SecretItem * +_secret_collection_find_item_instance (SecretCollection *self, const gchar *item_path) { - GSecretItem *item; + SecretItem *item; g_mutex_lock (&self->pv->mutex); item = g_hash_table_lookup (self->pv->items, item_path); @@ -1047,7 +1047,7 @@ _gsecret_collection_find_item_instance (GSecretCollection *self, } /** - * gsecret_collection_get_label: + * secret_collection_get_label: * @self: a collection * * Get the label of this collection. @@ -1055,12 +1055,12 @@ _gsecret_collection_find_item_instance (GSecretCollection *self, * Returns: (transfer full): the label, which should be freed with g_free() */ gchar * -gsecret_collection_get_label (GSecretCollection *self) +secret_collection_get_label (SecretCollection *self) { GVariant *variant; gchar *label; - g_return_val_if_fail (GSECRET_IS_COLLECTION (self), NULL); + g_return_val_if_fail (SECRET_IS_COLLECTION (self), NULL); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Label"); g_return_val_if_fail (variant != NULL, NULL); @@ -1072,7 +1072,7 @@ gsecret_collection_get_label (GSecretCollection *self) } /** - * gsecret_collection_set_label: + * secret_collection_set_label: * @self: a collection * @label: a new label * @cancellable: optional cancellation object @@ -1084,23 +1084,23 @@ gsecret_collection_get_label (GSecretCollection *self) * This function returns immediately and completes asynchronously. */ void -gsecret_collection_set_label (GSecretCollection *self, +secret_collection_set_label (SecretCollection *self, const gchar *label, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_return_if_fail (GSECRET_IS_COLLECTION (self)); + g_return_if_fail (SECRET_IS_COLLECTION (self)); g_return_if_fail (label != NULL); - _gsecret_util_set_property (G_DBUS_PROXY (self), "Label", + _secret_util_set_property (G_DBUS_PROXY (self), "Label", g_variant_new_string (label), - gsecret_collection_set_label, + secret_collection_set_label, cancellable, callback, user_data); } /** - * gsecret_collection_set_label_finish: + * secret_collection_set_label_finish: * @self: a collection * @result: asynchronous result passed to callback * @error: location to place error on failure @@ -1110,19 +1110,19 @@ gsecret_collection_set_label (GSecretCollection *self, * Returns: whether the change was successful or not */ gboolean -gsecret_collection_set_label_finish (GSecretCollection *self, +secret_collection_set_label_finish (SecretCollection *self, GAsyncResult *result, GError **error) { - g_return_val_if_fail (GSECRET_IS_COLLECTION (self), FALSE); + g_return_val_if_fail (SECRET_IS_COLLECTION (self), FALSE); - return _gsecret_util_set_property_finish (G_DBUS_PROXY (self), - gsecret_collection_set_label, + return _secret_util_set_property_finish (G_DBUS_PROXY (self), + secret_collection_set_label, result, error); } /** - * gsecret_collection_set_label_sync: + * secret_collection_set_label_sync: * @self: a collection * @label: a new label * @cancellable: optional cancellation object @@ -1136,21 +1136,21 @@ gsecret_collection_set_label_finish (GSecretCollection *self, * Returns: whether the change was successful or not */ gboolean -gsecret_collection_set_label_sync (GSecretCollection *self, +secret_collection_set_label_sync (SecretCollection *self, const gchar *label, GCancellable *cancellable, GError **error) { - g_return_val_if_fail (GSECRET_IS_COLLECTION (self), FALSE); + g_return_val_if_fail (SECRET_IS_COLLECTION (self), FALSE); g_return_val_if_fail (label != NULL, FALSE); - return _gsecret_util_set_property_sync (G_DBUS_PROXY (self), "Label", + return _secret_util_set_property_sync (G_DBUS_PROXY (self), "Label", g_variant_new_string (label), cancellable, error); } /** - * gsecret_collection_get_locked: + * secret_collection_get_locked: * @self: a collection * * Get whether the collection is locked or not. @@ -1158,12 +1158,12 @@ gsecret_collection_set_label_sync (GSecretCollection *self, * Returns: whether the collection is locked or not */ gboolean -gsecret_collection_get_locked (GSecretCollection *self) +secret_collection_get_locked (SecretCollection *self) { GVariant *variant; gboolean locked; - g_return_val_if_fail (GSECRET_IS_COLLECTION (self), TRUE); + g_return_val_if_fail (SECRET_IS_COLLECTION (self), TRUE); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Locked"); g_return_val_if_fail (variant != NULL, TRUE); @@ -1175,7 +1175,7 @@ gsecret_collection_get_locked (GSecretCollection *self) } /** - * gsecret_collection_get_created: + * secret_collection_get_created: * @self: a collection * * Get the created date and time of the collection. The return value is @@ -1184,12 +1184,12 @@ gsecret_collection_get_locked (GSecretCollection *self) * Returns: the created date and time */ guint64 -gsecret_collection_get_created (GSecretCollection *self) +secret_collection_get_created (SecretCollection *self) { GVariant *variant; guint64 created; - g_return_val_if_fail (GSECRET_IS_COLLECTION (self), TRUE); + g_return_val_if_fail (SECRET_IS_COLLECTION (self), TRUE); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Created"); g_return_val_if_fail (variant != NULL, 0); @@ -1201,7 +1201,7 @@ gsecret_collection_get_created (GSecretCollection *self) } /** - * gsecret_collection_get_modified: + * secret_collection_get_modified: * @self: a collection * * Get the modified date and time of the collection. The return value is @@ -1210,12 +1210,12 @@ gsecret_collection_get_created (GSecretCollection *self) * Returns: the modified date and time */ guint64 -gsecret_collection_get_modified (GSecretCollection *self) +secret_collection_get_modified (SecretCollection *self) { GVariant *variant; guint64 modified; - g_return_val_if_fail (GSECRET_IS_COLLECTION (self), TRUE); + g_return_val_if_fail (SECRET_IS_COLLECTION (self), TRUE); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Modified"); g_return_val_if_fail (variant != NULL, 0); diff --git a/library/gsecret-collection.h b/library/secret-collection.h similarity index 55% rename from library/gsecret-collection.h rename to library/secret-collection.h index 63e4f6f..a2721d4 100644 --- a/library/gsecret-collection.h +++ b/library/secret-collection.h @@ -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 -#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___ */ diff --git a/library/gsecret-enum-types.c.template b/library/secret-enum-types.c.template similarity index 93% rename from library/gsecret-enum-types.c.template rename to library/secret-enum-types.c.template index 5560289..d228e29 100644 --- a/library/gsecret-enum-types.c.template +++ b/library/secret-enum-types.c.template @@ -2,8 +2,8 @@ #include -#ifndef GSECRET_COMPILATION -#define GSECRET_COMPILATION +#ifndef SECRET_COMPILATION +#define SECRET_COMPILATION #endif /*** END file-header ***/ diff --git a/library/gsecret-enum-types.h.template b/library/secret-enum-types.h.template similarity index 64% rename from library/gsecret-enum-types.h.template rename to library/secret-enum-types.h.template index 3ec8564..421524e 100644 --- a/library/gsecret-enum-types.h.template +++ b/library/secret-enum-types.h.template @@ -1,10 +1,10 @@ /*** BEGIN file-header ***/ -#if !defined (__GSECRET_INSIDE_HEADER__) && !defined (GSECRET_COMPILATION) -#error "Only can be included directly." +#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION) +#error "Only 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 @@ -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 ***/ diff --git a/library/gsecret-item.c b/library/secret-item.c similarity index 69% rename from library/gsecret-item.c rename to library/secret-item.c index 25ecc38..e55aaa1 100644 --- a/library/gsecret-item.c +++ b/library/secret-item.c @@ -1,4 +1,4 @@ -/* GSecret - GLib wrapper for Secret Service +/* libsecret - GLib wrapper for Secret Service * * Copyright 2012 Red Hat Inc. * @@ -12,13 +12,13 @@ #include "config.h" -#include "gsecret-collection.h" -#include "gsecret-dbus-generated.h" -#include "gsecret-item.h" -#include "gsecret-private.h" -#include "gsecret-service.h" -#include "gsecret-types.h" -#include "gsecret-value.h" +#include "secret-collection.h" +#include "secret-dbus-generated.h" +#include "secret-item.h" +#include "secret-private.h" +#include "secret-service.h" +#include "secret-types.h" +#include "secret-value.h" #include @@ -34,28 +34,28 @@ enum { }; /* Thread safe: no changes between construct and finalize */ -typedef struct _GSecretItemPrivate { - GSecretService *service; +typedef struct _SecretItemPrivate { + SecretService *service; GCancellable *cancellable; -} GSecretItemPrivate; +} SecretItemPrivate; -static GInitableIface *gsecret_item_initable_parent_iface = NULL; +static GInitableIface *secret_item_initable_parent_iface = NULL; -static GAsyncInitableIface *gsecret_item_async_initable_parent_iface = NULL; +static GAsyncInitableIface *secret_item_async_initable_parent_iface = NULL; -static void gsecret_item_initable_iface (GInitableIface *iface); +static void secret_item_initable_iface (GInitableIface *iface); -static void gsecret_item_async_initable_iface (GAsyncInitableIface *iface); +static void secret_item_async_initable_iface (GAsyncInitableIface *iface); -G_DEFINE_TYPE_WITH_CODE (GSecretItem, gsecret_item, G_TYPE_DBUS_PROXY, - G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gsecret_item_initable_iface); - G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, gsecret_item_async_initable_iface); +G_DEFINE_TYPE_WITH_CODE (SecretItem, secret_item, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, secret_item_initable_iface); + G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, secret_item_async_initable_iface); ); static void -gsecret_item_init (GSecretItem *self) +secret_item_init (SecretItem *self) { - self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GSECRET_TYPE_ITEM, GSecretItemPrivate); + self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SECRET_TYPE_ITEM, SecretItemPrivate); self->pv->cancellable = g_cancellable_new (); } @@ -64,12 +64,12 @@ on_set_attributes (GObject *source, GAsyncResult *result, gpointer user_data) { - GSecretItem *self = GSECRET_ITEM (user_data); + SecretItem *self = SECRET_ITEM (user_data); GError *error = NULL; - gsecret_item_set_attributes_finish (self, result, &error); + secret_item_set_attributes_finish (self, result, &error); if (error != NULL) { - g_warning ("couldn't set GSecretItem Attributes: %s", error->message); + g_warning ("couldn't set SecretItem Attributes: %s", error->message); g_error_free (error); } @@ -81,12 +81,12 @@ on_set_label (GObject *source, GAsyncResult *result, gpointer user_data) { - GSecretItem *self = GSECRET_ITEM (user_data); + SecretItem *self = SECRET_ITEM (user_data); GError *error = NULL; - gsecret_item_set_label_finish (self, result, &error); + secret_item_set_label_finish (self, result, &error); if (error != NULL) { - g_warning ("couldn't set GSecretItem Label: %s", error->message); + g_warning ("couldn't set SecretItem Label: %s", error->message); g_error_free (error); } @@ -94,12 +94,12 @@ on_set_label (GObject *source, } static void -gsecret_item_set_property (GObject *obj, +secret_item_set_property (GObject *obj, guint prop_id, const GValue *value, GParamSpec *pspec) { - GSecretItem *self = GSECRET_ITEM (obj); + SecretItem *self = SECRET_ITEM (obj); switch (prop_id) { case PROP_SERVICE: @@ -110,12 +110,12 @@ gsecret_item_set_property (GObject *obj, (gpointer *)&self->pv->service); break; case PROP_ATTRIBUTES: - gsecret_item_set_attributes (self, g_value_get_boxed (value), + secret_item_set_attributes (self, g_value_get_boxed (value), self->pv->cancellable, on_set_attributes, g_object_ref (self)); break; case PROP_LABEL: - gsecret_item_set_label (self, g_value_get_string (value), + secret_item_set_label (self, g_value_get_string (value), self->pv->cancellable, on_set_label, g_object_ref (self)); break; @@ -126,34 +126,34 @@ gsecret_item_set_property (GObject *obj, } static void -gsecret_item_get_property (GObject *obj, +secret_item_get_property (GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) { - GSecretItem *self = GSECRET_ITEM (obj); + SecretItem *self = SECRET_ITEM (obj); switch (prop_id) { case PROP_SERVICE: g_value_set_object (value, self->pv->service); break; case PROP_ATTRIBUTES: - g_value_take_boxed (value, gsecret_item_get_attributes (self)); + g_value_take_boxed (value, secret_item_get_attributes (self)); break; case PROP_LABEL: - g_value_take_string (value, gsecret_item_get_label (self)); + g_value_take_string (value, secret_item_get_label (self)); break; case PROP_SCHEMA: - g_value_take_string (value, gsecret_item_get_schema (self)); + g_value_take_string (value, secret_item_get_schema (self)); break; case PROP_LOCKED: - g_value_set_boolean (value, gsecret_item_get_locked (self)); + g_value_set_boolean (value, secret_item_get_locked (self)); break; case PROP_CREATED: - g_value_set_uint64 (value, gsecret_item_get_created (self)); + g_value_set_uint64 (value, secret_item_get_created (self)); break; case PROP_MODIFIED: - g_value_set_uint64 (value, gsecret_item_get_modified (self)); + g_value_set_uint64 (value, secret_item_get_modified (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); @@ -162,19 +162,19 @@ gsecret_item_get_property (GObject *obj, } static void -gsecret_item_dispose (GObject *obj) +secret_item_dispose (GObject *obj) { - GSecretItem *self = GSECRET_ITEM (obj); + SecretItem *self = SECRET_ITEM (obj); g_cancellable_cancel (self->pv->cancellable); - G_OBJECT_CLASS (gsecret_item_parent_class)->dispose (obj); + G_OBJECT_CLASS (secret_item_parent_class)->dispose (obj); } static void -gsecret_item_finalize (GObject *obj) +secret_item_finalize (GObject *obj) { - GSecretItem *self = GSECRET_ITEM (obj); + SecretItem *self = SECRET_ITEM (obj); if (self->pv->service) g_object_remove_weak_pointer (G_OBJECT (self->pv->service), @@ -182,7 +182,7 @@ gsecret_item_finalize (GObject *obj) g_object_unref (self->pv->cancellable); - G_OBJECT_CLASS (gsecret_item_parent_class)->finalize (obj); + G_OBJECT_CLASS (secret_item_parent_class)->finalize (obj); } static void @@ -209,7 +209,7 @@ handle_property_changed (GObject *object, } static void -gsecret_item_properties_changed (GDBusProxy *proxy, +secret_item_properties_changed (GDBusProxy *proxy, GVariant *changed_properties, const gchar* const *invalidated_properties) { @@ -228,21 +228,21 @@ gsecret_item_properties_changed (GDBusProxy *proxy, } static void -gsecret_item_class_init (GSecretItemClass *klass) +secret_item_class_init (SecretItemClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDBusProxyClass *proxy_class = G_DBUS_PROXY_CLASS (klass); - gobject_class->get_property = gsecret_item_get_property; - gobject_class->set_property = gsecret_item_set_property; - gobject_class->dispose = gsecret_item_dispose; - gobject_class->finalize = gsecret_item_finalize; + gobject_class->get_property = secret_item_get_property; + gobject_class->set_property = secret_item_set_property; + gobject_class->dispose = secret_item_dispose; + gobject_class->finalize = secret_item_finalize; - proxy_class->g_properties_changed = gsecret_item_properties_changed; + proxy_class->g_properties_changed = secret_item_properties_changed; g_object_class_install_property (gobject_class, PROP_SERVICE, g_param_spec_object ("service", "Service", "Secret Service", - GSECRET_TYPE_SERVICE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + SECRET_TYPE_SERVICE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ATTRIBUTES, g_param_spec_boxed ("attributes", "Attributes", "Item attributes", @@ -268,22 +268,22 @@ gsecret_item_class_init (GSecretItemClass *klass) g_param_spec_uint64 ("modified", "Modified", "Item modified date", 0UL, G_MAXUINT64, 0UL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_type_class_add_private (gobject_class, sizeof (GSecretItemPrivate)); + g_type_class_add_private (gobject_class, sizeof (SecretItemPrivate)); } static gboolean -gsecret_item_initable_init (GInitable *initable, +secret_item_initable_init (GInitable *initable, GCancellable *cancellable, GError **error) { GDBusProxy *proxy; - if (!gsecret_item_initable_parent_iface->init (initable, cancellable, error)) + if (!secret_item_initable_parent_iface->init (initable, cancellable, error)) return FALSE; proxy = G_DBUS_PROXY (initable); - if (!_gsecret_util_have_cached_properties (proxy)) { + if (!_secret_util_have_cached_properties (proxy)) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "No such secret item at path: %s", g_dbus_proxy_get_object_path (proxy)); @@ -294,11 +294,11 @@ gsecret_item_initable_init (GInitable *initable, } static void -gsecret_item_initable_iface (GInitableIface *iface) +secret_item_initable_iface (GInitableIface *iface) { - gsecret_item_initable_parent_iface = g_type_interface_peek_parent (iface); + secret_item_initable_parent_iface = g_type_interface_peek_parent (iface); - iface->init = gsecret_item_initable_init; + iface->init = secret_item_initable_init; } static void @@ -307,15 +307,15 @@ on_init_base (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretItem *self = GSECRET_ITEM (source); + SecretItem *self = SECRET_ITEM (source); GDBusProxy *proxy = G_DBUS_PROXY (self); GError *error = NULL; - if (!gsecret_item_async_initable_parent_iface->init_finish (G_ASYNC_INITABLE (self), + if (!secret_item_async_initable_parent_iface->init_finish (G_ASYNC_INITABLE (self), result, &error)) { g_simple_async_result_take_error (res, error); - } else if (!_gsecret_util_have_cached_properties (proxy)) { + } else if (!_secret_util_have_cached_properties (proxy)) { g_simple_async_result_set_error (res, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "No such secret item at path: %s", g_dbus_proxy_get_object_path (proxy)); @@ -326,7 +326,7 @@ on_init_base (GObject *source, } static void -gsecret_item_async_initable_init_async (GAsyncInitable *initable, +secret_item_async_initable_init_async (GAsyncInitable *initable, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -335,9 +335,9 @@ gsecret_item_async_initable_init_async (GAsyncInitable *initable, GSimpleAsyncResult *res; res = g_simple_async_result_new (G_OBJECT (initable), callback, user_data, - gsecret_item_async_initable_init_async); + secret_item_async_initable_init_async); - gsecret_item_async_initable_parent_iface->init_async (initable, io_priority, + secret_item_async_initable_parent_iface->init_async (initable, io_priority, cancellable, on_init_base, g_object_ref (res)); @@ -346,12 +346,12 @@ gsecret_item_async_initable_init_async (GAsyncInitable *initable, } static gboolean -gsecret_item_async_initable_init_finish (GAsyncInitable *initable, +secret_item_async_initable_init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) { g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (initable), - gsecret_item_async_initable_init_async), FALSE); + secret_item_async_initable_init_async), FALSE); if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error)) return FALSE; @@ -360,16 +360,16 @@ gsecret_item_async_initable_init_finish (GAsyncInitable *initable, } static void -gsecret_item_async_initable_iface (GAsyncInitableIface *iface) +secret_item_async_initable_iface (GAsyncInitableIface *iface) { - gsecret_item_async_initable_parent_iface = g_type_interface_peek_parent (iface); + secret_item_async_initable_parent_iface = g_type_interface_peek_parent (iface); - iface->init_async = gsecret_item_async_initable_init_async; - iface->init_finish = gsecret_item_async_initable_init_finish; + iface->init_async = secret_item_async_initable_init_async; + iface->init_finish = secret_item_async_initable_init_finish; } void -gsecret_item_new (GSecretService *service, +secret_item_new (SecretService *service, const gchar *item_path, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -377,26 +377,26 @@ gsecret_item_new (GSecretService *service, { GDBusProxy *proxy; - g_return_if_fail (GSECRET_IS_SERVICE (service)); + g_return_if_fail (SECRET_IS_SERVICE (service)); g_return_if_fail (item_path != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); proxy = G_DBUS_PROXY (service); - g_async_initable_new_async (GSECRET_SERVICE_GET_CLASS (service)->item_gtype, + g_async_initable_new_async (SECRET_SERVICE_GET_CLASS (service)->item_gtype, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", G_DBUS_CALL_FLAGS_NONE, - "g-interface-info", _gsecret_gen_item_interface_info (), + "g-interface-info", _secret_gen_item_interface_info (), "g-name", g_dbus_proxy_get_name (proxy), "g-connection", g_dbus_proxy_get_connection (proxy), "g-object-path", item_path, - "g-interface-name", GSECRET_ITEM_INTERFACE, + "g-interface-name", SECRET_ITEM_INTERFACE, "service", service, NULL); } -GSecretItem * -gsecret_item_new_finish (GAsyncResult *result, +SecretItem * +secret_item_new_finish (GAsyncResult *result, GError **error) { GObject *object; @@ -410,50 +410,50 @@ gsecret_item_new_finish (GAsyncResult *result, if (object == NULL) return NULL; - return GSECRET_ITEM (object); + return SECRET_ITEM (object); } -GSecretItem * -gsecret_item_new_sync (GSecretService *service, +SecretItem * +secret_item_new_sync (SecretService *service, const gchar *item_path, GCancellable *cancellable, GError **error) { GDBusProxy *proxy; - 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 (item_path != NULL, NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); proxy = G_DBUS_PROXY (service); - return g_initable_new (GSECRET_SERVICE_GET_CLASS (service)->item_gtype, + return g_initable_new (SECRET_SERVICE_GET_CLASS (service)->item_gtype, cancellable, error, "g-flags", G_DBUS_CALL_FLAGS_NONE, - "g-interface-info", _gsecret_gen_item_interface_info (), + "g-interface-info", _secret_gen_item_interface_info (), "g-name", g_dbus_proxy_get_name (proxy), "g-connection", g_dbus_proxy_get_connection (proxy), "g-object-path", item_path, - "g-interface-name", GSECRET_ITEM_INTERFACE, + "g-interface-name", SECRET_ITEM_INTERFACE, "service", service, NULL); } void -gsecret_item_refresh (GSecretItem *self) +secret_item_refresh (SecretItem *self) { - g_return_if_fail (GSECRET_IS_ITEM (self)); + g_return_if_fail (SECRET_IS_ITEM (self)); - _gsecret_util_get_properties (G_DBUS_PROXY (self), - gsecret_item_refresh, + _secret_util_get_properties (G_DBUS_PROXY (self), + secret_item_refresh, NULL, NULL, NULL); } typedef struct { GCancellable *cancellable; - GSecretItem *item; + SecretItem *item; } CreateClosure; static void @@ -474,7 +474,7 @@ on_create_item (GObject *source, CreateClosure *closure = g_simple_async_result_get_op_res_gpointer (res); GError *error = NULL; - closure->item = gsecret_item_new_finish (result, &error); + closure->item = secret_item_new_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -489,13 +489,13 @@ on_create_path (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); CreateClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *service = GSECRET_SERVICE (source); + SecretService *service = SECRET_SERVICE (source); GError *error = NULL; gchar *path; - path = gsecret_service_create_item_path_finish (service, result, &error); + path = secret_service_create_item_path_finish (service, result, &error); if (error == NULL) { - gsecret_item_new (service, path, closure->cancellable, + secret_item_new (service, path, closure->cancellable, on_create_item, g_object_ref (res)); } else { g_simple_async_result_take_error (res, error); @@ -518,47 +518,47 @@ item_properties_new (const gchar *schema_name, value = g_variant_new_string (label); g_hash_table_insert (properties, - GSECRET_ITEM_INTERFACE ".Label", + SECRET_ITEM_INTERFACE ".Label", g_variant_ref_sink (value)); value = g_variant_new_string (schema_name); g_hash_table_insert (properties, - GSECRET_ITEM_INTERFACE ".Schema", + SECRET_ITEM_INTERFACE ".Schema", g_variant_ref_sink (value)); - value = _gsecret_util_variant_for_attributes (attributes); + value = _secret_util_variant_for_attributes (attributes); g_hash_table_insert (properties, - GSECRET_ITEM_INTERFACE ".Attributes", + SECRET_ITEM_INTERFACE ".Attributes", g_variant_ref_sink (value)); return properties; } void -gsecret_item_create (GSecretCollection *collection, +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) { - GSecretService *service = NULL; + SecretService *service = NULL; const gchar *collection_path; GSimpleAsyncResult *res; CreateClosure *closure; GHashTable *properties; - g_return_if_fail (GSECRET_IS_COLLECTION (collection)); + g_return_if_fail (SECRET_IS_COLLECTION (collection)); g_return_if_fail (label != NULL); g_return_if_fail (attributes != NULL); g_return_if_fail (value != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (NULL, callback, user_data, - gsecret_item_create); + secret_item_create); closure = g_slice_new0 (CreateClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; g_simple_async_result_set_op_res_gpointer (res, closure, create_closure_free); @@ -568,7 +568,7 @@ gsecret_item_create (GSecretCollection *collection, collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)); - gsecret_service_create_item_path (service, collection_path, properties, + secret_service_create_item_path (service, collection_path, properties, value, replace, cancellable, on_create_path, g_object_ref (res)); @@ -577,15 +577,15 @@ gsecret_item_create (GSecretCollection *collection, g_object_unref (res); } -GSecretItem * -gsecret_item_create_finish (GAsyncResult *result, +SecretItem * +secret_item_create_finish (GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; CreateClosure *closure; g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL, - gsecret_item_create), NULL); + secret_item_create), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -600,23 +600,23 @@ gsecret_item_create_finish (GAsyncResult *result, return g_object_ref (closure->item); } -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) { - GSecretService *service = NULL; + SecretService *service = NULL; const gchar *collection_path; - GSecretItem *item = NULL; + SecretItem *item = NULL; GHashTable *properties; gchar *path; - g_return_val_if_fail (GSECRET_IS_COLLECTION (collection), NULL); + g_return_val_if_fail (SECRET_IS_COLLECTION (collection), NULL); g_return_val_if_fail (label != NULL, NULL); g_return_val_if_fail (attributes != NULL, NULL); g_return_val_if_fail (value != NULL, NULL); @@ -628,11 +628,11 @@ gsecret_item_create_sync (GSecretCollection *collection, collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)); - path = gsecret_service_create_item_path_sync (service, collection_path, properties, + path = secret_service_create_item_path_sync (service, collection_path, properties, value, replace, cancellable, error); if (path != NULL) { - item = gsecret_item_new_sync (service, path, cancellable, error); + item = secret_item_new_sync (service, path, cancellable, error); g_free (path); } @@ -648,10 +648,10 @@ on_item_deleted (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretItem *self = GSECRET_ITEM (g_async_result_get_source_object (user_data)); + SecretItem *self = SECRET_ITEM (g_async_result_get_source_object (user_data)); GError *error = NULL; - if (gsecret_service_delete_path_finish (GSECRET_SERVICE (source), result, &error)) { + if (secret_service_delete_path_finish (SECRET_SERVICE (source), result, &error)) { g_simple_async_result_set_op_res_gboolean (res, TRUE); g_object_run_dispose (G_OBJECT (self)); } @@ -665,7 +665,7 @@ on_item_deleted (GObject *source, } void -gsecret_item_delete (GSecretItem *self, +secret_item_delete (SecretItem *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) @@ -673,30 +673,30 @@ gsecret_item_delete (GSecretItem *self, GSimpleAsyncResult *res; const gchar *object_path; - g_return_if_fail (GSECRET_IS_ITEM (self)); + g_return_if_fail (SECRET_IS_ITEM (self)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (self)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_item_delete); + secret_item_delete); - _gsecret_service_delete_path (self->pv->service, object_path, TRUE, + _secret_service_delete_path (self->pv->service, object_path, TRUE, cancellable, on_item_deleted, g_object_ref (res)); g_object_unref (res); } gboolean -gsecret_item_delete_finish (GSecretItem *self, +secret_item_delete_finish (SecretItem *self, GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; - g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE); + g_return_val_if_fail (SECRET_IS_ITEM (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_item_delete), FALSE); + secret_item_delete), FALSE); res = G_SIMPLE_ASYNC_RESULT (result); @@ -707,35 +707,35 @@ gsecret_item_delete_finish (GSecretItem *self, } gboolean -gsecret_item_delete_sync (GSecretItem *self, +secret_item_delete_sync (SecretItem *self, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; gboolean ret; - g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE); + g_return_val_if_fail (SECRET_IS_ITEM (self), 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_item_delete (self, cancellable, _gsecret_sync_on_result, sync); + secret_item_delete (self, cancellable, _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - ret = gsecret_item_delete_finish (self, sync->result, error); + ret = secret_item_delete_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return ret; } typedef struct { GCancellable *cancellable; - GSecretValue *value; + SecretValue *value; } GetClosure; static void @@ -743,7 +743,7 @@ get_closure_free (gpointer data) { GetClosure *closure = data; g_clear_object (&closure->cancellable); - gsecret_value_unref (closure->value); + secret_value_unref (closure->value); g_slice_free (GetClosure, closure); } @@ -753,9 +753,9 @@ on_item_get_secret (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretItem *self = GSECRET_ITEM (g_async_result_get_source_object (user_data)); + SecretItem *self = SECRET_ITEM (g_async_result_get_source_object (user_data)); GetClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretSession *session; + SecretSession *session; GError *error = NULL; GVariant *retval; GVariant *child; @@ -765,12 +765,12 @@ on_item_get_secret (GObject *source, child = g_variant_get_child_value (retval, 0); g_variant_unref (retval); - session = _gsecret_service_get_session (self->pv->service); - closure->value = _gsecret_session_decode_secret (session, child); + session = _secret_service_get_session (self->pv->service); + closure->value = _secret_session_decode_secret (session, child); g_variant_unref (child); if (closure->value == NULL) - g_set_error (&error, GSECRET_ERROR, GSECRET_ERROR_PROTOCOL, + g_set_error (&error, SECRET_ERROR, SECRET_ERROR_PROTOCOL, _("Received invalid secret from the secret storage")); } @@ -787,12 +787,12 @@ on_get_ensure_session (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretItem *self = GSECRET_ITEM (g_async_result_get_source_object (user_data)); + SecretItem *self = SECRET_ITEM (g_async_result_get_source_object (user_data)); GetClosure *closure = g_simple_async_result_get_op_res_gpointer (res); const gchar *session_path; GError *error = NULL; - session_path = gsecret_service_ensure_session_finish (self->pv->service, result, &error); + session_path = secret_service_ensure_session_finish (self->pv->service, result, &error); if (error != NULL) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); @@ -810,7 +810,7 @@ on_get_ensure_session (GObject *source, } void -gsecret_item_get_secret (GSecretItem *self, +secret_item_get_secret (SecretItem *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) @@ -818,24 +818,24 @@ gsecret_item_get_secret (GSecretItem *self, GSimpleAsyncResult *res; GetClosure *closure; - g_return_if_fail (GSECRET_IS_ITEM (self)); + g_return_if_fail (SECRET_IS_ITEM (self)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, - user_data, gsecret_item_get_secret); + user_data, secret_item_get_secret); closure = g_slice_new0 (GetClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; g_simple_async_result_set_op_res_gpointer (res, closure, get_closure_free); - gsecret_service_ensure_session (self->pv->service, cancellable, + secret_service_ensure_session (self->pv->service, cancellable, on_get_ensure_session, g_object_ref (res)); g_object_unref (res); } -GSecretValue* -gsecret_item_get_secret_finish (GSecretItem *self, +SecretValue* +secret_item_get_secret_finish (SecretItem *self, GAsyncResult *result, GError **error) { @@ -843,46 +843,46 @@ gsecret_item_get_secret_finish (GSecretItem *self, GetClosure *closure; g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_item_get_secret), NULL); + secret_item_get_secret), 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); - return closure->value ? gsecret_value_ref (closure->value) : NULL; + return closure->value ? secret_value_ref (closure->value) : NULL; } -GSecretValue* -gsecret_item_get_secret_sync (GSecretItem *self, +SecretValue* +secret_item_get_secret_sync (SecretItem *self, GCancellable *cancellable, GError **error) { - GSecretSync *sync; - GSecretValue *value; + SecretSync *sync; + SecretValue *value; - g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE); + g_return_val_if_fail (SECRET_IS_ITEM (self), 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_item_get_secret (self, cancellable, _gsecret_sync_on_result, sync); + secret_item_get_secret (self, cancellable, _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - value = gsecret_item_get_secret_finish (self, sync->result, error); + value = secret_item_get_secret_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return value; } typedef struct { GCancellable *cancellable; - GSecretValue *value; + SecretValue *value; } SetClosure; static void @@ -890,7 +890,7 @@ set_closure_free (gpointer data) { GetClosure *closure = data; g_clear_object (&closure->cancellable); - gsecret_value_unref (closure->value); + secret_value_unref (closure->value); g_slice_free (GetClosure, closure); } @@ -920,20 +920,20 @@ on_set_ensure_session (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretItem *self = GSECRET_ITEM (g_async_result_get_source_object (user_data)); + SecretItem *self = SECRET_ITEM (g_async_result_get_source_object (user_data)); SetClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretSession *session; + SecretSession *session; GVariant *encoded; GError *error = NULL; - gsecret_service_ensure_session_finish (self->pv->service, result, &error); + secret_service_ensure_session_finish (self->pv->service, result, &error); if (error != NULL) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); } else { - session = _gsecret_service_get_session (self->pv->service); - encoded = _gsecret_session_encode_secret (session, closure->value); + session = _secret_service_get_session (self->pv->service); + encoded = _secret_session_encode_secret (session, closure->value); g_dbus_proxy_call (G_DBUS_PROXY (self), "SetSecret", g_variant_new ("(@(oayays))", encoded), G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, closure->cancellable, @@ -945,8 +945,8 @@ on_set_ensure_session (GObject *source, } void -gsecret_item_set_secret (GSecretItem *self, - GSecretValue *value, +secret_item_set_secret (SecretItem *self, + SecretValue *value, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) @@ -954,18 +954,18 @@ gsecret_item_set_secret (GSecretItem *self, GSimpleAsyncResult *res; SetClosure *closure; - g_return_if_fail (GSECRET_IS_ITEM (self)); + g_return_if_fail (SECRET_IS_ITEM (self)); g_return_if_fail (value != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, - user_data, gsecret_item_set_secret); + user_data, secret_item_set_secret); closure = g_slice_new0 (SetClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; - closure->value = gsecret_value_ref (value); + closure->value = secret_value_ref (value); g_simple_async_result_set_op_res_gpointer (res, closure, set_closure_free); - gsecret_service_ensure_session (self->pv->service, cancellable, + secret_service_ensure_session (self->pv->service, cancellable, on_set_ensure_session, g_object_ref (res)); @@ -973,14 +973,14 @@ gsecret_item_set_secret (GSecretItem *self, } gboolean -gsecret_item_set_secret_finish (GSecretItem *self, +secret_item_set_secret_finish (SecretItem *self, GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_item_set_secret), FALSE); + secret_item_set_secret), FALSE); res = G_SIMPLE_ASYNC_RESULT (result); if (g_simple_async_result_propagate_error (res, error)) @@ -990,99 +990,99 @@ gsecret_item_set_secret_finish (GSecretItem *self, } gboolean -gsecret_item_set_secret_sync (GSecretItem *self, - GSecretValue *value, +secret_item_set_secret_sync (SecretItem *self, + SecretValue *value, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; gboolean ret; - g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE); + g_return_val_if_fail (SECRET_IS_ITEM (self), 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_item_set_secret (self, value, cancellable, _gsecret_sync_on_result, sync); + secret_item_set_secret (self, value, cancellable, _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - ret = gsecret_item_set_secret_finish (self, sync->result, error); + ret = secret_item_set_secret_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return ret; } GHashTable * -gsecret_item_get_attributes (GSecretItem *self) +secret_item_get_attributes (SecretItem *self) { GHashTable *attributes; GVariant *variant; - g_return_val_if_fail (GSECRET_IS_ITEM (self), NULL); + g_return_val_if_fail (SECRET_IS_ITEM (self), NULL); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Attributes"); g_return_val_if_fail (variant != NULL, NULL); - attributes = _gsecret_util_attributes_for_variant (variant); + attributes = _secret_util_attributes_for_variant (variant); g_variant_unref (variant); return attributes; } void -gsecret_item_set_attributes (GSecretItem *self, +secret_item_set_attributes (SecretItem *self, GHashTable *attributes, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_return_if_fail (GSECRET_IS_ITEM (self)); + g_return_if_fail (SECRET_IS_ITEM (self)); g_return_if_fail (attributes != NULL); - _gsecret_util_set_property (G_DBUS_PROXY (self), "Attributes", - _gsecret_util_variant_for_attributes (attributes), - gsecret_item_set_attributes, cancellable, + _secret_util_set_property (G_DBUS_PROXY (self), "Attributes", + _secret_util_variant_for_attributes (attributes), + secret_item_set_attributes, cancellable, callback, user_data); } gboolean -gsecret_item_set_attributes_finish (GSecretItem *self, +secret_item_set_attributes_finish (SecretItem *self, GAsyncResult *result, GError **error) { - g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE); + g_return_val_if_fail (SECRET_IS_ITEM (self), FALSE); - return _gsecret_util_set_property_finish (G_DBUS_PROXY (self), - gsecret_item_set_attributes, + return _secret_util_set_property_finish (G_DBUS_PROXY (self), + secret_item_set_attributes, result, error); } gboolean -gsecret_item_set_attributes_sync (GSecretItem *self, +secret_item_set_attributes_sync (SecretItem *self, GHashTable *attributes, GCancellable *cancellable, GError **error) { - g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE); + g_return_val_if_fail (SECRET_IS_ITEM (self), FALSE); g_return_val_if_fail (attributes != NULL, FALSE); - return _gsecret_util_set_property_sync (G_DBUS_PROXY (self), "Attributes", - _gsecret_util_variant_for_attributes (attributes), + return _secret_util_set_property_sync (G_DBUS_PROXY (self), "Attributes", + _secret_util_variant_for_attributes (attributes), cancellable, error); } gchar * -gsecret_item_get_schema (GSecretItem *self) +secret_item_get_schema (SecretItem *self) { GVariant *variant; gchar *label; - g_return_val_if_fail (GSECRET_IS_ITEM (self), NULL); + g_return_val_if_fail (SECRET_IS_ITEM (self), NULL); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Type"); if (variant == NULL) @@ -1095,12 +1095,12 @@ gsecret_item_get_schema (GSecretItem *self) } gchar * -gsecret_item_get_label (GSecretItem *self) +secret_item_get_label (SecretItem *self) { GVariant *variant; gchar *label; - g_return_val_if_fail (GSECRET_IS_ITEM (self), NULL); + g_return_val_if_fail (SECRET_IS_ITEM (self), NULL); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Label"); g_return_val_if_fail (variant != NULL, NULL); @@ -1112,54 +1112,54 @@ gsecret_item_get_label (GSecretItem *self) } void -gsecret_item_set_label (GSecretItem *self, +secret_item_set_label (SecretItem *self, const gchar *label, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_return_if_fail (GSECRET_IS_ITEM (self)); + g_return_if_fail (SECRET_IS_ITEM (self)); g_return_if_fail (label != NULL); - _gsecret_util_set_property (G_DBUS_PROXY (self), "Label", + _secret_util_set_property (G_DBUS_PROXY (self), "Label", g_variant_new_string (label), - gsecret_item_set_label, + secret_item_set_label, cancellable, callback, user_data); } gboolean -gsecret_item_set_label_finish (GSecretItem *self, +secret_item_set_label_finish (SecretItem *self, GAsyncResult *result, GError **error) { - g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE); + g_return_val_if_fail (SECRET_IS_ITEM (self), FALSE); - return _gsecret_util_set_property_finish (G_DBUS_PROXY (self), - gsecret_item_set_label, + return _secret_util_set_property_finish (G_DBUS_PROXY (self), + secret_item_set_label, result, error); } gboolean -gsecret_item_set_label_sync (GSecretItem *self, +secret_item_set_label_sync (SecretItem *self, const gchar *label, GCancellable *cancellable, GError **error) { - g_return_val_if_fail (GSECRET_IS_ITEM (self), FALSE); + g_return_val_if_fail (SECRET_IS_ITEM (self), FALSE); g_return_val_if_fail (label != NULL, FALSE); - return _gsecret_util_set_property_sync (G_DBUS_PROXY (self), "Label", + return _secret_util_set_property_sync (G_DBUS_PROXY (self), "Label", g_variant_new_string (label), cancellable, error); } gboolean -gsecret_item_get_locked (GSecretItem *self) +secret_item_get_locked (SecretItem *self) { GVariant *variant; gboolean locked; - g_return_val_if_fail (GSECRET_IS_ITEM (self), TRUE); + g_return_val_if_fail (SECRET_IS_ITEM (self), TRUE); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Locked"); g_return_val_if_fail (variant != NULL, TRUE); @@ -1171,12 +1171,12 @@ gsecret_item_get_locked (GSecretItem *self) } guint64 -gsecret_item_get_created (GSecretItem *self) +secret_item_get_created (SecretItem *self) { GVariant *variant; guint64 created; - g_return_val_if_fail (GSECRET_IS_ITEM (self), TRUE); + g_return_val_if_fail (SECRET_IS_ITEM (self), TRUE); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Created"); g_return_val_if_fail (variant != NULL, 0); @@ -1188,12 +1188,12 @@ gsecret_item_get_created (GSecretItem *self) } guint64 -gsecret_item_get_modified (GSecretItem *self) +secret_item_get_modified (SecretItem *self) { GVariant *variant; guint64 modified; - g_return_val_if_fail (GSECRET_IS_ITEM (self), TRUE); + g_return_val_if_fail (SECRET_IS_ITEM (self), TRUE); variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Modified"); g_return_val_if_fail (variant != NULL, 0); diff --git a/library/gsecret-item.h b/library/secret-item.h similarity index 60% rename from library/gsecret-item.h rename to library/secret-item.h index 5e7e4d3..fb2d1be 100644 --- a/library/gsecret-item.h +++ b/library/secret-item.h @@ -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 -#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 diff --git a/library/gsecret-methods.c b/library/secret-methods.c similarity index 75% rename from library/gsecret-methods.c rename to library/secret-methods.c index fdcaeca..a5468d5 100644 --- a/library/gsecret-methods.c +++ b/library/secret-methods.c @@ -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,13 +13,13 @@ #include "config.h" -#include "gsecret-collection.h" -#include "gsecret-dbus-generated.h" -#include "gsecret-item.h" -#include "gsecret-private.h" -#include "gsecret-service.h" -#include "gsecret-types.h" -#include "gsecret-value.h" +#include "secret-collection.h" +#include "secret-dbus-generated.h" +#include "secret-item.h" +#include "secret-private.h" +#include "secret-service.h" +#include "secret-types.h" +#include "secret-value.h" static void on_search_items_complete (GObject *source, @@ -42,7 +42,7 @@ on_search_items_complete (GObject *source, } void -gsecret_service_search_for_paths (GSecretService *self, +secret_service_search_for_paths (SecretService *self, GHashTable *attributes, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -50,16 +50,16 @@ gsecret_service_search_for_paths (GSecretService *self, { GSimpleAsyncResult *res; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (attributes != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_search_for_paths); + secret_service_search_for_paths); g_dbus_proxy_call (G_DBUS_PROXY (self), "SearchItems", g_variant_new ("(@a{ss})", - _gsecret_util_variant_for_attributes (attributes)), + _secret_util_variant_for_attributes (attributes)), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, on_search_items_complete, g_object_ref (res)); @@ -67,7 +67,7 @@ gsecret_service_search_for_paths (GSecretService *self, } gboolean -gsecret_service_search_for_paths_finish (GSecretService *self, +secret_service_search_for_paths_finish (SecretService *self, GAsyncResult *result, gchar ***unlocked, gchar ***locked, @@ -78,7 +78,7 @@ gsecret_service_search_for_paths_finish (GSecretService *self, gchar **dummy = NULL; g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_service_search_for_paths), FALSE); + secret_service_search_for_paths), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); res = G_SIMPLE_ASYNC_RESULT (result); @@ -99,7 +99,7 @@ gsecret_service_search_for_paths_finish (GSecretService *self, } gboolean -gsecret_service_search_for_paths_sync (GSecretService *self, +secret_service_search_for_paths_sync (SecretService *self, GHashTable *attributes, GCancellable *cancellable, gchar ***unlocked, @@ -109,14 +109,14 @@ gsecret_service_search_for_paths_sync (GSecretService *self, gchar **dummy = NULL; GVariant *response; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); 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); response = g_dbus_proxy_call_sync (G_DBUS_PROXY (self), "SearchItems", g_variant_new ("(@a{ss})", - _gsecret_util_variant_for_attributes (attributes)), + _secret_util_variant_for_attributes (attributes)), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (response != NULL) { @@ -157,7 +157,7 @@ search_closure_free (gpointer data) static void search_closure_take_item (SearchClosure *closure, - GSecretItem *item) + SecretItem *item) { const gchar *path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)); g_hash_table_insert (closure->items, (gpointer)path, item); @@ -171,11 +171,11 @@ on_search_loaded (GObject *source, GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); SearchClosure *closure = g_simple_async_result_get_op_res_gpointer (res); GError *error = NULL; - GSecretItem *item; + SecretItem *item; closure->loading--; - item = gsecret_item_new_finish (result, &error); + item = secret_item_new_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -188,16 +188,16 @@ on_search_loaded (GObject *source, } static void -search_load_item_async (GSecretService *self, +search_load_item_async (SecretService *self, GSimpleAsyncResult *res, SearchClosure *closure, const gchar *path) { - GSecretItem *item; + SecretItem *item; - item = _gsecret_service_find_item_instance (self, path); + item = _secret_service_find_item_instance (self, path); if (item == NULL) { - gsecret_item_new (self, path, closure->cancellable, + secret_item_new (self, path, closure->cancellable, on_search_loaded, g_object_ref (res)); closure->loading++; } else { @@ -212,11 +212,11 @@ on_search_paths (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); SearchClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (source); + SecretService *self = SECRET_SERVICE (source); GError *error = NULL; guint i; - if (!gsecret_service_search_for_paths_finish (self, result, &closure->unlocked, + if (!secret_service_search_for_paths_finish (self, result, &closure->unlocked, &closure->locked, &error)) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); @@ -234,7 +234,7 @@ on_search_paths (GObject *source, } void -gsecret_service_search (GSecretService *self, +secret_service_search (SecretService *self, GHashTable *attributes, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -243,18 +243,18 @@ gsecret_service_search (GSecretService *self, GSimpleAsyncResult *res; SearchClosure *closure; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (attributes != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_search); + secret_service_search); closure = g_slice_new0 (SearchClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; closure->items = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); g_simple_async_result_set_op_res_gpointer (res, closure, search_closure_free); - gsecret_service_search_for_paths (self, attributes, cancellable, + secret_service_search_for_paths (self, attributes, cancellable, on_search_paths, g_object_ref (res)); g_object_unref (res); @@ -265,7 +265,7 @@ search_finish_build (gchar **paths, SearchClosure *closure) { GList *results = NULL; - GSecretItem *item; + SecretItem *item; guint i; for (i = 0; paths[i]; i++) { @@ -278,7 +278,7 @@ search_finish_build (gchar **paths, } gboolean -gsecret_service_search_finish (GSecretService *self, +secret_service_search_finish (SecretService *self, GAsyncResult *result, GList **unlocked, GList **locked, @@ -287,10 +287,10 @@ gsecret_service_search_finish (GSecretService *self, GSimpleAsyncResult *res; SearchClosure *closure; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (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_service_search), FALSE); + secret_service_search), FALSE); res = G_SIMPLE_ASYNC_RESULT (result); @@ -307,20 +307,20 @@ gsecret_service_search_finish (GSecretService *self, } static gboolean -service_load_items_sync (GSecretService *self, +service_load_items_sync (SecretService *self, GCancellable *cancellable, gchar **paths, GList **items, GError **error) { - GSecretItem *item; + SecretItem *item; GList *result = NULL; guint i; for (i = 0; paths[i] != NULL; i++) { - item = _gsecret_service_find_item_instance (self, paths[i]); + item = _secret_service_find_item_instance (self, paths[i]); if (item == NULL) - item = gsecret_item_new_sync (self, paths[i], cancellable, error); + item = secret_item_new_sync (self, paths[i], cancellable, error); if (item == NULL) { g_list_free_full (result, g_object_unref); return FALSE; @@ -334,7 +334,7 @@ service_load_items_sync (GSecretService *self, } gboolean -gsecret_service_search_sync (GSecretService *self, +secret_service_search_sync (SecretService *self, GHashTable *attributes, GCancellable *cancellable, GList **unlocked, @@ -345,11 +345,11 @@ gsecret_service_search_sync (GSecretService *self, gchar **locked_paths = NULL; gboolean ret; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - if (!gsecret_service_search_for_paths_sync (self, attributes, cancellable, + if (!secret_service_search_for_paths_sync (self, attributes, cancellable, unlocked ? &unlocked_paths : NULL, locked ? &locked_paths : NULL, error)) return FALSE; @@ -413,7 +413,7 @@ on_get_secrets_session (GObject *source, GError *error = NULL; const gchar *session; - session = gsecret_service_ensure_session_finish (GSECRET_SERVICE (source), + session = secret_service_ensure_session_finish (SECRET_SERVICE (source), result, &error); if (error != NULL) { g_simple_async_result_take_error (res, error); @@ -430,7 +430,7 @@ on_get_secrets_session (GObject *source, } void -gsecret_service_get_secret_for_path (GSecretService *self, +secret_service_get_secret_for_path (SecretService *self, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -439,39 +439,39 @@ gsecret_service_get_secret_for_path (GSecretService *self, GSimpleAsyncResult *res; GetClosure *closure; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (object_path != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_get_secret_for_path); + secret_service_get_secret_for_path); closure = g_slice_new0 (GetClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; closure->in = g_variant_ref_sink (g_variant_new_objv (&object_path, 1)); g_simple_async_result_set_op_res_gpointer (res, closure, get_closure_free); - gsecret_service_ensure_session (self, cancellable, + secret_service_ensure_session (self, cancellable, on_get_secrets_session, g_object_ref (res)); g_object_unref (res); } -static GSecretValue * -service_decode_get_secrets_first (GSecretService *self, +static SecretValue * +service_decode_get_secrets_first (SecretService *self, GVariant *out) { - GSecretSession *session; - GSecretValue *value = NULL; + SecretSession *session; + SecretValue *value = NULL; GVariantIter *iter; GVariant *variant; const gchar *path; g_variant_get (out, "(a{o(oayays)})", &iter); while (g_variant_iter_next (iter, "{&o@(oayays)}", &path, &variant)) { - session = _gsecret_service_get_session (self); - value = _gsecret_session_decode_secret (session, variant); + session = _secret_service_get_session (self); + value = _secret_session_decode_secret (session, variant); g_variant_unref (variant); break; } @@ -480,22 +480,22 @@ service_decode_get_secrets_first (GSecretService *self, } static GHashTable * -service_decode_get_secrets_all (GSecretService *self, +service_decode_get_secrets_all (SecretService *self, GVariant *out) { - GSecretSession *session; + SecretSession *session; GVariantIter *iter; GVariant *variant; GHashTable *values; - GSecretValue *value; + SecretValue *value; gchar *path; - session = _gsecret_service_get_session (self); + session = _secret_service_get_session (self); values = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, gsecret_value_unref); + g_free, secret_value_unref); g_variant_get (out, "(a{o(oayays)})", &iter); while (g_variant_iter_loop (iter, "{o@(oayays)}", &path, &variant)) { - value = _gsecret_session_decode_secret (session, variant); + value = _secret_session_decode_secret (session, variant); if (value && path) g_hash_table_insert (values, g_strdup (path), value); } @@ -503,17 +503,17 @@ service_decode_get_secrets_all (GSecretService *self, return values; } -GSecretValue * -gsecret_service_get_secret_for_path_finish (GSecretService *self, +SecretValue * +secret_service_get_secret_for_path_finish (SecretService *self, GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; GetClosure *closure; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_service_get_secret_for_path), NULL); + secret_service_get_secret_for_path), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -524,38 +524,38 @@ gsecret_service_get_secret_for_path_finish (GSecretService *self, return service_decode_get_secrets_first (self, closure->out); } -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) { - GSecretSync *sync; - GSecretValue *value; + SecretSync *sync; + SecretValue *value; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), 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_service_get_secret_for_path (self, object_path, cancellable, - _gsecret_sync_on_result, sync); + secret_service_get_secret_for_path (self, object_path, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - value = gsecret_service_get_secret_for_path_finish (self, sync->result, error); + value = secret_service_get_secret_for_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return value; } void -gsecret_service_get_secrets_for_paths (GSecretService *self, +secret_service_get_secrets_for_paths (SecretService *self, const gchar **object_paths, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -564,19 +564,19 @@ gsecret_service_get_secrets_for_paths (GSecretService *self, GSimpleAsyncResult *res; GetClosure *closure; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (object_paths != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_get_secret_for_path); + secret_service_get_secret_for_path); closure = g_slice_new0 (GetClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; closure->in = g_variant_ref_sink (g_variant_new_objv (object_paths, -1)); g_simple_async_result_set_op_res_gpointer (res, closure, get_closure_free); - gsecret_service_ensure_session (self, cancellable, + secret_service_ensure_session (self, cancellable, on_get_secrets_session, g_object_ref (res)); @@ -584,16 +584,16 @@ gsecret_service_get_secrets_for_paths (GSecretService *self, } GHashTable * -gsecret_service_get_secrets_for_paths_finish (GSecretService *self, +secret_service_get_secrets_for_paths_finish (SecretService *self, GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; GetClosure *closure; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_service_get_secret_for_path), NULL); + secret_service_get_secret_for_path), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -605,36 +605,36 @@ gsecret_service_get_secrets_for_paths_finish (GSecretService *self, } GHashTable * -gsecret_service_get_secrets_for_paths_sync (GSecretService *self, +secret_service_get_secrets_for_paths_sync (SecretService *self, const gchar **object_paths, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; GHashTable *secrets; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), 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_service_get_secrets_for_paths (self, object_paths, cancellable, - _gsecret_sync_on_result, sync); + secret_service_get_secrets_for_paths (self, object_paths, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - secrets = gsecret_service_get_secrets_for_paths_finish (self, sync->result, error); + secrets = secret_service_get_secrets_for_paths_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return secrets; } void -gsecret_service_get_secrets (GSecretService *self, +secret_service_get_secrets (SecretService *self, GList *items, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -646,11 +646,11 @@ gsecret_service_get_secrets (GSecretService *self, const gchar *path; GList *l; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_get_secrets); + secret_service_get_secrets); closure = g_slice_new0 (GetClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; closure->items = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -669,7 +669,7 @@ gsecret_service_get_secrets (GSecretService *self, g_ptr_array_free (paths, TRUE); g_simple_async_result_set_op_res_gpointer (res, closure, get_closure_free); - gsecret_service_ensure_session (self, cancellable, + secret_service_ensure_session (self, cancellable, on_get_secrets_session, g_object_ref (res)); @@ -677,7 +677,7 @@ gsecret_service_get_secrets (GSecretService *self, } GHashTable * -gsecret_service_get_secrets_finish (GSecretService *self, +secret_service_get_secrets_finish (SecretService *self, GAsyncResult *result, GError **error) { @@ -687,12 +687,12 @@ gsecret_service_get_secrets_finish (GSecretService *self, GHashTable *with_items; GHashTableIter iter; const gchar *path; - GSecretValue *value; - GSecretItem *item; + SecretValue *value; + SecretItem *item; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_service_get_secrets), NULL); + secret_service_get_secrets), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -704,14 +704,14 @@ gsecret_service_get_secrets_finish (GSecretService *self, g_return_val_if_fail (with_paths != NULL, NULL); with_items = g_hash_table_new_full (g_direct_hash, g_direct_equal, - g_object_unref, gsecret_value_unref); + g_object_unref, secret_value_unref); g_hash_table_iter_init (&iter, with_paths); while (g_hash_table_iter_next (&iter, (gpointer *)&path, (gpointer *)&value)) { item = g_hash_table_lookup (closure->items, path); if (item != NULL) g_hash_table_insert (with_items, g_object_ref (item), - gsecret_value_ref (value)); + secret_value_ref (value)); } g_hash_table_unref (with_paths); @@ -719,37 +719,37 @@ gsecret_service_get_secrets_finish (GSecretService *self, } GHashTable * -gsecret_service_get_secrets_sync (GSecretService *self, +secret_service_get_secrets_sync (SecretService *self, GList *items, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; GHashTable *secrets; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), 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_service_get_secrets (self, items, cancellable, - _gsecret_sync_on_result, sync); + secret_service_get_secrets (self, items, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - secrets = gsecret_service_get_secrets_finish (self, sync->result, error); + secrets = secret_service_get_secrets_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return secrets; } typedef struct { GCancellable *cancellable; - GSecretPrompt *prompt; + SecretPrompt *prompt; GHashTable *objects; GPtrArray *xlocked; } XlockClosure; @@ -774,19 +774,19 @@ on_xlock_prompted (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); XlockClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (source); + SecretService *self = SECRET_SERVICE (source); GError *error = NULL; GVariantIter iter; GVariant *retval; gchar *path; gboolean ret; - ret = gsecret_service_prompt_finish (self, result, &error); + ret = secret_service_prompt_finish (self, result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); if (ret) { - retval = gsecret_prompt_get_result_value (closure->prompt, G_VARIANT_TYPE ("ao")); + retval = secret_prompt_get_result_value (closure->prompt, G_VARIANT_TYPE ("ao")); g_variant_iter_init (&iter, retval); while (g_variant_iter_loop (&iter, "o", &path)) g_ptr_array_add (closure->xlocked, g_strdup (path)); @@ -804,7 +804,7 @@ on_xlock_called (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); XlockClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (g_async_result_get_source_object (user_data)); + SecretService *self = SECRET_SERVICE (g_async_result_get_source_object (user_data)); const gchar *prompt = NULL; gchar **xlocked = NULL; GError *error = NULL; @@ -819,14 +819,14 @@ on_xlock_called (GObject *source, } else { g_variant_get (retval, "(^ao&o)", &xlocked, &prompt); - if (_gsecret_util_empty_path (prompt)) { + if (_secret_util_empty_path (prompt)) { for (i = 0; xlocked[i]; i++) g_ptr_array_add (closure->xlocked, g_strdup (xlocked[i])); g_simple_async_result_complete (res); } else { - closure->prompt = gsecret_prompt_instance (self, prompt); - gsecret_service_prompt (self, closure->prompt, closure->cancellable, + closure->prompt = secret_prompt_instance (self, prompt); + secret_service_prompt (self, closure->prompt, closure->cancellable, on_xlock_prompted, g_object_ref (res)); } @@ -839,7 +839,7 @@ on_xlock_called (GObject *source, } static GSimpleAsyncResult * -service_xlock_paths_async (GSecretService *self, +service_xlock_paths_async (SecretService *self, const gchar *method, const gchar **paths, GCancellable *cancellable, @@ -865,7 +865,7 @@ service_xlock_paths_async (GSecretService *self, } static gint -service_xlock_paths_finish (GSecretService *self, +service_xlock_paths_finish (SecretService *self, GAsyncResult *result, gchar ***xlocked, GError **error) @@ -891,7 +891,7 @@ service_xlock_paths_finish (GSecretService *self, } static void -service_xlock_async (GSecretService *self, +service_xlock_async (SecretService *self, const gchar *method, GList *objects, GCancellable *cancellable, @@ -926,7 +926,7 @@ service_xlock_async (GSecretService *self, } static gint -service_xlock_finish (GSecretService *self, +service_xlock_finish (SecretService *self, GAsyncResult *result, GList **xlocked, GError **error) @@ -959,94 +959,94 @@ service_xlock_finish (GSecretService *self, } void -gsecret_service_lock (GSecretService *self, +secret_service_lock (SecretService *self, GList *objects, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); service_xlock_async (self, "Lock", objects, cancellable, callback, user_data); } gint -gsecret_service_lock_finish (GSecretService *self, +secret_service_lock_finish (SecretService *self, GAsyncResult *result, GList **locked, GError **error) { - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); return service_xlock_finish (self, result, locked, error); } gint -gsecret_service_lock_sync (GSecretService *self, +secret_service_lock_sync (SecretService *self, GList *objects, GCancellable *cancellable, GList **locked, GError **error) { - GSecretSync *sync; + SecretSync *sync; gint count; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), -1); + g_return_val_if_fail (SECRET_IS_SERVICE (self), -1); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), -1); g_return_val_if_fail (error == NULL || *error == NULL, -1); - sync = _gsecret_sync_new (); + sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - gsecret_service_lock (self, objects, cancellable, - _gsecret_sync_on_result, sync); + secret_service_lock (self, objects, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - count = gsecret_service_lock_finish (self, sync->result, locked, error); + count = secret_service_lock_finish (self, sync->result, locked, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return count; } gint -gsecret_service_lock_paths_sync (GSecretService *self, +secret_service_lock_paths_sync (SecretService *self, const gchar **paths, GCancellable *cancellable, gchar ***locked, GError **error) { - GSecretSync *sync; + SecretSync *sync; gint count; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), -1); + g_return_val_if_fail (SECRET_IS_SERVICE (self), -1); g_return_val_if_fail (paths != NULL, -1); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), -1); g_return_val_if_fail (error == NULL || *error == NULL, -1); - sync = _gsecret_sync_new (); + sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - gsecret_service_lock_paths (self, paths, cancellable, - _gsecret_sync_on_result, sync); + secret_service_lock_paths (self, paths, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - count = gsecret_service_lock_paths_finish (self, sync->result, + count = secret_service_lock_paths_finish (self, sync->result, locked, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return count; } void -gsecret_service_lock_paths (GSecretService *self, +secret_service_lock_paths (SecretService *self, const gchar **paths, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -1054,7 +1054,7 @@ gsecret_service_lock_paths (GSecretService *self, { GSimpleAsyncResult *res; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (paths != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); @@ -1065,12 +1065,12 @@ gsecret_service_lock_paths (GSecretService *self, } gint -gsecret_service_lock_paths_finish (GSecretService *self, +secret_service_lock_paths_finish (SecretService *self, GAsyncResult *result, gchar ***unlocked, GError **error) { - g_return_val_if_fail (GSECRET_IS_SERVICE (self), -1); + g_return_val_if_fail (SECRET_IS_SERVICE (self), -1); g_return_val_if_fail (unlocked != NULL, -1); g_return_val_if_fail (error == NULL || *error == NULL, -1); @@ -1078,40 +1078,40 @@ gsecret_service_lock_paths_finish (GSecretService *self, } gint -gsecret_service_unlock_paths_sync (GSecretService *self, +secret_service_unlock_paths_sync (SecretService *self, const gchar **paths, GCancellable *cancellable, gchar ***unlocked, GError **error) { - GSecretSync *sync; + SecretSync *sync; gint count; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), -1); + g_return_val_if_fail (SECRET_IS_SERVICE (self), -1); g_return_val_if_fail (paths != NULL, -1); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), -1); g_return_val_if_fail (unlocked != NULL, -1); g_return_val_if_fail (error == NULL || *error == NULL, -1); - sync = _gsecret_sync_new (); + sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - gsecret_service_unlock_paths (self, paths, cancellable, - _gsecret_sync_on_result, sync); + secret_service_unlock_paths (self, paths, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - count = gsecret_service_unlock_paths_finish (self, sync->result, + count = secret_service_unlock_paths_finish (self, sync->result, unlocked, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return count; } void -gsecret_service_unlock_paths (GSecretService *self, +secret_service_unlock_paths (SecretService *self, const gchar **paths, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -1119,7 +1119,7 @@ gsecret_service_unlock_paths (GSecretService *self, { GSimpleAsyncResult *res; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (paths != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); @@ -1131,12 +1131,12 @@ gsecret_service_unlock_paths (GSecretService *self, } gint -gsecret_service_unlock_paths_finish (GSecretService *self, +secret_service_unlock_paths_finish (SecretService *self, GAsyncResult *result, gchar ***unlocked, GError **error) { - g_return_val_if_fail (GSECRET_IS_SERVICE (self), -1); + g_return_val_if_fail (SECRET_IS_SERVICE (self), -1); g_return_val_if_fail (error == NULL || *error == NULL, -1); return service_xlock_paths_finish (self, result, @@ -1144,25 +1144,25 @@ gsecret_service_unlock_paths_finish (GSecretService *self, } void -gsecret_service_unlock (GSecretService *self, +secret_service_unlock (SecretService *self, GList *objects, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); service_xlock_async (self, "Unlock", objects, cancellable, callback, user_data); } gint -gsecret_service_unlock_finish (GSecretService *self, +secret_service_unlock_finish (SecretService *self, GAsyncResult *result, GList **unlocked, GError **error) { - g_return_val_if_fail (GSECRET_IS_SERVICE (self), -1); + g_return_val_if_fail (SECRET_IS_SERVICE (self), -1); g_return_val_if_fail (error == NULL || *error == NULL, -1); g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), service_xlock_paths_async), -1); @@ -1171,42 +1171,42 @@ gsecret_service_unlock_finish (GSecretService *self, } gint -gsecret_service_unlock_sync (GSecretService *self, +secret_service_unlock_sync (SecretService *self, GList *objects, GCancellable *cancellable, GList **unlocked, GError **error) { - GSecretSync *sync; + SecretSync *sync; gint count; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), -1); + g_return_val_if_fail (SECRET_IS_SERVICE (self), -1); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), -1); g_return_val_if_fail (error == NULL || *error == NULL, -1); - sync = _gsecret_sync_new (); + sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - gsecret_service_unlock (self, objects, cancellable, - _gsecret_sync_on_result, sync); + secret_service_unlock (self, objects, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - count = gsecret_service_unlock_finish (self, sync->result, + count = secret_service_unlock_finish (self, sync->result, unlocked, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return count; } void -gsecret_service_store (GSecretService *self, - const GSecretSchema *schema, +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, @@ -1215,29 +1215,29 @@ gsecret_service_store (GSecretService *self, GHashTable *attributes; va_list va; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (schema != NULL); g_return_if_fail (collection_path != NULL); g_return_if_fail (label != NULL); g_return_if_fail (value != NULL); 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_service_storev (self, schema, attributes, collection_path, + secret_service_storev (self, schema, attributes, collection_path, label, value, cancellable, callback, user_data); g_hash_table_unref (attributes); } void -gsecret_service_storev (GSecretService *self, - const GSecretSchema *schema, +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) @@ -1245,7 +1245,7 @@ gsecret_service_storev (GSecretService *self, GHashTable *properties; GVariant *propval; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (schema != NULL); g_return_if_fail (attributes != NULL); g_return_if_fail (collection_path != NULL); @@ -1258,47 +1258,47 @@ gsecret_service_storev (GSecretService *self, propval = g_variant_new_string (label); g_hash_table_insert (properties, - GSECRET_ITEM_INTERFACE ".Label", + SECRET_ITEM_INTERFACE ".Label", g_variant_ref_sink (propval)); propval = g_variant_new_string (schema->schema_name); g_hash_table_insert (properties, - GSECRET_ITEM_INTERFACE ".Schema", + SECRET_ITEM_INTERFACE ".Schema", g_variant_ref_sink (propval)); - propval = _gsecret_util_variant_for_attributes (attributes); + propval = _secret_util_variant_for_attributes (attributes); g_hash_table_insert (properties, - GSECRET_ITEM_INTERFACE ".Attributes", + SECRET_ITEM_INTERFACE ".Attributes", g_variant_ref_sink (propval)); - gsecret_service_create_item_path (self, collection_path, properties, value, + secret_service_create_item_path (self, collection_path, properties, value, TRUE, cancellable, callback, user_data); g_hash_table_unref (properties); } gboolean -gsecret_service_store_finish (GSecretService *self, +secret_service_store_finish (SecretService *self, GAsyncResult *result, GError **error) { gchar *path; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - path = gsecret_service_create_item_path_finish (self, result, error); + path = secret_service_create_item_path_finish (self, result, error); g_free (path); return path != NULL; } gboolean -gsecret_service_store_sync (GSecretService *self, - const GSecretSchema *schema, +secret_service_store_sync (SecretService *self, + const SecretSchema *schema, const gchar *collection_path, const gchar *label, - GSecretValue *value, + SecretValue *value, GCancellable *cancellable, GError **error, ...) @@ -1307,7 +1307,7 @@ gsecret_service_store_sync (GSecretService *self, gboolean ret; va_list va; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); g_return_val_if_fail (schema != NULL, FALSE); g_return_val_if_fail (collection_path != NULL, FALSE); g_return_val_if_fail (label != NULL, FALSE); @@ -1316,10 +1316,10 @@ gsecret_service_store_sync (GSecretService *self, 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_service_storev_sync (self, schema, attributes, collection_path, + ret = secret_service_storev_sync (self, schema, attributes, collection_path, label, value, cancellable, error); g_hash_table_unref (attributes); @@ -1328,19 +1328,19 @@ gsecret_service_store_sync (GSecretService *self, } gboolean -gsecret_service_storev_sync (GSecretService *self, - const GSecretSchema *schema, +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) { - GSecretSync *sync; + SecretSync *sync; gboolean ret; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); g_return_val_if_fail (schema != NULL, FALSE); g_return_val_if_fail (attributes != NULL, FALSE); g_return_val_if_fail (collection_path != NULL, FALSE); @@ -1349,24 +1349,24 @@ gsecret_service_storev_sync (GSecretService *self, 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_service_storev (self, schema, attributes, collection_path, - label, value, cancellable, _gsecret_sync_on_result, sync); + secret_service_storev (self, schema, attributes, collection_path, + label, value, cancellable, _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - ret = gsecret_service_store_finish (self, sync->result, error); + ret = secret_service_store_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return ret; } typedef struct { - GSecretValue *value; + SecretValue *value; GCancellable *cancellable; } LookupClosure; @@ -1375,14 +1375,14 @@ lookup_closure_free (gpointer data) { LookupClosure *closure = data; if (closure->value) - gsecret_value_unref (closure->value); + secret_value_unref (closure->value); g_clear_object (&closure->cancellable); g_slice_free (LookupClosure, closure); } void -gsecret_service_lookup (GSecretService *self, - const GSecretSchema *schema, +secret_service_lookup (SecretService *self, + const SecretSchema *schema, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, @@ -1391,15 +1391,15 @@ gsecret_service_lookup (GSecretService *self, GHashTable *attributes; va_list va; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (schema != NULL); 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_service_lookupv (self, attributes, cancellable, callback, user_data); + secret_service_lookupv (self, attributes, cancellable, callback, user_data); g_hash_table_unref (attributes); } @@ -1411,10 +1411,10 @@ on_lookup_get_secret (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); LookupClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (source); + SecretService *self = SECRET_SERVICE (source); GError *error = NULL; - closure->value = gsecret_service_get_secret_for_path_finish (self, result, &error); + closure->value = secret_service_get_secret_for_path_finish (self, result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -1429,18 +1429,18 @@ on_lookup_unlocked (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); LookupClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (source); + SecretService *self = SECRET_SERVICE (source); GError *error = NULL; gchar **unlocked = NULL; - gsecret_service_unlock_paths_finish (GSECRET_SERVICE (source), + secret_service_unlock_paths_finish (SECRET_SERVICE (source), result, &unlocked, &error); if (error != NULL) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); } else if (unlocked && unlocked[0]) { - gsecret_service_get_secret_for_path (self, unlocked[0], + secret_service_get_secret_for_path (self, unlocked[0], closure->cancellable, on_lookup_get_secret, g_object_ref (res)); @@ -1460,25 +1460,25 @@ on_lookup_searched (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); LookupClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (source); + SecretService *self = SECRET_SERVICE (source); GError *error = NULL; gchar **unlocked = NULL; gchar **locked = NULL; - gsecret_service_search_for_paths_finish (self, result, &unlocked, &locked, &error); + secret_service_search_for_paths_finish (self, result, &unlocked, &locked, &error); if (error != NULL) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); } else if (unlocked && unlocked[0]) { - gsecret_service_get_secret_for_path (self, unlocked[0], + secret_service_get_secret_for_path (self, unlocked[0], closure->cancellable, on_lookup_get_secret, g_object_ref (res)); } else if (locked && locked[0]) { const gchar *paths[] = { locked[0], NULL }; - gsecret_service_unlock_paths (self, paths, + secret_service_unlock_paths (self, paths, closure->cancellable, on_lookup_unlocked, g_object_ref (res)); @@ -1493,7 +1493,7 @@ on_lookup_searched (GObject *source, } void -gsecret_service_lookupv (GSecretService *self, +secret_service_lookupv (SecretService *self, GHashTable *attributes, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -1502,35 +1502,35 @@ gsecret_service_lookupv (GSecretService *self, GSimpleAsyncResult *res; LookupClosure *closure; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (attributes != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_lookupv); + secret_service_lookupv); closure = g_slice_new0 (LookupClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; g_simple_async_result_set_op_res_gpointer (res, closure, lookup_closure_free); - gsecret_service_search_for_paths (self, attributes, cancellable, + secret_service_search_for_paths (self, attributes, cancellable, on_lookup_searched, g_object_ref (res)); g_object_unref (res); } -GSecretValue * -gsecret_service_lookup_finish (GSecretService *self, +SecretValue * +secret_service_lookup_finish (SecretService *self, GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; LookupClosure *closure; - GSecretValue *value; + SecretValue *value; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_service_lookupv), NULL); + secret_service_lookupv), NULL); res = G_SIMPLE_ASYNC_RESULT (result); if (g_simple_async_result_propagate_error (res, error)) @@ -1542,64 +1542,64 @@ gsecret_service_lookup_finish (GSecretService *self, return value; } -GSecretValue * -gsecret_service_lookup_sync (GSecretService *self, - const GSecretSchema *schema, +SecretValue * +secret_service_lookup_sync (SecretService *self, + const SecretSchema *schema, GCancellable *cancellable, GError **error, ...) { GHashTable *attributes; - GSecretValue *value; + SecretValue *value; va_list va; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (schema != NULL, NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); va_start (va, error); - attributes = _gsecret_util_attributes_for_varargs (schema, va); + attributes = _secret_util_attributes_for_varargs (schema, va); va_end (va); - value = gsecret_service_lookupv_sync (self, attributes, cancellable, error); + value = secret_service_lookupv_sync (self, attributes, cancellable, error); g_hash_table_unref (attributes); return value; } -GSecretValue * -gsecret_service_lookupv_sync (GSecretService *self, +SecretValue * +secret_service_lookupv_sync (SecretService *self, GHashTable *attributes, GCancellable *cancellable, GError **error) { - GSecretSync *sync; - GSecretValue *value; + SecretSync *sync; + SecretValue *value; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (attributes != NULL, NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); - sync = _gsecret_sync_new (); + sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - gsecret_service_lookupv (self, attributes, cancellable, - _gsecret_sync_on_result, sync); + secret_service_lookupv (self, attributes, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - value = gsecret_service_lookup_finish (self, sync->result, error); + value = secret_service_lookup_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return value; } typedef struct { GCancellable *cancellable; - GSecretPrompt *prompt; + SecretPrompt *prompt; gboolean deleted; } DeleteClosure; @@ -1621,7 +1621,7 @@ on_delete_prompted (GObject *source, DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (res); GError *error = NULL; - gsecret_service_prompt_finish (GSECRET_SERVICE (source), result, &error); + secret_service_prompt_finish (SECRET_SERVICE (source), result, &error); if (error == NULL) closure->deleted = TRUE; @@ -1639,7 +1639,7 @@ on_delete_complete (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (g_async_result_get_source_object (user_data)); + SecretService *self = SECRET_SERVICE (g_async_result_get_source_object (user_data)); const gchar *prompt_path; GError *error = NULL; GVariant *retval; @@ -1648,14 +1648,14 @@ on_delete_complete (GObject *source, if (error == NULL) { g_variant_get (retval, "(&o)", &prompt_path); - if (_gsecret_util_empty_path (prompt_path)) { + if (_secret_util_empty_path (prompt_path)) { closure->deleted = TRUE; g_simple_async_result_complete (res); } else { - closure->prompt = gsecret_prompt_instance (self, prompt_path); + closure->prompt = secret_prompt_instance (self, prompt_path); - gsecret_service_prompt (self, closure->prompt, + secret_service_prompt (self, closure->prompt, closure->cancellable, on_delete_prompted, g_object_ref (res)); @@ -1673,7 +1673,7 @@ on_delete_complete (GObject *source, } void -_gsecret_service_delete_path (GSecretService *self, +_secret_service_delete_path (SecretService *self, const gchar *object_path, gboolean is_an_item, GCancellable *cancellable, @@ -1683,19 +1683,19 @@ _gsecret_service_delete_path (GSecretService *self, GSimpleAsyncResult *res; DeleteClosure *closure; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (object_path != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - _gsecret_service_delete_path); + _secret_service_delete_path); closure = g_slice_new0 (DeleteClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; g_simple_async_result_set_op_res_gpointer (res, closure, delete_closure_free); g_dbus_connection_call (g_dbus_proxy_get_connection (G_DBUS_PROXY (self)), g_dbus_proxy_get_name (G_DBUS_PROXY (self)), object_path, - is_an_item ? GSECRET_ITEM_INTERFACE : GSECRET_COLLECTION_INTERFACE, + is_an_item ? SECRET_ITEM_INTERFACE : SECRET_COLLECTION_INTERFACE, "Delete", g_variant_new ("()"), G_VARIANT_TYPE ("(o)"), G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, cancellable, on_delete_complete, g_object_ref (res)); @@ -1704,31 +1704,31 @@ _gsecret_service_delete_path (GSecretService *self, } void -gsecret_service_delete_path (GSecretService *self, +secret_service_delete_path (SecretService *self, const gchar *item_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (item_path != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); - _gsecret_service_delete_path (self, item_path, TRUE, cancellable, callback, user_data); + _secret_service_delete_path (self, item_path, TRUE, cancellable, callback, user_data); } gboolean -gsecret_service_delete_path_finish (GSecretService *self, +secret_service_delete_path_finish (SecretService *self, GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; DeleteClosure *closure; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (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_service_delete_path), FALSE); + _secret_service_delete_path), FALSE); res = G_SIMPLE_ASYNC_RESULT (result); if (g_simple_async_result_propagate_error (res, error)) @@ -1739,31 +1739,31 @@ gsecret_service_delete_path_finish (GSecretService *self, } gboolean -gsecret_service_delete_path_sync (GSecretService *self, +secret_service_delete_path_sync (SecretService *self, const gchar *object_path, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; gboolean result; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); g_return_val_if_fail (object_path != 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_service_delete_path (self, object_path, cancellable, - _gsecret_sync_on_result, sync); + secret_service_delete_path (self, object_path, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - result = gsecret_service_delete_path_finish (self, sync->result, error); + result = secret_service_delete_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return result; } @@ -1774,11 +1774,11 @@ on_delete_password_complete (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretService *self = GSECRET_SERVICE (g_async_result_get_source_object (user_data)); + SecretService *self = SECRET_SERVICE (g_async_result_get_source_object (user_data)); DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (res); GError *error = NULL; - closure->deleted = gsecret_service_delete_path_finish (self, result, &error); + closure->deleted = secret_service_delete_path_finish (self, result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -1795,13 +1795,13 @@ on_search_delete_password (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (g_async_result_get_source_object (user_data)); + SecretService *self = SECRET_SERVICE (g_async_result_get_source_object (user_data)); const gchar *path = NULL; GError *error = NULL; gchar **locked; gchar **unlocked; - gsecret_service_search_for_paths_finish (self, result, &unlocked, &locked, &error); + secret_service_search_for_paths_finish (self, result, &unlocked, &locked, &error); if (error != NULL) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); @@ -1821,7 +1821,7 @@ on_search_delete_password (GObject *source, /* Delete the first path */ } else { closure->deleted = TRUE; - _gsecret_service_delete_path (self, path, TRUE, + _secret_service_delete_path (self, path, TRUE, closure->cancellable, on_delete_password_complete, g_object_ref (res)); @@ -1835,8 +1835,8 @@ on_search_delete_password (GObject *source, } void -gsecret_service_remove (GSecretService *self, - const GSecretSchema *schema, +secret_service_remove (SecretService *self, + const SecretSchema *schema, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, @@ -1845,22 +1845,22 @@ gsecret_service_remove (GSecretService *self, GHashTable *attributes; va_list va; - g_return_if_fail (GSECRET_SERVICE (self)); + g_return_if_fail (SECRET_SERVICE (self)); g_return_if_fail (schema != NULL); 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_service_removev (self, attributes, cancellable, + secret_service_removev (self, attributes, cancellable, callback, user_data); g_hash_table_unref (attributes); } void -gsecret_service_removev (GSecretService *self, +secret_service_removev (SecretService *self, GHashTable *attributes, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -1869,34 +1869,34 @@ gsecret_service_removev (GSecretService *self, GSimpleAsyncResult *res; DeleteClosure *closure; - g_return_if_fail (GSECRET_SERVICE (self)); + g_return_if_fail (SECRET_SERVICE (self)); g_return_if_fail (attributes != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_remove); + secret_service_remove); closure = g_slice_new0 (DeleteClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; g_simple_async_result_set_op_res_gpointer (res, closure, delete_closure_free); - gsecret_service_search_for_paths (self, attributes, cancellable, + secret_service_search_for_paths (self, attributes, cancellable, on_search_delete_password, g_object_ref (res)); g_object_unref (res); } gboolean -gsecret_service_remove_finish (GSecretService *self, +secret_service_remove_finish (SecretService *self, GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; DeleteClosure *closure; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (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_service_remove), FALSE); + secret_service_remove), FALSE); res = G_SIMPLE_ASYNC_RESULT (result); if (g_simple_async_result_propagate_error (res, error)) @@ -1907,8 +1907,8 @@ gsecret_service_remove_finish (GSecretService *self, } gboolean -gsecret_service_remove_sync (GSecretService *self, - const GSecretSchema* schema, +secret_service_remove_sync (SecretService *self, + const SecretSchema* schema, GCancellable *cancellable, GError **error, ...) @@ -1917,15 +1917,15 @@ gsecret_service_remove_sync (GSecretService *self, gboolean result; va_list va; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); 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_service_removev_sync (self, attributes, cancellable, error); + result = secret_service_removev_sync (self, attributes, cancellable, error); g_hash_table_unref (attributes); @@ -1933,37 +1933,37 @@ gsecret_service_remove_sync (GSecretService *self, } gboolean -gsecret_service_removev_sync (GSecretService *self, +secret_service_removev_sync (SecretService *self, GHashTable *attributes, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; gboolean result; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), 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_service_removev (self, attributes, cancellable, - _gsecret_sync_on_result, sync); + secret_service_removev (self, attributes, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - result = gsecret_service_remove_finish (self, sync->result, error); + result = secret_service_remove_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return result; } typedef struct { GCancellable *cancellable; - GSecretPrompt *prompt; + SecretPrompt *prompt; gchar *collection_path; } CollectionClosure; @@ -1987,12 +1987,12 @@ on_create_collection_prompt (GObject *source, gboolean created; GVariant *value; - created = gsecret_service_prompt_finish (GSECRET_SERVICE (source), result, &error); + created = secret_service_prompt_finish (SECRET_SERVICE (source), result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); if (created) { - value = gsecret_prompt_get_result_value (closure->prompt, G_VARIANT_TYPE ("o")); + value = secret_prompt_get_result_value (closure->prompt, G_VARIANT_TYPE ("o")); closure->collection_path = g_variant_dup_string (value, NULL); g_variant_unref (value); } @@ -2008,7 +2008,7 @@ on_create_collection_called (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); CollectionClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (g_async_result_get_source_object (user_data)); + SecretService *self = SECRET_SERVICE (g_async_result_get_source_object (user_data)); const gchar *prompt_path = NULL; const gchar *collection_path = NULL; GError *error = NULL; @@ -2017,9 +2017,9 @@ on_create_collection_called (GObject *source, retval = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source), result, &error); if (error == NULL) { g_variant_get (retval, "(&o&o)", &collection_path, &prompt_path); - if (!_gsecret_util_empty_path (prompt_path)) { - closure->prompt = gsecret_prompt_instance (self, prompt_path); - gsecret_service_prompt (self, closure->prompt, + if (!_secret_util_empty_path (prompt_path)) { + closure->prompt = secret_prompt_instance (self, prompt_path); + secret_service_prompt (self, closure->prompt, closure->cancellable, on_create_collection_prompt, g_object_ref (res)); @@ -2040,7 +2040,7 @@ on_create_collection_called (GObject *source, } void -gsecret_service_create_collection_path (GSecretService *self, +secret_service_create_collection_path (SecretService *self, GHashTable *properties, const gchar *alias, GCancellable *cancellable, @@ -2053,7 +2053,7 @@ gsecret_service_create_collection_path (GSecretService *self, GVariant *props; GDBusProxy *proxy; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (properties != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); @@ -2061,19 +2061,19 @@ gsecret_service_create_collection_path (GSecretService *self, alias = ""; res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_create_collection_path); + secret_service_create_collection_path); closure = g_slice_new0 (CollectionClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; g_simple_async_result_set_op_res_gpointer (res, closure, collection_closure_free); - props = _gsecret_util_variant_for_properties (properties); + props = _secret_util_variant_for_properties (properties); params = g_variant_new ("(@a{sv}s)", props, alias); proxy = G_DBUS_PROXY (self); g_dbus_connection_call (g_dbus_proxy_get_connection (proxy), g_dbus_proxy_get_name (proxy), g_dbus_proxy_get_object_path (proxy), - GSECRET_SERVICE_INTERFACE, + SECRET_SERVICE_INTERFACE, "CreateCollection", params, G_VARIANT_TYPE ("(oo)"), G_DBUS_CALL_FLAGS_NONE, -1, closure->cancellable, @@ -2085,7 +2085,7 @@ gsecret_service_create_collection_path (GSecretService *self, } gchar * -gsecret_service_create_collection_path_finish (GSecretService *self, +secret_service_create_collection_path_finish (SecretService *self, GAsyncResult *result, GError **error) { @@ -2094,7 +2094,7 @@ gsecret_service_create_collection_path_finish (GSecretService *self, gchar *path; g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_service_create_collection_path), NULL); + secret_service_create_collection_path), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -2109,32 +2109,32 @@ gsecret_service_create_collection_path_finish (GSecretService *self, } gchar * -gsecret_service_create_collection_path_sync (GSecretService *self, +secret_service_create_collection_path_sync (SecretService *self, GHashTable *properties, const gchar *alias, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; gchar *path; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (properties != 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_service_create_collection_path (self, properties, alias, cancellable, - _gsecret_sync_on_result, sync); + secret_service_create_collection_path (self, properties, alias, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - path = gsecret_service_create_collection_path_finish (self, sync->result, error); + path = secret_service_create_collection_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return path; } @@ -2142,10 +2142,10 @@ gsecret_service_create_collection_path_sync (GSecretService *self, typedef struct { GCancellable *cancellable; GVariant *properties; - GSecretValue *value; + SecretValue *value; gboolean replace; gchar *collection_path; - GSecretPrompt *prompt; + SecretPrompt *prompt; gchar *item_path; } ItemClosure; @@ -2154,7 +2154,7 @@ item_closure_free (gpointer data) { ItemClosure *closure = data; g_variant_unref (closure->properties); - gsecret_value_unref (closure->value); + secret_value_unref (closure->value); g_clear_object (&closure->cancellable); g_free (closure->collection_path); g_clear_object (&closure->prompt); @@ -2172,12 +2172,12 @@ on_create_item_prompt (GObject *source, gboolean created; GVariant *value; - created = gsecret_service_prompt_finish (GSECRET_SERVICE (source), result, &error); + created = secret_service_prompt_finish (SECRET_SERVICE (source), result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); if (created) { - value = gsecret_prompt_get_result_value (closure->prompt, G_VARIANT_TYPE ("o")); + value = secret_prompt_get_result_value (closure->prompt, G_VARIANT_TYPE ("o")); closure->item_path = g_variant_dup_string (value, NULL); g_variant_unref (value); } @@ -2193,7 +2193,7 @@ on_create_item_called (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); ItemClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (g_async_result_get_source_object (user_data)); + SecretService *self = SECRET_SERVICE (g_async_result_get_source_object (user_data)); const gchar *prompt_path = NULL; const gchar *item_path = NULL; GError *error = NULL; @@ -2202,9 +2202,9 @@ on_create_item_called (GObject *source, retval = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source), result, &error); if (error == NULL) { g_variant_get (retval, "(&o&o)", &item_path, &prompt_path); - if (!_gsecret_util_empty_path (prompt_path)) { - closure->prompt = gsecret_prompt_instance (self, prompt_path); - gsecret_service_prompt (self, closure->prompt, + if (!_secret_util_empty_path (prompt_path)) { + closure->prompt = secret_prompt_instance (self, prompt_path); + secret_service_prompt (self, closure->prompt, closure->cancellable, on_create_item_prompt, g_object_ref (res)); @@ -2231,25 +2231,25 @@ on_create_item_session (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); ItemClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (source); - GSecretSession *session; + SecretService *self = SECRET_SERVICE (source); + SecretSession *session; GVariant *params; GError *error = NULL; GDBusProxy *proxy; - gsecret_service_ensure_session_finish (self, result, &error); + secret_service_ensure_session_finish (self, result, &error); if (error == NULL) { - session = _gsecret_service_get_session (self); + session = _secret_service_get_session (self); params = g_variant_new ("(@a{sv}@(oayays)b)", closure->properties, - _gsecret_session_encode_secret (session, closure->value), + _secret_session_encode_secret (session, closure->value), closure->replace); proxy = G_DBUS_PROXY (self); g_dbus_connection_call (g_dbus_proxy_get_connection (proxy), g_dbus_proxy_get_name (proxy), closure->collection_path, - GSECRET_COLLECTION_INTERFACE, + SECRET_COLLECTION_INTERFACE, "CreateItem", params, G_VARIANT_TYPE ("(oo)"), G_DBUS_CALL_FLAGS_NONE, -1, closure->cancellable, @@ -2264,10 +2264,10 @@ on_create_item_session (GObject *source, } void -gsecret_service_create_item_path (GSecretService *self, +secret_service_create_item_path (SecretService *self, const gchar *collection_path, GHashTable *properties, - GSecretValue *value, + SecretValue *value, gboolean replace, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -2276,23 +2276,23 @@ gsecret_service_create_item_path (GSecretService *self, GSimpleAsyncResult *res; ItemClosure *closure; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (properties != NULL); g_return_if_fail (value != NULL); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_create_item_path); + secret_service_create_item_path); closure = g_slice_new0 (ItemClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; - closure->properties = _gsecret_util_variant_for_properties (properties); + closure->properties = _secret_util_variant_for_properties (properties); g_variant_ref_sink (closure->properties); closure->replace = replace; - closure->value = gsecret_value_ref (value); + closure->value = secret_value_ref (value); closure->collection_path = g_strdup (collection_path); g_simple_async_result_set_op_res_gpointer (res, closure, item_closure_free); - gsecret_service_ensure_session (self, cancellable, + secret_service_ensure_session (self, cancellable, on_create_item_session, g_object_ref (res)); @@ -2300,7 +2300,7 @@ gsecret_service_create_item_path (GSecretService *self, } gchar * -gsecret_service_create_item_path_finish (GSecretService *self, +secret_service_create_item_path_finish (SecretService *self, GAsyncResult *result, GError **error) { @@ -2309,7 +2309,7 @@ gsecret_service_create_item_path_finish (GSecretService *self, gchar *path; g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_service_create_item_path), NULL); + secret_service_create_item_path), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -2324,34 +2324,34 @@ gsecret_service_create_item_path_finish (GSecretService *self, } gchar * -gsecret_service_create_item_path_sync (GSecretService *self, +secret_service_create_item_path_sync (SecretService *self, const gchar *collection_path, GHashTable *properties, - GSecretValue *value, + SecretValue *value, gboolean replace, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; gchar *path; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (properties != 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_service_create_item_path (self, collection_path, properties, value, replace, - cancellable, _gsecret_sync_on_result, sync); + secret_service_create_item_path (self, collection_path, properties, value, replace, + cancellable, _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - path = gsecret_service_create_item_path_finish (self, sync->result, error); + path = secret_service_create_item_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return path; } diff --git a/library/gsecret-password.c b/library/secret-password.c similarity index 77% rename from library/gsecret-password.c rename to library/secret-password.c index cbe75c6..069f1be 100644 --- a/library/gsecret-password.c +++ b/library/secret-password.c @@ -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 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; diff --git a/library/gsecret-password.h b/library/secret-password.h similarity index 76% rename from library/gsecret-password.h rename to library/secret-password.h index ff27e19..db100dd 100644 --- a/library/gsecret-password.h +++ b/library/secret-password.h @@ -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 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 diff --git a/library/gsecret-private.h b/library/secret-private.h similarity index 51% rename from library/gsecret-private.h rename to library/secret-private.h index ba24361..4c1acab 100644 --- a/library/gsecret-private.h +++ b/library/secret-private.h @@ -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 -#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 diff --git a/library/gsecret-prompt.c b/library/secret-prompt.c similarity index 81% rename from library/gsecret-prompt.c rename to library/secret-prompt.c index d058f94..0309e22 100644 --- a/library/gsecret-prompt.c +++ b/library/secret-prompt.c @@ -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 #include #include -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) diff --git a/library/gsecret-prompt.h b/library/secret-prompt.h similarity index 53% rename from library/gsecret-prompt.h rename to library/secret-prompt.h index d286dbf..a0767e9 100644 --- a/library/gsecret-prompt.h +++ b/library/secret-prompt.h @@ -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 -#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 diff --git a/library/gsecret-service.c b/library/secret-service.c similarity index 65% rename from library/gsecret-service.c rename to library/secret-service.c index 90e2431..e7769f8 100644 --- a/library/gsecret-service.c +++ b/library/secret-service.c @@ -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,20 +13,20 @@ #include "config.h" -#include "gsecret-collection.h" -#include "gsecret-dbus-generated.h" -#include "gsecret-enum-types.h" -#include "gsecret-item.h" -#include "gsecret-private.h" -#include "gsecret-service.h" -#include "gsecret-types.h" -#include "gsecret-value.h" +#include "secret-collection.h" +#include "secret-dbus-generated.h" +#include "secret-enum-types.h" +#include "secret-item.h" +#include "secret-private.h" +#include "secret-service.h" +#include "secret-types.h" +#include "secret-value.h" #include "egg/egg-secure-memory.h" EGG_SECURE_GLIB_DEFINITIONS (); -static const gchar *default_bus_name = GSECRET_SERVICE_BUS_NAME; +static const gchar *default_bus_name = SECRET_SERVICE_BUS_NAME; enum { PROP_0, @@ -34,57 +34,57 @@ enum { PROP_COLLECTIONS }; -typedef struct _GSecretServicePrivate { +typedef struct _SecretServicePrivate { /* No change between construct and finalize */ GCancellable *cancellable; - GSecretServiceFlags init_flags; + SecretServiceFlags init_flags; /* Locked by mutex */ GMutex mutex; gpointer session; GHashTable *collections; -} GSecretServicePrivate; +} SecretServicePrivate; G_LOCK_DEFINE (service_instance); static gpointer service_instance = NULL; -static GInitableIface *gsecret_service_initable_parent_iface = NULL; +static GInitableIface *secret_service_initable_parent_iface = NULL; -static GAsyncInitableIface *gsecret_service_async_initable_parent_iface = NULL; +static GAsyncInitableIface *secret_service_async_initable_parent_iface = NULL; -static void gsecret_service_initable_iface (GInitableIface *iface); +static void secret_service_initable_iface (GInitableIface *iface); -static void gsecret_service_async_initable_iface (GAsyncInitableIface *iface); +static void secret_service_async_initable_iface (GAsyncInitableIface *iface); -G_DEFINE_TYPE_WITH_CODE (GSecretService, gsecret_service, G_TYPE_DBUS_PROXY, - G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gsecret_service_initable_iface); - G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, gsecret_service_async_initable_iface); +G_DEFINE_TYPE_WITH_CODE (SecretService, secret_service, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, secret_service_initable_iface); + G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, secret_service_async_initable_iface); ); static void -gsecret_service_init (GSecretService *self) +secret_service_init (SecretService *self) { - self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GSECRET_TYPE_SERVICE, - GSecretServicePrivate); + self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SECRET_TYPE_SERVICE, + SecretServicePrivate); g_mutex_init (&self->pv->mutex); self->pv->cancellable = g_cancellable_new (); } static void -gsecret_service_get_property (GObject *obj, +secret_service_get_property (GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) { - GSecretService *self = GSECRET_SERVICE (obj); + SecretService *self = SECRET_SERVICE (obj); switch (prop_id) { case PROP_FLAGS: - g_value_set_flags (value, gsecret_service_get_flags (self)); + g_value_set_flags (value, secret_service_get_flags (self)); break; case PROP_COLLECTIONS: - g_value_take_boxed (value, gsecret_service_get_collections (self)); + g_value_take_boxed (value, secret_service_get_collections (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); @@ -93,12 +93,12 @@ gsecret_service_get_property (GObject *obj, } static void -gsecret_service_set_property (GObject *obj, +secret_service_set_property (GObject *obj, guint prop_id, const GValue *value, GParamSpec *pspec) { - GSecretService *self = GSECRET_SERVICE (obj); + SecretService *self = SECRET_SERVICE (obj); switch (prop_id) { case PROP_FLAGS: @@ -111,35 +111,35 @@ gsecret_service_set_property (GObject *obj, } static void -gsecret_service_dispose (GObject *obj) +secret_service_dispose (GObject *obj) { - GSecretService *self = GSECRET_SERVICE (obj); + SecretService *self = SECRET_SERVICE (obj); g_cancellable_cancel (self->pv->cancellable); - G_OBJECT_CLASS (gsecret_service_parent_class)->dispose (obj); + G_OBJECT_CLASS (secret_service_parent_class)->dispose (obj); } static void -gsecret_service_finalize (GObject *obj) +secret_service_finalize (GObject *obj) { - GSecretService *self = GSECRET_SERVICE (obj); + SecretService *self = SECRET_SERVICE (obj); - _gsecret_session_free (self->pv->session); + _secret_session_free (self->pv->session); if (self->pv->collections) g_hash_table_destroy (self->pv->collections); g_clear_object (&self->pv->cancellable); - G_OBJECT_CLASS (gsecret_service_parent_class)->finalize (obj); + G_OBJECT_CLASS (secret_service_parent_class)->finalize (obj); } static gboolean -gsecret_service_real_prompt_sync (GSecretService *self, - GSecretPrompt *prompt, +secret_service_real_prompt_sync (SecretService *self, + SecretPrompt *prompt, GCancellable *cancellable, GError **error) { - return gsecret_prompt_perform_sync (prompt, 0, cancellable, error); + return secret_prompt_perform_sync (prompt, 0, cancellable, error); } static void @@ -151,7 +151,7 @@ on_real_prompt_completed (GObject *source, GError *error = NULL; gboolean ret; - ret = gsecret_prompt_perform_finish (GSECRET_PROMPT (source), result, &error); + ret = secret_prompt_perform_finish (SECRET_PROMPT (source), result, &error); g_simple_async_result_set_op_res_gboolean (res, ret); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -161,8 +161,8 @@ on_real_prompt_completed (GObject *source, } static void -gsecret_service_real_prompt_async (GSecretService *self, - GSecretPrompt *prompt, +secret_service_real_prompt_async (SecretService *self, + SecretPrompt *prompt, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) @@ -170,9 +170,9 @@ gsecret_service_real_prompt_async (GSecretService *self, GSimpleAsyncResult *res; res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_real_prompt_async); + secret_service_real_prompt_async); - gsecret_prompt_perform (prompt, 0, cancellable, + secret_prompt_perform (prompt, 0, cancellable, on_real_prompt_completed, g_object_ref (res)); @@ -180,7 +180,7 @@ gsecret_service_real_prompt_async (GSecretService *self, } static gboolean -gsecret_service_real_prompt_finish (GSecretService *self, +secret_service_real_prompt_finish (SecretService *self, GAsyncResult *result, GError **error) { @@ -193,7 +193,7 @@ gsecret_service_real_prompt_finish (GSecretService *self, } static void -handle_property_changed (GSecretService *self, +handle_property_changed (SecretService *self, const gchar *property_name, GVariant *value) { @@ -206,16 +206,16 @@ handle_property_changed (GSecretService *self, g_mutex_unlock (&self->pv->mutex); if (perform) - gsecret_service_ensure_collections (self, self->pv->cancellable, NULL, NULL); + secret_service_ensure_collections (self, self->pv->cancellable, NULL, NULL); } } static void -gsecret_service_properties_changed (GDBusProxy *proxy, +secret_service_properties_changed (GDBusProxy *proxy, GVariant *changed_properties, const gchar* const *invalidated_properties) { - GSecretService *self = GSECRET_SERVICE (proxy); + SecretService *self = SECRET_SERVICE (proxy); gchar *property_name; GVariantIter iter; GVariant *value; @@ -230,40 +230,40 @@ gsecret_service_properties_changed (GDBusProxy *proxy, } static void -gsecret_service_class_init (GSecretServiceClass *klass) +secret_service_class_init (SecretServiceClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GDBusProxyClass *proxy_class = G_DBUS_PROXY_CLASS (klass); - object_class->get_property = gsecret_service_get_property; - object_class->set_property = gsecret_service_set_property; - object_class->dispose = gsecret_service_dispose; - object_class->finalize = gsecret_service_finalize; + object_class->get_property = secret_service_get_property; + object_class->set_property = secret_service_set_property; + object_class->dispose = secret_service_dispose; + object_class->finalize = secret_service_finalize; - proxy_class->g_properties_changed = gsecret_service_properties_changed; + proxy_class->g_properties_changed = secret_service_properties_changed; - klass->prompt_sync = gsecret_service_real_prompt_sync; - klass->prompt_async = gsecret_service_real_prompt_async; - klass->prompt_finish = gsecret_service_real_prompt_finish; + klass->prompt_sync = secret_service_real_prompt_sync; + klass->prompt_async = secret_service_real_prompt_async; + klass->prompt_finish = secret_service_real_prompt_finish; - klass->item_gtype = GSECRET_TYPE_ITEM; - klass->collection_gtype = GSECRET_TYPE_COLLECTION; + klass->item_gtype = SECRET_TYPE_ITEM; + klass->collection_gtype = SECRET_TYPE_COLLECTION; g_object_class_install_property (object_class, PROP_FLAGS, g_param_spec_flags ("flags", "Flags", "Service flags", - g_secret_service_flags_get_type (), GSECRET_SERVICE_NONE, + secret_service_flags_get_type (), SECRET_SERVICE_NONE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_COLLECTIONS, g_param_spec_boxed ("collections", "Collections", "Secret Service Collections", - _gsecret_list_get_type (), G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + _secret_list_get_type (), G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_type_class_add_private (klass, sizeof (GSecretServicePrivate)); + g_type_class_add_private (klass, sizeof (SecretServicePrivate)); } typedef struct { GCancellable *cancellable; - GSecretServiceFlags flags; + SecretServiceFlags flags; } InitClosure; static void @@ -275,17 +275,17 @@ init_closure_free (gpointer data) } static gboolean -service_ensure_for_flags_sync (GSecretService *self, - GSecretServiceFlags flags, +service_ensure_for_flags_sync (SecretService *self, + SecretServiceFlags flags, GCancellable *cancellable, GError **error) { - if (flags & GSECRET_SERVICE_OPEN_SESSION) - if (!gsecret_service_ensure_session_sync (self, cancellable, error)) + if (flags & SECRET_SERVICE_OPEN_SESSION) + if (!secret_service_ensure_session_sync (self, cancellable, error)) return FALSE; - if (flags & GSECRET_SERVICE_LOAD_COLLECTIONS) - if (!gsecret_service_ensure_collections_sync (self, cancellable, error)) + if (flags & SECRET_SERVICE_LOAD_COLLECTIONS) + if (!secret_service_ensure_collections_sync (self, cancellable, error)) return FALSE; return TRUE; @@ -297,10 +297,10 @@ on_ensure_collections (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretService *self = GSECRET_SERVICE (source); + SecretService *self = SECRET_SERVICE (source); GError *error = NULL; - if (!gsecret_service_ensure_collections_finish (self, result, &error)) + if (!secret_service_ensure_collections_finish (self, result, &error)) g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); @@ -314,15 +314,15 @@ on_ensure_session (GObject *source, { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); InitClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretService *self = GSECRET_SERVICE (source); + SecretService *self = SECRET_SERVICE (source); GError *error = NULL; - if (!gsecret_service_ensure_session_finish (self, result, &error)) { + if (!secret_service_ensure_session_finish (self, result, &error)) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); - } else if (closure->flags & GSECRET_SERVICE_LOAD_COLLECTIONS) { - gsecret_service_ensure_collections (self, closure->cancellable, + } else if (closure->flags & SECRET_SERVICE_LOAD_COLLECTIONS) { + secret_service_ensure_collections (self, closure->cancellable, on_ensure_collections, g_object_ref (res)); } else { @@ -333,20 +333,20 @@ on_ensure_session (GObject *source, } static void -service_ensure_for_flags_async (GSecretService *self, - GSecretServiceFlags flags, +service_ensure_for_flags_async (SecretService *self, + SecretServiceFlags flags, GSimpleAsyncResult *res) { InitClosure *closure = g_simple_async_result_get_op_res_gpointer (res); closure->flags = flags; - if (closure->flags & GSECRET_SERVICE_OPEN_SESSION) - gsecret_service_ensure_session (self, closure->cancellable, + if (closure->flags & SECRET_SERVICE_OPEN_SESSION) + secret_service_ensure_session (self, closure->cancellable, on_ensure_session, g_object_ref (res)); - else if (closure->flags & GSECRET_SERVICE_LOAD_COLLECTIONS) - gsecret_service_ensure_collections (self, closure->cancellable, + else if (closure->flags & SECRET_SERVICE_LOAD_COLLECTIONS) + secret_service_ensure_collections (self, closure->cancellable, on_ensure_collections, g_object_ref (res)); else @@ -354,25 +354,25 @@ service_ensure_for_flags_async (GSecretService *self, } static gboolean -gsecret_service_initable_init (GInitable *initable, +secret_service_initable_init (GInitable *initable, GCancellable *cancellable, GError **error) { - GSecretService *self; + SecretService *self; - if (!gsecret_service_initable_parent_iface->init (initable, cancellable, error)) + if (!secret_service_initable_parent_iface->init (initable, cancellable, error)) return FALSE; - self = GSECRET_SERVICE (initable); + self = SECRET_SERVICE (initable); return service_ensure_for_flags_sync (self, self->pv->init_flags, cancellable, error); } static void -gsecret_service_initable_iface (GInitableIface *iface) +secret_service_initable_iface (GInitableIface *iface) { - gsecret_service_initable_parent_iface = g_type_interface_peek_parent (iface); + secret_service_initable_parent_iface = g_type_interface_peek_parent (iface); - iface->init = gsecret_service_initable_init; + iface->init = secret_service_initable_init; } static void @@ -381,10 +381,10 @@ on_init_base (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretService *self = GSECRET_SERVICE (source); + SecretService *self = SECRET_SERVICE (source); GError *error = NULL; - if (!gsecret_service_async_initable_parent_iface->init_finish (G_ASYNC_INITABLE (self), + if (!secret_service_async_initable_parent_iface->init_finish (G_ASYNC_INITABLE (self), result, &error)) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); @@ -397,7 +397,7 @@ on_init_base (GObject *source, } static void -gsecret_service_async_initable_init_async (GAsyncInitable *initable, +secret_service_async_initable_init_async (GAsyncInitable *initable, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -407,12 +407,12 @@ gsecret_service_async_initable_init_async (GAsyncInitable *initable, InitClosure *closure; res = g_simple_async_result_new (G_OBJECT (initable), callback, user_data, - gsecret_service_async_initable_init_async); + secret_service_async_initable_init_async); closure = g_slice_new0 (InitClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; g_simple_async_result_set_op_res_gpointer (res, closure, init_closure_free); - gsecret_service_async_initable_parent_iface->init_async (initable, io_priority, + secret_service_async_initable_parent_iface->init_async (initable, io_priority, cancellable, on_init_base, g_object_ref (res)); @@ -421,12 +421,12 @@ gsecret_service_async_initable_init_async (GAsyncInitable *initable, } static gboolean -gsecret_service_async_initable_init_finish (GAsyncInitable *initable, +secret_service_async_initable_init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) { g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (initable), - gsecret_service_async_initable_init_async), FALSE); + secret_service_async_initable_init_async), FALSE); if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error)) return FALSE; @@ -435,16 +435,16 @@ gsecret_service_async_initable_init_finish (GAsyncInitable *initable, } static void -gsecret_service_async_initable_iface (GAsyncInitableIface *iface) +secret_service_async_initable_iface (GAsyncInitableIface *iface) { - gsecret_service_async_initable_parent_iface = g_type_interface_peek_parent (iface); + secret_service_async_initable_parent_iface = g_type_interface_peek_parent (iface); - iface->init_async = gsecret_service_async_initable_init_async; - iface->init_finish = gsecret_service_async_initable_init_finish; + iface->init_async = secret_service_async_initable_init_async; + iface->init_finish = secret_service_async_initable_init_finish; } void -_gsecret_service_set_default_bus_name (const gchar *bus_name) +_secret_service_set_default_bus_name (const gchar *bus_name) { g_return_if_fail (bus_name != NULL); default_bus_name = bus_name; @@ -463,12 +463,12 @@ on_service_instance_gone (gpointer user_data, } void -gsecret_service_get (GSecretServiceFlags flags, +secret_service_get (SecretServiceFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { - GSecretService *service = NULL; + SecretService *service = NULL; GSimpleAsyncResult *res; InitClosure *closure; @@ -479,21 +479,21 @@ gsecret_service_get (GSecretServiceFlags flags, /* Create a whole new service */ if (service == NULL) { - g_async_initable_new_async (GSECRET_TYPE_SERVICE, G_PRIORITY_DEFAULT, + g_async_initable_new_async (SECRET_TYPE_SERVICE, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", G_DBUS_PROXY_FLAGS_NONE, - "g-interface-info", _gsecret_gen_service_interface_info (), + "g-interface-info", _secret_gen_service_interface_info (), "g-name", default_bus_name, "g-bus-type", G_BUS_TYPE_SESSION, - "g-object-path", GSECRET_SERVICE_PATH, - "g-interface-name", GSECRET_SERVICE_INTERFACE, + "g-object-path", SECRET_SERVICE_PATH, + "g-interface-name", SECRET_SERVICE_INTERFACE, "flags", flags, NULL); /* Just have to ensure that the service matches flags */ } else { res = g_simple_async_result_new (G_OBJECT (service), callback, - user_data, gsecret_service_get); + user_data, secret_service_get); closure = g_slice_new0 (InitClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; closure->flags = flags; @@ -506,8 +506,8 @@ gsecret_service_get (GSecretServiceFlags flags, } } -GSecretService * -gsecret_service_get_finish (GAsyncResult *result, +SecretService * +secret_service_get_finish (GAsyncResult *result, GError **error) { GObject *service = NULL; @@ -519,7 +519,7 @@ gsecret_service_get_finish (GAsyncResult *result, source_object = g_async_result_get_source_object (result); /* Just ensuring that the service matches flags */ - if (g_simple_async_result_is_valid (result, source_object, gsecret_service_get)) { + if (g_simple_async_result_is_valid (result, source_object, secret_service_get)) { if (!g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error)) service = g_object_ref (source_object); @@ -543,15 +543,15 @@ gsecret_service_get_finish (GAsyncResult *result, if (service == NULL) return NULL; - return GSECRET_SERVICE (service); + return SECRET_SERVICE (service); } -GSecretService * -gsecret_service_get_sync (GSecretServiceFlags flags, +SecretService * +secret_service_get_sync (SecretServiceFlags flags, GCancellable *cancellable, GError **error) { - GSecretService *service = NULL; + SecretService *service = NULL; G_LOCK (service_instance); if (service_instance != NULL) @@ -559,13 +559,13 @@ gsecret_service_get_sync (GSecretServiceFlags flags, G_UNLOCK (service_instance); if (service == NULL) { - service = g_initable_new (GSECRET_TYPE_SERVICE, cancellable, error, + service = g_initable_new (SECRET_TYPE_SERVICE, cancellable, error, "g-flags", G_DBUS_PROXY_FLAGS_NONE, - "g-interface-info", _gsecret_gen_service_interface_info (), + "g-interface-info", _secret_gen_service_interface_info (), "g-name", default_bus_name, "g-bus-type", G_BUS_TYPE_SESSION, - "g-object-path", GSECRET_SERVICE_PATH, - "g-interface-name", GSECRET_SERVICE_INTERFACE, + "g-object-path", SECRET_SERVICE_PATH, + "g-interface-name", SECRET_SERVICE_INTERFACE, "flags", flags, NULL); @@ -589,8 +589,8 @@ gsecret_service_get_sync (GSecretServiceFlags flags, } void -gsecret_service_new (const gchar *service_bus_name, - GSecretServiceFlags flags, +secret_service_new (const gchar *service_bus_name, + SecretServiceFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) @@ -600,20 +600,20 @@ gsecret_service_new (const gchar *service_bus_name, if (service_bus_name == NULL) service_bus_name = default_bus_name; - g_async_initable_new_async (GSECRET_TYPE_SERVICE, G_PRIORITY_DEFAULT, + g_async_initable_new_async (SECRET_TYPE_SERVICE, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", G_DBUS_PROXY_FLAGS_NONE, - "g-interface-info", _gsecret_gen_service_interface_info (), + "g-interface-info", _secret_gen_service_interface_info (), "g-name", service_bus_name, "g-bus-type", G_BUS_TYPE_SESSION, - "g-object-path", GSECRET_SERVICE_PATH, - "g-interface-name", GSECRET_SERVICE_INTERFACE, + "g-object-path", SECRET_SERVICE_PATH, + "g-interface-name", SECRET_SERVICE_INTERFACE, "flags", flags, NULL); } -GSecretService * -gsecret_service_new_finish (GAsyncResult *result, +SecretService * +secret_service_new_finish (GAsyncResult *result, GError **error) { GObject *source_object; @@ -630,12 +630,12 @@ gsecret_service_new_finish (GAsyncResult *result, if (object == NULL) return NULL; - return GSECRET_SERVICE (object); + return SECRET_SERVICE (object); } -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) { @@ -644,30 +644,30 @@ gsecret_service_new_sync (const gchar *service_bus_name, if (service_bus_name == NULL) service_bus_name = default_bus_name; - return g_initable_new (GSECRET_TYPE_SERVICE, cancellable, error, + return g_initable_new (SECRET_TYPE_SERVICE, cancellable, error, "g-flags", G_DBUS_PROXY_FLAGS_NONE, - "g-interface-info", _gsecret_gen_service_interface_info (), + "g-interface-info", _secret_gen_service_interface_info (), "g-name", service_bus_name, "g-bus-type", G_BUS_TYPE_SESSION, - "g-object-path", GSECRET_SERVICE_PATH, - "g-interface-name", GSECRET_SERVICE_INTERFACE, + "g-object-path", SECRET_SERVICE_PATH, + "g-interface-name", SECRET_SERVICE_INTERFACE, "flags", flags, NULL); } -GSecretServiceFlags -gsecret_service_get_flags (GSecretService *self) +SecretServiceFlags +secret_service_get_flags (SecretService *self) { - GSecretServiceFlags flags = 0; + SecretServiceFlags flags = 0; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), GSECRET_SERVICE_NONE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), SECRET_SERVICE_NONE); g_mutex_lock (&self->pv->mutex); if (self->pv->session) - flags |= GSECRET_SERVICE_OPEN_SESSION; + flags |= SECRET_SERVICE_OPEN_SESSION; if (self->pv->collections) - flags |= GSECRET_SERVICE_LOAD_COLLECTIONS; + flags |= SECRET_SERVICE_LOAD_COLLECTIONS; g_mutex_unlock (&self->pv->mutex); @@ -675,11 +675,11 @@ gsecret_service_get_flags (GSecretService *self) } GList * -gsecret_service_get_collections (GSecretService *self) +secret_service_get_collections (SecretService *self) { GList *l, *collections; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_mutex_lock (&self->pv->mutex); @@ -697,15 +697,15 @@ gsecret_service_get_collections (GSecretService *self) return collections; } -GSecretItem * -_gsecret_service_find_item_instance (GSecretService *self, +SecretItem * +_secret_service_find_item_instance (SecretService *self, const gchar *item_path) { - GSecretCollection *collection = NULL; + SecretCollection *collection = NULL; gchar *collection_path; - GSecretItem *item; + SecretItem *item; - collection_path = _gsecret_util_parent_path (item_path); + collection_path = _secret_util_parent_path (item_path); g_mutex_lock (&self->pv->mutex); if (self->pv->collections) { @@ -720,18 +720,18 @@ _gsecret_service_find_item_instance (GSecretService *self, if (collection == NULL) return NULL; - item = _gsecret_collection_find_item_instance (collection, item_path); + item = _secret_collection_find_item_instance (collection, item_path); g_object_unref (collection); return item; } -GSecretSession * -_gsecret_service_get_session (GSecretService *self) +SecretSession * +_secret_service_get_session (SecretService *self) { - GSecretSession *session; + SecretSession *session; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_mutex_lock (&self->pv->mutex); session = self->pv->session; @@ -741,31 +741,31 @@ _gsecret_service_get_session (GSecretService *self) } void -_gsecret_service_take_session (GSecretService *self, - GSecretSession *session) +_secret_service_take_session (SecretService *self, + SecretSession *session) { - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (session != NULL); g_mutex_lock (&self->pv->mutex); if (self->pv->session == NULL) self->pv->session = session; else - _gsecret_session_free (session); + _secret_session_free (session); g_mutex_unlock (&self->pv->mutex); } const gchar * -gsecret_service_get_session_algorithms (GSecretService *self) +secret_service_get_session_algorithms (SecretService *self) { - GSecretSession *session; + SecretSession *session; const gchar *algorithms; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_mutex_lock (&self->pv->mutex); session = self->pv->session; - algorithms = session ? _gsecret_session_get_algorithms (session) : NULL; + algorithms = session ? _secret_session_get_algorithms (session) : NULL; g_mutex_unlock (&self->pv->mutex); /* Session never changes once established, so can return const */ @@ -773,16 +773,16 @@ gsecret_service_get_session_algorithms (GSecretService *self) } const gchar * -gsecret_service_get_session_path (GSecretService *self) +secret_service_get_session_path (SecretService *self) { - GSecretSession *session; + SecretSession *session; const gchar *path; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_mutex_lock (&self->pv->mutex); session = self->pv->session; - path = session ? _gsecret_session_get_path (session) : NULL; + path = session ? _secret_session_get_path (session) : NULL; g_mutex_unlock (&self->pv->mutex); /* Session never changes once established, so can return const */ @@ -790,15 +790,15 @@ gsecret_service_get_session_path (GSecretService *self) } void -gsecret_service_ensure_session (GSecretService *self, +secret_service_ensure_session (SecretService *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { GSimpleAsyncResult *res; - GSecretSession *session; + SecretSession *session; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); g_mutex_lock (&self->pv->mutex); @@ -806,67 +806,67 @@ gsecret_service_ensure_session (GSecretService *self, g_mutex_unlock (&self->pv->mutex); if (session == NULL) { - _gsecret_session_open (self, cancellable, callback, user_data); + _secret_session_open (self, cancellable, callback, user_data); } else { res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_ensure_session); + secret_service_ensure_session); g_simple_async_result_complete_in_idle (res); g_object_unref (res); } } const gchar * -gsecret_service_ensure_session_finish (GSecretService *self, +secret_service_ensure_session_finish (SecretService *self, GAsyncResult *result, GError **error) { - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); if (!g_simple_async_result_is_valid (result, G_OBJECT (self), - gsecret_service_ensure_session)) { - if (!_gsecret_session_open_finish (result, error)) + secret_service_ensure_session)) { + if (!_secret_session_open_finish (result, error)) return NULL; } g_return_val_if_fail (self->pv->session != NULL, NULL); - return gsecret_service_get_session_path (self); + return secret_service_get_session_path (self); } const gchar * -gsecret_service_ensure_session_sync (GSecretService *self, +secret_service_ensure_session_sync (SecretService *self, GCancellable *cancellable, GError **error) { - GSecretSync *sync; + SecretSync *sync; const gchar *path; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), NULL); + g_return_val_if_fail (SECRET_IS_SERVICE (self), 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_service_ensure_session (self, cancellable, - _gsecret_sync_on_result, sync); + secret_service_ensure_session (self, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - path = gsecret_service_ensure_session_finish (self, sync->result, error); + path = secret_service_ensure_session_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); - _gsecret_sync_free (sync); + _secret_sync_free (sync); return path; } -static GSecretCollection * -service_lookup_collection (GSecretService *self, +static SecretCollection * +service_lookup_collection (SecretService *self, const gchar *path) { - GSecretCollection *collection = NULL; + SecretCollection *collection = NULL; g_mutex_lock (&self->pv->mutex); @@ -882,7 +882,7 @@ service_lookup_collection (GSecretService *self, } static void -service_update_collections (GSecretService *self, +service_update_collections (SecretService *self, GHashTable *collections) { GHashTable *previous; @@ -928,15 +928,15 @@ on_ensure_collection (GObject *source, gpointer user_data) { GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data); - GSecretService *self = GSECRET_SERVICE (g_async_result_get_source_object (user_data)); + SecretService *self = SECRET_SERVICE (g_async_result_get_source_object (user_data)); EnsureClosure *closure = g_simple_async_result_get_op_res_gpointer (res); - GSecretCollection *collection; + SecretCollection *collection; const gchar *path; GError *error = NULL; closure->collections_loading--; - collection = gsecret_collection_new_finish (result, &error); + collection = secret_collection_new_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -956,26 +956,26 @@ on_ensure_collection (GObject *source, } void -gsecret_service_ensure_collections (GSecretService *self, +secret_service_ensure_collections (SecretService *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { EnsureClosure *closure; - GSecretCollection *collection; + SecretCollection *collection; GSimpleAsyncResult *res; const gchar *path; GVariant *paths; GVariantIter iter; - g_return_if_fail (GSECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); paths = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (self), "Collections"); g_return_if_fail (paths != NULL); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - gsecret_service_ensure_collections); + secret_service_ensure_collections); closure = g_slice_new0 (EnsureClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; closure->collections = collections_table_new (); @@ -987,7 +987,7 @@ gsecret_service_ensure_collections (GSecretService *self, /* No such collection yet create a new one */ if (collection == NULL) { - gsecret_collection_new (self, path, cancellable, + secret_collection_new (self, path, cancellable, on_ensure_collection, g_object_ref (res)); closure->collections_loading++; } else { @@ -1005,14 +1005,14 @@ gsecret_service_ensure_collections (GSecretService *self, } gboolean -gsecret_service_ensure_collections_finish (GSecretService *self, +secret_service_ensure_collections_finish (SecretService *self, GAsyncResult *result, GError **error) { - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (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_service_ensure_collections), FALSE); + secret_service_ensure_collections), FALSE); if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error)) return FALSE; @@ -1021,18 +1021,18 @@ gsecret_service_ensure_collections_finish (GSecretService *self, } gboolean -gsecret_service_ensure_collections_sync (GSecretService *self, +secret_service_ensure_collections_sync (SecretService *self, GCancellable *cancellable, GError **error) { - GSecretCollection *collection; + SecretCollection *collection; GHashTable *collections; GVariant *paths; GVariantIter iter; const gchar *path; gboolean ret = TRUE; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -1047,7 +1047,7 @@ gsecret_service_ensure_collections_sync (GSecretService *self, /* No such collection yet create a new one */ if (collection == NULL) { - collection = gsecret_collection_new_sync (self, path, cancellable, error); + collection = secret_collection_new_sync (self, path, cancellable, error); if (collection == NULL) { ret = FALSE; break; @@ -1066,55 +1066,55 @@ gsecret_service_ensure_collections_sync (GSecretService *self, } gboolean -gsecret_service_prompt_sync (GSecretService *self, - GSecretPrompt *prompt, +secret_service_prompt_sync (SecretService *self, + SecretPrompt *prompt, GCancellable *cancellable, GError **error) { - GSecretServiceClass *klass; + SecretServiceClass *klass; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); - g_return_val_if_fail (GSECRET_IS_PROMPT (prompt), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_PROMPT (prompt), FALSE); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - klass = GSECRET_SERVICE_GET_CLASS (self); + klass = SECRET_SERVICE_GET_CLASS (self); g_return_val_if_fail (klass->prompt_sync != NULL, FALSE); return (klass->prompt_sync) (self, prompt, cancellable, error); } void -gsecret_service_prompt (GSecretService *self, - GSecretPrompt *prompt, +secret_service_prompt (SecretService *self, + SecretPrompt *prompt, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { - GSecretServiceClass *klass; + SecretServiceClass *klass; - g_return_if_fail (GSECRET_IS_SERVICE (self)); - g_return_if_fail (GSECRET_IS_PROMPT (prompt)); + g_return_if_fail (SECRET_IS_SERVICE (self)); + g_return_if_fail (SECRET_IS_PROMPT (prompt)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); - klass = GSECRET_SERVICE_GET_CLASS (self); + klass = SECRET_SERVICE_GET_CLASS (self); g_return_if_fail (klass->prompt_async != NULL); (klass->prompt_async) (self, prompt, cancellable, callback, user_data); } gboolean -gsecret_service_prompt_finish (GSecretService *self, +secret_service_prompt_finish (SecretService *self, GAsyncResult *result, GError **error) { - GSecretServiceClass *klass; + SecretServiceClass *klass; - g_return_val_if_fail (GSECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (SECRET_IS_SERVICE (self), FALSE); g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - klass = GSECRET_SERVICE_GET_CLASS (self); + klass = SECRET_SERVICE_GET_CLASS (self); g_return_val_if_fail (klass->prompt_finish != NULL, FALSE); return (klass->prompt_finish) (self, result, error); diff --git a/library/gsecret-service.h b/library/secret-service.h similarity index 72% rename from library/gsecret-service.h rename to library/secret-service.h index 8ce0239..75f4d89 100644 --- a/library/gsecret-service.h +++ b/library/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. @@ -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 -#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___ */ diff --git a/library/gsecret-session.c b/library/secret-session.c similarity index 87% rename from library/gsecret-session.c rename to library/secret-session.c index 01427f2..00d7ff0 100644 --- a/library/gsecret-session.c +++ b/library/secret-session.c @@ -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; diff --git a/library/gsecret-types.h b/library/secret-types.h similarity index 52% rename from library/gsecret-types.h rename to library/secret-types.h index 486d91e..91bd11a 100644 --- a/library/gsecret-types.h +++ b/library/secret-types.h @@ -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 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]; /* */ @@ -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 diff --git a/library/gsecret-util.c b/library/secret-util.c similarity index 89% rename from library/gsecret-util.c rename to library/secret-util.c index 09f5234..dd538e4 100644 --- a/library/gsecret-util.c +++ b/library/secret-util.c @@ -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 @@ -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); diff --git a/library/gsecret-value.c b/library/secret-value.c similarity index 67% rename from library/gsecret-value.c rename to library/secret-value.c index 97d6819..768701e 100644 --- a/library/gsecret-value.c +++ b/library/secret-value.c @@ -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 -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); diff --git a/library/gsecret-value.h b/library/secret-value.h similarity index 55% rename from library/gsecret-value.h rename to library/secret-value.h index 96bad3f..badcd2f 100644 --- a/library/gsecret-value.h +++ b/library/secret-value.h @@ -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 -#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 diff --git a/library/tests/Makefile.am b/library/tests/Makefile.am index e6586aa..17c3650 100644 --- a/library/tests/Makefile.am +++ b/library/tests/Makefile.am @@ -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) diff --git a/library/tests/mock-service.c b/library/tests/mock-service.c index 00f70cc..feb6690 100644 --- a/library/tests/mock-service.c +++ b/library/tests/mock-service.c @@ -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 #include @@ -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), diff --git a/library/tests/mock-service.h b/library/tests/mock-service.h index 74ed897..a160de9 100644 --- a/library/tests/mock-service.h +++ b/library/tests/mock-service.h @@ -1,4 +1,4 @@ -/* GSecret - GLib wrapper for Secret Service +/* libsecret - GLib wrapper for Secret Service * * Copyright 2012 Red Hat Inc. * diff --git a/library/tests/test-collection.c b/library/tests/test-collection.c index 7a55ffc..b3bc1c8 100644 --- a/library/tests/test-collection.c +++ b/library/tests/test-collection.c @@ -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 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); } diff --git a/library/tests/test-item.c b/library/tests/test-item.c index 6e6a228..3bc994e 100644 --- a/library/tests/test-item.c +++ b/library/tests/test-item.c @@ -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 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", - attributes, value, FALSE, NULL, on_async_result, &result); + 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); } diff --git a/library/tests/test-methods.c b/library/tests/test-methods.c index 9d62c61..a04979b 100644 --- a/library/tests/test-methods.c +++ b/library/tests/test-methods.c @@ -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 #include -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); } diff --git a/library/tests/test-password.c b/library/tests/test-password.c index 9c75769..e562289 100644 --- a/library/tests/test-password.c +++ b/library/tests/test-password.c @@ -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 #include -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,16 +76,16 @@ test_lookup_sync (Test *test, gchar *password; GError *error = NULL; - password = gsecret_password_lookup_sync (&PASSWORD_SCHEMA, NULL, &error, - "even", FALSE, - "string", "one", - "number", 1, - NULL); + password = secret_password_lookup_sync (&PASSWORD_SCHEMA, NULL, &error, + "even", FALSE, + "string", "one", + "number", 1, + NULL); g_assert_no_error (error); g_assert_cmpstr (password, ==, "111"); - gsecret_password_free (password); + secret_password_free (password); } static void @@ -96,21 +96,21 @@ test_lookup_async (Test *test, GError *error = NULL; gchar *password; - gsecret_password_lookup (&PASSWORD_SCHEMA, NULL, on_complete_get_result, &result, - "even", FALSE, - "string", "one", - "number", 1, - NULL); + secret_password_lookup (&PASSWORD_SCHEMA, NULL, on_complete_get_result, &result, + "even", FALSE, + "string", "one", + "number", 1, + NULL); g_assert (result == NULL); 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,24 +122,24 @@ test_store_sync (Test *test, gchar *password; gboolean ret; - ret = gsecret_password_store_sync (&PASSWORD_SCHEMA, collection_path, - "Label here", "the password", NULL, &error, - "even", TRUE, - "string", "twelve", - "number", 12, - NULL); + ret = secret_password_store_sync (&PASSWORD_SCHEMA, collection_path, + "Label here", "the password", NULL, &error, + "even", TRUE, + "string", "twelve", + "number", 12, + NULL); g_assert_no_error (error); g_assert (ret == TRUE); - password = gsecret_password_lookup_sync (&PASSWORD_SCHEMA, NULL, &error, - "string", "twelve", - NULL); + 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,29 +152,29 @@ test_store_async (Test *test, gchar *password; gboolean ret; - gsecret_password_store (&PASSWORD_SCHEMA, collection_path, "Label here", - "the password", NULL, on_complete_get_result, &result, - "even", TRUE, - "string", "twelve", - "number", 12, - NULL); + secret_password_store (&PASSWORD_SCHEMA, collection_path, "Label here", + "the password", NULL, on_complete_get_result, &result, + "even", TRUE, + "string", "twelve", + "number", 12, + NULL); g_assert (result == NULL); 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, - "string", "twelve", - NULL); + 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,11 +184,11 @@ test_delete_sync (Test *test, GError *error = NULL; gboolean ret; - ret = gsecret_password_remove_sync (&PASSWORD_SCHEMA, NULL, &error, - "even", FALSE, - "string", "one", - "number", 1, - NULL); + ret = secret_password_remove_sync (&PASSWORD_SCHEMA, NULL, &error, + "even", FALSE, + "string", "one", + "number", 1, + NULL); g_assert_no_error (error); g_assert (ret == TRUE); @@ -202,18 +202,18 @@ test_delete_async (Test *test, GAsyncResult *result = NULL; gboolean ret; - gsecret_password_remove (&PASSWORD_SCHEMA, NULL, - on_complete_get_result, &result, - "even", FALSE, - "string", "one", - "number", 1, - NULL); + secret_password_remove (&PASSWORD_SCHEMA, NULL, + on_complete_get_result, &result, + "even", FALSE, + "string", "one", + "number", 1, + NULL); g_assert (result == NULL); 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 diff --git a/library/tests/test-prompt.c b/library/tests/test-prompt.c index ac4cb80..3a89df0 100644 --- a/library/tests/test-prompt.c +++ b/library/tests/test-prompt.c @@ -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 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); diff --git a/library/tests/test-service.c b/library/tests/test-service.c index 3a06ab8..081cacd 100644 --- a/library/tests/test-service.c +++ b/library/tests/test-service.c @@ -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 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); diff --git a/library/tests/test-session.c b/library/tests/test-session.c index 125c78b..6599ae4 100644 --- a/library/tests/test-session.c +++ b/library/tests/test-session.c @@ -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 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); } diff --git a/library/tests/test-value.c b/library/tests/test-value.c index 6ef051f..d72a2b7 100644 --- a/library/tests/test-value.c +++ b/library/tests/test-value.c @@ -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 diff --git a/po/POTFILES.in b/po/POTFILES.in index 1ac9a1d..edb2d5b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,2 +1,2 @@ -library/gsecret-item.c -library/gsecret-session.c +library/secret-item.c +library/secret-session.c