SecretCollectionPrivate
secret_collection_get_type
secret_collection_flags_get_type
+SecretCollectionCreateFlags
+SECRET_TYPE_COLLECTION_CREATE_FLAGS
+secret_collection_create_flags_get_type
</SECTION>
<SECTION>
SecretItem
SecretItemClass
SecretItemFlags
+SecretItemCreateFlags
secret_item_create
secret_item_create_finish
secret_item_create_sync
SecretItemPrivate
secret_item_get_type
secret_item_flags_get_type
+SECRET_TYPE_ITEM_CREATE_FLAGS
+secret_item_create_flags_get_type
</SECTION>
<SECTION>
*/
/**
+ * SecretCollectionCreateFlags:
+ * @SECRET_COLLECTION_CREATE_NONE: no flags
+ *
+ * Flags for secret_collection_create().
+ */
+
+/**
* SECRET_COLLECTION_DEFAULT:
*
* An alias to the default collection. This can be passed to secret_password_store()
SecretCollection *collection;
GHashTable *properties;
gchar *alias;
+ SecretCollectionCreateFlags flags;
} CreateClosure;
static void
service = secret_service_get_finish (result, &error);
if (error == NULL) {
secret_service_create_collection_dbus_path (service, create->properties,
- create->alias, create->cancellable,
+ create->alias, create->flags,
+ create->cancellable,
on_create_path, g_object_ref (async));
g_object_unref (service);
* @service: (allow-none): a secret service object
* @label: label for the new collection
* @alias: (allow-none): alias to assign to the collection
+ * @flags: currently unused
* @cancellable: optional cancellation object
* @callback: called when the operation completes
* @user_data: data to pass to the callback
secret_collection_create (SecretService *service,
const gchar *label,
const gchar *alias,
+ SecretCollectionCreateFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
closure->properties = collection_properties_new (label);
closure->alias = g_strdup (alias);
+ closure->flags = flags;
g_simple_async_result_set_op_res_gpointer (res, closure, create_closure_free);
if (service == NULL) {
} else {
secret_service_create_collection_dbus_path (service, closure->properties,
- closure->alias, closure->cancellable,
+ closure->alias, closure->flags,
+ closure->cancellable,
on_create_path, g_object_ref (res));
}
* @service: (allow-none): a secret service object
* @label: label for the new collection
* @alias: (allow-none): alias to assign to the collection
+ * @flags: currently unused
* @cancellable: optional cancellation object
* @error: location to place an error on failure
*
secret_collection_create_sync (SecretService *service,
const gchar *label,
const gchar *alias,
+ SecretCollectionCreateFlags flags,
GCancellable *cancellable,
GError **error)
{
properties = collection_properties_new (label);
path = secret_service_create_collection_dbus_path_sync (service, properties, alias,
- cancellable, error);
+ flags, cancellable, error);
g_hash_table_unref (properties);
SECRET_COLLECTION_LOAD_ITEMS = 1 << 1,
} SecretCollectionFlags;
+typedef enum {
+ SECRET_COLLECTION_CREATE_NONE = 0,
+} SecretCollectionCreateFlags;
+
#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))
void secret_collection_create (SecretService *service,
const gchar *label,
const gchar *alias,
+ SecretCollectionCreateFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
SecretCollection * secret_collection_create_sync (SecretService *service,
const gchar *label,
const gchar *alias,
+ SecretCollectionCreateFlags flags,
GCancellable *cancellable,
GError **error);
* Flags which determine which parts of the #SecretItem proxy are initialized.
*/
+/**
+ * SecretItemCreateFlags:
+ * @SECRET_ITEM_CREATE_NONE: no flags
+ * @SECRET_ITEM_CREATE_REPLACE: replace an item with the same attributes.
+ *
+ * Flags for secret_item_create().
+ */
+
enum {
PROP_0,
PROP_SERVICE,
* @attributes: (element-type utf8 utf8): attributes for the new item
* @label: label for the new item
* @value: secret value for the new item
- * @replace: whether to replace an existing item with the same attributes
+ * @flags: flags for the creation of the new item
* @cancellable: optional cancellation object
* @callback: called when the operation completes
* @user_data: data to pass to the callback
*
* Create a new item in the secret service.
*
- * If the @replace is set to %TRUE, then the secret service will search for
- * an item matching the @attributes, and update that item instead of creating
- * a new one.
+ * If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret
+ * service will search for an item matching the @attributes, and update that item
+ * instead of creating a new one.
*
* This method may block indefinitely and should not be used in user interface
* threads. The secret service may prompt the user. secret_service_prompt()
GHashTable *attributes,
const gchar *label,
SecretValue *value,
- gboolean replace,
+ SecretItemCreateFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
secret_service_create_item_dbus_path (service, collection_path, properties,
- value, replace, cancellable,
+ value, flags, cancellable,
on_create_path, g_object_ref (res));
g_hash_table_unref (properties);
* @attributes: (element-type utf8 utf8): attributes for the new item
* @label: label for the new item
* @value: secret value for the new item
- * @replace: whether to replace an existing item with the same attributes
+ * @flags: flags for the creation of the new item
* @cancellable: optional cancellation object
* @error: location to place an error on failure
*
* Create a new item in the secret service.
*
- * If the @replace is set to %TRUE, then the secret service will search for
- * an item matching the @attributes, and update that item instead of creating
- * a new one.
+ * If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret
+ * service will search for an item matching the @attributes, and update that item
+ * instead of creating a new one.
*
* This method may block indefinitely and should not be used in user interface
* threads. The secret service may prompt the user. secret_service_prompt()
GHashTable *attributes,
const gchar *label,
SecretValue *value,
- gboolean replace,
+ SecretItemCreateFlags flags,
GCancellable *cancellable,
GError **error)
{
collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
path = secret_service_create_item_dbus_path_sync (service, collection_path, properties,
- value, replace, cancellable, error);
+ value, flags, cancellable, error);
if (path != NULL) {
item = secret_item_new_for_dbus_path_sync (service, path, SECRET_ITEM_NONE,
SECRET_ITEM_LOAD_SECRET = 1 << 1
} SecretItemFlags;
+typedef enum {
+ SECRET_ITEM_CREATE_NONE = 0,
+ SECRET_ITEM_CREATE_REPLACE = 1 << 1
+} SecretItemCreateFlags;
+
#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))
GHashTable *attributes,
const gchar *label,
SecretValue *value,
- gboolean replace,
+ SecretItemCreateFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GHashTable *attributes,
const gchar *label,
SecretValue *value,
- gboolean replace,
+ SecretItemCreateFlags flags,
GCancellable *cancellable,
GError **error);
if (error == NULL) {
secret_service_create_item_dbus_path (service, store->collection_path,
store->properties, store->value,
- TRUE, store->cancellable,
+ SECRET_ITEM_CREATE_REPLACE, store->cancellable,
on_store_create, g_object_ref (async));
g_object_unref (service);
} else {
secret_service_create_item_dbus_path (service, store->collection_path,
store->properties, store->value,
- TRUE, store->cancellable,
+ SECRET_ITEM_CREATE_REPLACE, store->cancellable,
on_store_create, g_object_ref (async));
}
* the new collection
* @alias: (allow-none): an alias to check for before creating the new
* collection, or to assign to the new collection
+ * @flags: not currently used
* @cancellable: optional cancellation object
* @callback: called when the operation completes
* @user_data: data to be passed to the callback
secret_service_create_collection_dbus_path (SecretService *self,
GHashTable *properties,
const gchar *alias,
+ SecretCollectionCreateFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
* for the new collection
* @alias: (allow-none): an alias to check for before creating the new
* collection, or to assign to the new collection
+ * @flags: not currently used
* @cancellable: optional cancellation object
* @error: location to place an error on failure
*
secret_service_create_collection_dbus_path_sync (SecretService *self,
GHashTable *properties,
const gchar *alias,
+ SecretCollectionCreateFlags flags,
GCancellable *cancellable,
GError **error)
{
sync = _secret_sync_new ();
g_main_context_push_thread_default (sync->context);
- secret_service_create_collection_dbus_path (self, properties, alias, cancellable,
+ secret_service_create_collection_dbus_path (self, properties, alias, flags, cancellable,
_secret_sync_on_result, sync);
g_main_loop_run (sync->loop);
* @properties: (element-type utf8 GLib.Variant): hash table of D-Bus properties
* for the new collection
* @value: the secret value to store in the item
- * @replace: whether to replace an item with the matching attributes
+ * @flags: flags for the creation of the new item
* @cancellable: optional cancellation object
* @callback: called when the operation completes
* @user_data: data to be passed to the callback
* rather than using this function. Using this method requires that you setup
* a correct hash table of D-Bus @properties for the new collection.
*
- * If @replace is set to %TRUE, and an item already in the collection matches
- * the attributes (specified in @properties) then the item will be updated
- * instead of creating a new item.
+ * If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret
+ * service will search for an item matching the @attributes, and update that item
+ * instead of creating a new one.
*
* @properties is a set of properties for the new collection. The keys in the
* hash table should be interface.property strings like
const gchar *collection_path,
GHashTable *properties,
SecretValue *value,
- gboolean replace,
+ SecretItemCreateFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
closure->properties = _secret_util_variant_for_properties (properties);
g_variant_ref_sink (closure->properties);
- closure->replace = replace;
+ closure->replace = flags & SECRET_ITEM_CREATE_REPLACE;
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);
* @properties: (element-type utf8 GLib.Variant): hash table of D-Bus properties
* for the new collection
* @value: the secret value to store in the item
- * @replace: whether to replace an item with the matching attributes
+ * @flags: flags for the creation of the new item
* @cancellable: optional cancellation object
* @error: location to place an error on failure
*
* rather than using this function. Using this method requires that you setup
* a correct hash table of D-Bus @properties for the new collection.
*
- * If @replace is set to %TRUE, and an item already in the collection matches
- * the attributes (specified in @properties) then the item will be updated
- * instead of creating a new item.
+ * If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret
+ * service will search for an item matching the @attributes, and update that item
+ * instead of creating a new one.
*
* @properties is a set of properties for the new collection. The keys in the
* hash table should be interface.property strings like
const gchar *collection_path,
GHashTable *properties,
SecretValue *value,
- gboolean replace,
+ SecretItemCreateFlags flags,
GCancellable *cancellable,
GError **error)
{
sync = _secret_sync_new ();
g_main_context_push_thread_default (sync->context);
- secret_service_create_item_dbus_path (self, collection_path, properties, value, replace,
+ secret_service_create_item_dbus_path (self, collection_path, properties, value, flags,
cancellable, _secret_sync_on_result, sync);
g_main_loop_run (sync->loop);
void secret_service_create_collection_dbus_path (SecretService *self,
GHashTable *properties,
const gchar *alias,
+ SecretCollectionCreateFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * secret_service_create_collection_dbus_path_sync (SecretService *self,
GHashTable *properties,
const gchar *alias,
+ SecretCollectionCreateFlags flags,
GCancellable *cancellable,
GError **error);
const gchar *collection_path,
GHashTable *properties,
SecretValue *value,
- gboolean replace,
+ SecretItemCreateFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
const gchar *collection_path,
GHashTable *properties,
SecretValue *value,
- gboolean replace,
+ SecretItemCreateFlags flags,
GCancellable *cancellable,
GError **error);
GError *error = NULL;
SecretCollection *collection;
- collection = secret_collection_create_sync (test->service, "Train", NULL, NULL, &error);
+ collection = secret_collection_create_sync (test->service, "Train", NULL,
+ SECRET_COLLECTION_CREATE_NONE, 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"));
SecretCollection *collection;
GAsyncResult *result = NULL;
- secret_collection_create (test->service, "Train", NULL, NULL, on_async_result, &result);
+ secret_collection_create (test->service, "Train", NULL,
+ SECRET_COLLECTION_CREATE_NONE,
+ NULL, on_async_result, &result);
g_assert (result == NULL);
egg_test_wait ();
value = secret_value_new ("Hoohah", -1, "text/plain");
item = secret_item_create_sync (collection, &MOCK_SCHEMA, attributes, "Tunnel",
- value, FALSE, NULL, &error);
+ value, SECRET_ITEM_CREATE_NONE, NULL, &error);
g_assert_no_error (error);
g_hash_table_unref (attributes);
value = secret_value_new ("Hoohah", -1, "text/plain");
secret_item_create (collection, &MOCK_SCHEMA, attributes, "Tunnel",
- value, FALSE, NULL, on_async_result, &result);
+ value, SECRET_ITEM_CREATE_NONE, NULL, on_async_result, &result);
g_assert_no_error (error);
g_hash_table_unref (attributes);
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
path = secret_service_create_collection_dbus_path_sync (test->service, properties,
- NULL, NULL, &error);
+ NULL, SECRET_COLLECTION_CREATE_NONE,
+ NULL, &error);
g_hash_table_unref (properties);
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
secret_service_create_collection_dbus_path (test->service, properties,
- NULL, NULL, on_complete_get_result, &result);
+ NULL, SECRET_COLLECTION_CREATE_NONE,
+ NULL, on_complete_get_result, &result);
g_hash_table_unref (properties);
g_assert (result == NULL);
value = secret_value_new ("andmoreandmore", -1, "text/plain");
path = secret_service_create_item_dbus_path_sync (test->service, collection_path,
- properties, value, FALSE,
+ properties, value, SECRET_ITEM_CREATE_NONE,
NULL, &error);
secret_value_unref (value);
value = secret_value_new ("andmoreandmore", -1, "text/plain");
secret_service_create_item_dbus_path (test->service, collection_path,
- properties, value, FALSE,
+ properties, value, SECRET_ITEM_CREATE_NONE,
NULL, on_complete_get_result, &result);
g_assert (result == NULL);