mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 12:48:51 +00:00
Add flags for secret_item_create and secret_collection_create
* For future extensibility
This commit is contained in:
parent
494c13a265
commit
80df2e6484
@ -41,6 +41,9 @@ SECRET_TYPE_COLLECTION_FLAGS
|
|||||||
SecretCollectionPrivate
|
SecretCollectionPrivate
|
||||||
secret_collection_get_type
|
secret_collection_get_type
|
||||||
secret_collection_flags_get_type
|
secret_collection_flags_get_type
|
||||||
|
SecretCollectionCreateFlags
|
||||||
|
SECRET_TYPE_COLLECTION_CREATE_FLAGS
|
||||||
|
secret_collection_create_flags_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
@ -49,6 +52,7 @@ secret_collection_flags_get_type
|
|||||||
SecretItem
|
SecretItem
|
||||||
SecretItemClass
|
SecretItemClass
|
||||||
SecretItemFlags
|
SecretItemFlags
|
||||||
|
SecretItemCreateFlags
|
||||||
secret_item_create
|
secret_item_create
|
||||||
secret_item_create_finish
|
secret_item_create_finish
|
||||||
secret_item_create_sync
|
secret_item_create_sync
|
||||||
@ -90,6 +94,8 @@ SECRET_TYPE_ITEM_FLAGS
|
|||||||
SecretItemPrivate
|
SecretItemPrivate
|
||||||
secret_item_get_type
|
secret_item_get_type
|
||||||
secret_item_flags_get_type
|
secret_item_flags_get_type
|
||||||
|
SECRET_TYPE_ITEM_CREATE_FLAGS
|
||||||
|
secret_item_create_flags_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
@ -64,6 +64,13 @@
|
|||||||
* Flags which determine which parts of the #SecretCollection proxy are initialized.
|
* Flags which determine which parts of the #SecretCollection proxy are initialized.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SecretCollectionCreateFlags:
|
||||||
|
* @SECRET_COLLECTION_CREATE_NONE: no flags
|
||||||
|
*
|
||||||
|
* Flags for secret_collection_create().
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECRET_COLLECTION_DEFAULT:
|
* SECRET_COLLECTION_DEFAULT:
|
||||||
*
|
*
|
||||||
@ -943,6 +950,7 @@ typedef struct {
|
|||||||
SecretCollection *collection;
|
SecretCollection *collection;
|
||||||
GHashTable *properties;
|
GHashTable *properties;
|
||||||
gchar *alias;
|
gchar *alias;
|
||||||
|
SecretCollectionCreateFlags flags;
|
||||||
} CreateClosure;
|
} CreateClosure;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1010,7 +1018,8 @@ on_create_service (GObject *source,
|
|||||||
service = secret_service_get_finish (result, &error);
|
service = secret_service_get_finish (result, &error);
|
||||||
if (error == NULL) {
|
if (error == NULL) {
|
||||||
secret_service_create_collection_dbus_path (service, create->properties,
|
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));
|
on_create_path, g_object_ref (async));
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
|
|
||||||
@ -1043,6 +1052,7 @@ collection_properties_new (const gchar *label)
|
|||||||
* @service: (allow-none): a secret service object
|
* @service: (allow-none): a secret service object
|
||||||
* @label: label for the new collection
|
* @label: label for the new collection
|
||||||
* @alias: (allow-none): alias to assign to the collection
|
* @alias: (allow-none): alias to assign to the collection
|
||||||
|
* @flags: currently unused
|
||||||
* @cancellable: optional cancellation object
|
* @cancellable: optional cancellation object
|
||||||
* @callback: called when the operation completes
|
* @callback: called when the operation completes
|
||||||
* @user_data: data to pass to the callback
|
* @user_data: data to pass to the callback
|
||||||
@ -1067,6 +1077,7 @@ void
|
|||||||
secret_collection_create (SecretService *service,
|
secret_collection_create (SecretService *service,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
const gchar *alias,
|
const gchar *alias,
|
||||||
|
SecretCollectionCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -1084,6 +1095,7 @@ secret_collection_create (SecretService *service,
|
|||||||
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||||
closure->properties = collection_properties_new (label);
|
closure->properties = collection_properties_new (label);
|
||||||
closure->alias = g_strdup (alias);
|
closure->alias = g_strdup (alias);
|
||||||
|
closure->flags = flags;
|
||||||
g_simple_async_result_set_op_res_gpointer (res, closure, create_closure_free);
|
g_simple_async_result_set_op_res_gpointer (res, closure, create_closure_free);
|
||||||
|
|
||||||
if (service == NULL) {
|
if (service == NULL) {
|
||||||
@ -1092,7 +1104,8 @@ secret_collection_create (SecretService *service,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
secret_service_create_collection_dbus_path (service, closure->properties,
|
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));
|
on_create_path, g_object_ref (res));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1137,6 +1150,7 @@ secret_collection_create_finish (GAsyncResult *result,
|
|||||||
* @service: (allow-none): a secret service object
|
* @service: (allow-none): a secret service object
|
||||||
* @label: label for the new collection
|
* @label: label for the new collection
|
||||||
* @alias: (allow-none): alias to assign to the collection
|
* @alias: (allow-none): alias to assign to the collection
|
||||||
|
* @flags: currently unused
|
||||||
* @cancellable: optional cancellation object
|
* @cancellable: optional cancellation object
|
||||||
* @error: location to place an error on failure
|
* @error: location to place an error on failure
|
||||||
*
|
*
|
||||||
@ -1162,6 +1176,7 @@ SecretCollection *
|
|||||||
secret_collection_create_sync (SecretService *service,
|
secret_collection_create_sync (SecretService *service,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
const gchar *alias,
|
const gchar *alias,
|
||||||
|
SecretCollectionCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -1185,7 +1200,7 @@ secret_collection_create_sync (SecretService *service,
|
|||||||
properties = collection_properties_new (label);
|
properties = collection_properties_new (label);
|
||||||
|
|
||||||
path = secret_service_create_collection_dbus_path_sync (service, properties, alias,
|
path = secret_service_create_collection_dbus_path_sync (service, properties, alias,
|
||||||
cancellable, error);
|
flags, cancellable, error);
|
||||||
|
|
||||||
g_hash_table_unref (properties);
|
g_hash_table_unref (properties);
|
||||||
|
|
||||||
|
@ -31,6 +31,10 @@ typedef enum {
|
|||||||
SECRET_COLLECTION_LOAD_ITEMS = 1 << 1,
|
SECRET_COLLECTION_LOAD_ITEMS = 1 << 1,
|
||||||
} SecretCollectionFlags;
|
} SecretCollectionFlags;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SECRET_COLLECTION_CREATE_NONE = 0,
|
||||||
|
} SecretCollectionCreateFlags;
|
||||||
|
|
||||||
#define SECRET_TYPE_COLLECTION (secret_collection_get_type ())
|
#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(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_COLLECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_COLLECTION, SecretCollectionClass))
|
||||||
@ -89,6 +93,7 @@ void secret_collection_refresh (SecretCollection
|
|||||||
void secret_collection_create (SecretService *service,
|
void secret_collection_create (SecretService *service,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
const gchar *alias,
|
const gchar *alias,
|
||||||
|
SecretCollectionCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@ -99,6 +104,7 @@ SecretCollection * secret_collection_create_finish (GAsyncResult *re
|
|||||||
SecretCollection * secret_collection_create_sync (SecretService *service,
|
SecretCollection * secret_collection_create_sync (SecretService *service,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
const gchar *alias,
|
const gchar *alias,
|
||||||
|
SecretCollectionCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
@ -74,6 +74,14 @@
|
|||||||
* Flags which determine which parts of the #SecretItem proxy are initialized.
|
* 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 {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_SERVICE,
|
PROP_SERVICE,
|
||||||
@ -745,16 +753,16 @@ item_properties_new (const gchar *label,
|
|||||||
* @attributes: (element-type utf8 utf8): attributes for the new item
|
* @attributes: (element-type utf8 utf8): attributes for the new item
|
||||||
* @label: label for the new item
|
* @label: label for the new item
|
||||||
* @value: secret value 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
|
* @cancellable: optional cancellation object
|
||||||
* @callback: called when the operation completes
|
* @callback: called when the operation completes
|
||||||
* @user_data: data to pass to the callback
|
* @user_data: data to pass to the callback
|
||||||
*
|
*
|
||||||
* Create a new item in the secret service.
|
* Create a new item in the secret service.
|
||||||
*
|
*
|
||||||
* If the @replace is set to %TRUE, then the secret service will search for
|
* If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret
|
||||||
* an item matching the @attributes, and update that item instead of creating
|
* service will search for an item matching the @attributes, and update that item
|
||||||
* a new one.
|
* instead of creating a new one.
|
||||||
*
|
*
|
||||||
* This method may block indefinitely and should not be used in user interface
|
* This method may block indefinitely and should not be used in user interface
|
||||||
* threads. The secret service may prompt the user. secret_service_prompt()
|
* threads. The secret service may prompt the user. secret_service_prompt()
|
||||||
@ -766,7 +774,7 @@ secret_item_create (SecretCollection *collection,
|
|||||||
GHashTable *attributes,
|
GHashTable *attributes,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
SecretValue *value,
|
SecretValue *value,
|
||||||
gboolean replace,
|
SecretItemCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -800,7 +808,7 @@ secret_item_create (SecretCollection *collection,
|
|||||||
collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
|
collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
|
||||||
|
|
||||||
secret_service_create_item_dbus_path (service, collection_path, properties,
|
secret_service_create_item_dbus_path (service, collection_path, properties,
|
||||||
value, replace, cancellable,
|
value, flags, cancellable,
|
||||||
on_create_path, g_object_ref (res));
|
on_create_path, g_object_ref (res));
|
||||||
|
|
||||||
g_hash_table_unref (properties);
|
g_hash_table_unref (properties);
|
||||||
@ -848,15 +856,15 @@ secret_item_create_finish (GAsyncResult *result,
|
|||||||
* @attributes: (element-type utf8 utf8): attributes for the new item
|
* @attributes: (element-type utf8 utf8): attributes for the new item
|
||||||
* @label: label for the new item
|
* @label: label for the new item
|
||||||
* @value: secret value 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
|
* @cancellable: optional cancellation object
|
||||||
* @error: location to place an error on failure
|
* @error: location to place an error on failure
|
||||||
*
|
*
|
||||||
* Create a new item in the secret service.
|
* Create a new item in the secret service.
|
||||||
*
|
*
|
||||||
* If the @replace is set to %TRUE, then the secret service will search for
|
* If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret
|
||||||
* an item matching the @attributes, and update that item instead of creating
|
* service will search for an item matching the @attributes, and update that item
|
||||||
* a new one.
|
* instead of creating a new one.
|
||||||
*
|
*
|
||||||
* This method may block indefinitely and should not be used in user interface
|
* This method may block indefinitely and should not be used in user interface
|
||||||
* threads. The secret service may prompt the user. secret_service_prompt()
|
* threads. The secret service may prompt the user. secret_service_prompt()
|
||||||
@ -871,7 +879,7 @@ secret_item_create_sync (SecretCollection *collection,
|
|||||||
GHashTable *attributes,
|
GHashTable *attributes,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
SecretValue *value,
|
SecretValue *value,
|
||||||
gboolean replace,
|
SecretItemCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -898,7 +906,7 @@ secret_item_create_sync (SecretCollection *collection,
|
|||||||
collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
|
collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
|
||||||
|
|
||||||
path = secret_service_create_item_dbus_path_sync (service, collection_path, properties,
|
path = secret_service_create_item_dbus_path_sync (service, collection_path, properties,
|
||||||
value, replace, cancellable, error);
|
value, flags, cancellable, error);
|
||||||
|
|
||||||
if (path != NULL) {
|
if (path != NULL) {
|
||||||
item = secret_item_new_for_dbus_path_sync (service, path, SECRET_ITEM_NONE,
|
item = secret_item_new_for_dbus_path_sync (service, path, SECRET_ITEM_NONE,
|
||||||
|
@ -32,6 +32,11 @@ typedef enum {
|
|||||||
SECRET_ITEM_LOAD_SECRET = 1 << 1
|
SECRET_ITEM_LOAD_SECRET = 1 << 1
|
||||||
} SecretItemFlags;
|
} 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_TYPE_ITEM (secret_item_get_type ())
|
||||||
#define SECRET_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_ITEM, SecretItem))
|
#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_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_ITEM, SecretItemClass))
|
||||||
@ -65,7 +70,7 @@ void secret_item_create (SecretCollection *co
|
|||||||
GHashTable *attributes,
|
GHashTable *attributes,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
SecretValue *value,
|
SecretValue *value,
|
||||||
gboolean replace,
|
SecretItemCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@ -78,7 +83,7 @@ SecretItem * secret_item_create_sync (SecretCollection *co
|
|||||||
GHashTable *attributes,
|
GHashTable *attributes,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
SecretValue *value,
|
SecretValue *value,
|
||||||
gboolean replace,
|
SecretItemCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
@ -1001,7 +1001,7 @@ on_store_service (GObject *source,
|
|||||||
if (error == NULL) {
|
if (error == NULL) {
|
||||||
secret_service_create_item_dbus_path (service, store->collection_path,
|
secret_service_create_item_dbus_path (service, store->collection_path,
|
||||||
store->properties, store->value,
|
store->properties, store->value,
|
||||||
TRUE, store->cancellable,
|
SECRET_ITEM_CREATE_REPLACE, store->cancellable,
|
||||||
on_store_create, g_object_ref (async));
|
on_store_create, g_object_ref (async));
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
|
|
||||||
@ -1097,7 +1097,7 @@ secret_service_store (SecretService *service,
|
|||||||
} else {
|
} else {
|
||||||
secret_service_create_item_dbus_path (service, store->collection_path,
|
secret_service_create_item_dbus_path (service, store->collection_path,
|
||||||
store->properties, store->value,
|
store->properties, store->value,
|
||||||
TRUE, store->cancellable,
|
SECRET_ITEM_CREATE_REPLACE, store->cancellable,
|
||||||
on_store_create, g_object_ref (async));
|
on_store_create, g_object_ref (async));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1684,6 +1684,7 @@ on_create_collection_called (GObject *source,
|
|||||||
* the new collection
|
* the new collection
|
||||||
* @alias: (allow-none): an alias to check for before creating the new
|
* @alias: (allow-none): an alias to check for before creating the new
|
||||||
* collection, or to assign to the new collection
|
* collection, or to assign to the new collection
|
||||||
|
* @flags: not currently used
|
||||||
* @cancellable: optional cancellation object
|
* @cancellable: optional cancellation object
|
||||||
* @callback: called when the operation completes
|
* @callback: called when the operation completes
|
||||||
* @user_data: data to be passed to the callback
|
* @user_data: data to be passed to the callback
|
||||||
@ -1716,6 +1717,7 @@ void
|
|||||||
secret_service_create_collection_dbus_path (SecretService *self,
|
secret_service_create_collection_dbus_path (SecretService *self,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
const gchar *alias,
|
const gchar *alias,
|
||||||
|
SecretCollectionCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -1800,6 +1802,7 @@ secret_service_create_collection_dbus_path_finish (SecretService *self,
|
|||||||
* for the new collection
|
* for the new collection
|
||||||
* @alias: (allow-none): an alias to check for before creating the new
|
* @alias: (allow-none): an alias to check for before creating the new
|
||||||
* collection, or to assign to the new collection
|
* collection, or to assign to the new collection
|
||||||
|
* @flags: not currently used
|
||||||
* @cancellable: optional cancellation object
|
* @cancellable: optional cancellation object
|
||||||
* @error: location to place an error on failure
|
* @error: location to place an error on failure
|
||||||
*
|
*
|
||||||
@ -1832,6 +1835,7 @@ gchar *
|
|||||||
secret_service_create_collection_dbus_path_sync (SecretService *self,
|
secret_service_create_collection_dbus_path_sync (SecretService *self,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
const gchar *alias,
|
const gchar *alias,
|
||||||
|
SecretCollectionCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -1846,7 +1850,7 @@ secret_service_create_collection_dbus_path_sync (SecretService *self,
|
|||||||
sync = _secret_sync_new ();
|
sync = _secret_sync_new ();
|
||||||
g_main_context_push_thread_default (sync->context);
|
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);
|
_secret_sync_on_result, sync);
|
||||||
|
|
||||||
g_main_loop_run (sync->loop);
|
g_main_loop_run (sync->loop);
|
||||||
@ -1989,7 +1993,7 @@ on_create_item_session (GObject *source,
|
|||||||
* @properties: (element-type utf8 GLib.Variant): hash table of D-Bus properties
|
* @properties: (element-type utf8 GLib.Variant): hash table of D-Bus properties
|
||||||
* for the new collection
|
* for the new collection
|
||||||
* @value: the secret value to store in the item
|
* @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
|
* @cancellable: optional cancellation object
|
||||||
* @callback: called when the operation completes
|
* @callback: called when the operation completes
|
||||||
* @user_data: data to be passed to the callback
|
* @user_data: data to be passed to the callback
|
||||||
@ -2001,9 +2005,9 @@ on_create_item_session (GObject *source,
|
|||||||
* rather than using this function. Using this method requires that you setup
|
* rather than using this function. Using this method requires that you setup
|
||||||
* a correct hash table of D-Bus @properties for the new collection.
|
* 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
|
* If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret
|
||||||
* the attributes (specified in @properties) then the item will be updated
|
* service will search for an item matching the @attributes, and update that item
|
||||||
* instead of creating a new item.
|
* instead of creating a new one.
|
||||||
*
|
*
|
||||||
* @properties is a set of properties for the new collection. The keys in the
|
* @properties is a set of properties for the new collection. The keys in the
|
||||||
* hash table should be interface.property strings like
|
* hash table should be interface.property strings like
|
||||||
@ -2019,7 +2023,7 @@ secret_service_create_item_dbus_path (SecretService *self,
|
|||||||
const gchar *collection_path,
|
const gchar *collection_path,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
SecretValue *value,
|
SecretValue *value,
|
||||||
gboolean replace,
|
SecretItemCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -2039,7 +2043,7 @@ secret_service_create_item_dbus_path (SecretService *self,
|
|||||||
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||||
closure->properties = _secret_util_variant_for_properties (properties);
|
closure->properties = _secret_util_variant_for_properties (properties);
|
||||||
g_variant_ref_sink (closure->properties);
|
g_variant_ref_sink (closure->properties);
|
||||||
closure->replace = replace;
|
closure->replace = flags & SECRET_ITEM_CREATE_REPLACE;
|
||||||
closure->value = secret_value_ref (value);
|
closure->value = secret_value_ref (value);
|
||||||
closure->collection_path = g_strdup (collection_path);
|
closure->collection_path = g_strdup (collection_path);
|
||||||
g_simple_async_result_set_op_res_gpointer (res, closure, item_closure_free);
|
g_simple_async_result_set_op_res_gpointer (res, closure, item_closure_free);
|
||||||
@ -2094,7 +2098,7 @@ secret_service_create_item_dbus_path_finish (SecretService *self,
|
|||||||
* @properties: (element-type utf8 GLib.Variant): hash table of D-Bus properties
|
* @properties: (element-type utf8 GLib.Variant): hash table of D-Bus properties
|
||||||
* for the new collection
|
* for the new collection
|
||||||
* @value: the secret value to store in the item
|
* @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
|
* @cancellable: optional cancellation object
|
||||||
* @error: location to place an error on failure
|
* @error: location to place an error on failure
|
||||||
*
|
*
|
||||||
@ -2105,9 +2109,9 @@ secret_service_create_item_dbus_path_finish (SecretService *self,
|
|||||||
* rather than using this function. Using this method requires that you setup
|
* rather than using this function. Using this method requires that you setup
|
||||||
* a correct hash table of D-Bus @properties for the new collection.
|
* 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
|
* If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret
|
||||||
* the attributes (specified in @properties) then the item will be updated
|
* service will search for an item matching the @attributes, and update that item
|
||||||
* instead of creating a new item.
|
* instead of creating a new one.
|
||||||
*
|
*
|
||||||
* @properties is a set of properties for the new collection. The keys in the
|
* @properties is a set of properties for the new collection. The keys in the
|
||||||
* hash table should be interface.property strings like
|
* hash table should be interface.property strings like
|
||||||
@ -2126,7 +2130,7 @@ secret_service_create_item_dbus_path_sync (SecretService *self,
|
|||||||
const gchar *collection_path,
|
const gchar *collection_path,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
SecretValue *value,
|
SecretValue *value,
|
||||||
gboolean replace,
|
SecretItemCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -2142,7 +2146,7 @@ secret_service_create_item_dbus_path_sync (SecretService *self,
|
|||||||
sync = _secret_sync_new ();
|
sync = _secret_sync_new ();
|
||||||
g_main_context_push_thread_default (sync->context);
|
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);
|
cancellable, _secret_sync_on_result, sync);
|
||||||
|
|
||||||
g_main_loop_run (sync->loop);
|
g_main_loop_run (sync->loop);
|
||||||
|
@ -203,6 +203,7 @@ gboolean secret_service_delete_item_dbus_path_sync (SecretSe
|
|||||||
void secret_service_create_collection_dbus_path (SecretService *self,
|
void secret_service_create_collection_dbus_path (SecretService *self,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
const gchar *alias,
|
const gchar *alias,
|
||||||
|
SecretCollectionCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@ -214,6 +215,7 @@ gchar * secret_service_create_collection_dbus_path_finish (SecretSe
|
|||||||
gchar * secret_service_create_collection_dbus_path_sync (SecretService *self,
|
gchar * secret_service_create_collection_dbus_path_sync (SecretService *self,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
const gchar *alias,
|
const gchar *alias,
|
||||||
|
SecretCollectionCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
@ -221,7 +223,7 @@ void secret_service_create_item_dbus_path (SecretSe
|
|||||||
const gchar *collection_path,
|
const gchar *collection_path,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
SecretValue *value,
|
SecretValue *value,
|
||||||
gboolean replace,
|
SecretItemCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@ -234,7 +236,7 @@ gchar * secret_service_create_item_dbus_path_sync (SecretSe
|
|||||||
const gchar *collection_path,
|
const gchar *collection_path,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
SecretValue *value,
|
SecretValue *value,
|
||||||
gboolean replace,
|
SecretItemCreateFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
@ -233,7 +233,8 @@ test_create_sync (Test *test,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
SecretCollection *collection;
|
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_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 (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection"));
|
||||||
@ -252,7 +253,9 @@ test_create_async (Test *test,
|
|||||||
SecretCollection *collection;
|
SecretCollection *collection;
|
||||||
GAsyncResult *result = NULL;
|
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);
|
g_assert (result == NULL);
|
||||||
|
|
||||||
egg_test_wait ();
|
egg_test_wait ();
|
||||||
|
@ -190,7 +190,7 @@ test_create_sync (Test *test,
|
|||||||
value = secret_value_new ("Hoohah", -1, "text/plain");
|
value = secret_value_new ("Hoohah", -1, "text/plain");
|
||||||
|
|
||||||
item = secret_item_create_sync (collection, &MOCK_SCHEMA, attributes, "Tunnel",
|
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_assert_no_error (error);
|
||||||
|
|
||||||
g_hash_table_unref (attributes);
|
g_hash_table_unref (attributes);
|
||||||
@ -229,7 +229,7 @@ test_create_async (Test *test,
|
|||||||
value = secret_value_new ("Hoohah", -1, "text/plain");
|
value = secret_value_new ("Hoohah", -1, "text/plain");
|
||||||
|
|
||||||
secret_item_create (collection, &MOCK_SCHEMA, attributes, "Tunnel",
|
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_assert_no_error (error);
|
||||||
|
|
||||||
g_hash_table_unref (attributes);
|
g_hash_table_unref (attributes);
|
||||||
|
@ -544,7 +544,8 @@ test_collection_sync (Test *test,
|
|||||||
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
|
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
|
||||||
|
|
||||||
path = secret_service_create_collection_dbus_path_sync (test->service, properties,
|
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_hash_table_unref (properties);
|
||||||
|
|
||||||
@ -570,7 +571,8 @@ test_collection_async (Test *test,
|
|||||||
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
|
g_variant_ref_sink (g_variant_new_string ("Wheeee")));
|
||||||
|
|
||||||
secret_service_create_collection_dbus_path (test->service, properties,
|
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_hash_table_unref (properties);
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
@ -615,7 +617,7 @@ test_item_sync (Test *test,
|
|||||||
value = secret_value_new ("andmoreandmore", -1, "text/plain");
|
value = secret_value_new ("andmoreandmore", -1, "text/plain");
|
||||||
|
|
||||||
path = secret_service_create_item_dbus_path_sync (test->service, collection_path,
|
path = secret_service_create_item_dbus_path_sync (test->service, collection_path,
|
||||||
properties, value, FALSE,
|
properties, value, SECRET_ITEM_CREATE_NONE,
|
||||||
NULL, &error);
|
NULL, &error);
|
||||||
|
|
||||||
secret_value_unref (value);
|
secret_value_unref (value);
|
||||||
@ -657,7 +659,7 @@ test_item_async (Test *test,
|
|||||||
value = secret_value_new ("andmoreandmore", -1, "text/plain");
|
value = secret_value_new ("andmoreandmore", -1, "text/plain");
|
||||||
|
|
||||||
secret_service_create_item_dbus_path (test->service, collection_path,
|
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);
|
NULL, on_complete_get_result, &result);
|
||||||
|
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user