diff --git a/docs/reference/libsecret/libsecret-sections.txt b/docs/reference/libsecret/libsecret-sections.txt index d53e2db..3fbba6c 100644 --- a/docs/reference/libsecret/libsecret-sections.txt +++ b/docs/reference/libsecret/libsecret-sections.txt @@ -4,9 +4,6 @@ SecretCollection SecretCollectionClass SecretCollectionFlags -secret_collection_new -secret_collection_new_finish -secret_collection_new_sync secret_collection_load_items secret_collection_load_items_finish secret_collection_load_items_sync @@ -46,9 +43,6 @@ secret_collection_flags_get_type SecretItem SecretItemClass SecretItemFlags -secret_item_new -secret_item_new_finish -secret_item_new_sync secret_item_create secret_item_create_finish secret_item_create_sync @@ -186,7 +180,6 @@ secret_service_new_sync secret_service_get_collections secret_service_get_flags secret_service_get_session_algorithms -secret_service_get_session_path secret_service_ensure_session secret_service_ensure_session_finish secret_service_ensure_session_sync @@ -239,39 +232,46 @@ secret_service_get_type
secret-paths secret/secret-unstable.h -secret_service_search_for_paths -secret_service_search_for_paths_finish -secret_service_search_for_paths_sync -secret_service_get_secrets_for_paths -secret_service_get_secrets_for_paths_finish -secret_service_get_secrets_for_paths_sync -secret_service_get_secret_for_path -secret_service_get_secret_for_path_finish -secret_service_get_secret_for_path_sync -secret_service_lock_paths -secret_service_lock_paths_finish -secret_service_lock_paths_sync -secret_service_unlock_paths -secret_service_unlock_paths_finish -secret_service_unlock_paths_sync -secret_service_prompt_path -secret_service_prompt_path_finish -secret_service_prompt_path_sync -secret_service_create_collection_path -secret_service_create_collection_path_finish -secret_service_create_collection_path_sync -secret_service_create_item_path -secret_service_create_item_path_finish -secret_service_create_item_path_sync -secret_service_delete_path -secret_service_delete_path_finish -secret_service_delete_path_sync -secret_service_read_alias_path -secret_service_read_alias_path_finish -secret_service_read_alias_path_sync -secret_service_set_alias_path -secret_service_set_alias_path_finish -secret_service_set_alias_path_sync +secret_collection_new_for_dbus_path +secret_collection_new_for_dbus_path_finish +secret_collection_new_for_dbus_path_sync +secret_item_new_for_dbus_path +secret_item_new_for_dbus_path_finish +secret_item_new_for_dbus_path_sync +secret_service_get_session_dbus_path +secret_service_search_for_dbus_paths +secret_service_search_for_dbus_paths_finish +secret_service_search_for_dbus_paths_sync +secret_service_get_secrets_for_dbus_paths +secret_service_get_secrets_for_dbus_paths_finish +secret_service_get_secrets_for_dbus_paths_sync +secret_service_get_secret_for_dbus_path +secret_service_get_secret_for_dbus_path_finish +secret_service_get_secret_for_dbus_path_sync +secret_service_lock_dbus_paths +secret_service_lock_dbus_paths_finish +secret_service_lock_dbus_paths_sync +secret_service_unlock_dbus_paths +secret_service_unlock_dbus_paths_finish +secret_service_unlock_dbus_paths_sync +secret_service_prompt_at_dbus_path +secret_service_prompt_at_dbus_path_finish +secret_service_prompt_at_dbus_path_sync +secret_service_create_collection_dbus_path +secret_service_create_collection_dbus_path_finish +secret_service_create_collection_dbus_path_sync +secret_service_create_item_dbus_path +secret_service_create_item_dbus_path_finish +secret_service_create_item_dbus_path_sync +secret_service_delete_item_dbus_path +secret_service_delete_item_dbus_path_finish +secret_service_delete_item_dbus_path_sync +secret_service_read_alias_dbus_path +secret_service_read_alias_dbus_path_finish +secret_service_read_alias_dbus_path_sync +secret_service_set_alias_to_dbus_path +secret_service_set_alias_to_dbus_path_finish +secret_service_set_alias_to_dbus_path_sync
diff --git a/library/secret-collection.c b/library/secret-collection.c index 94d606f..9c51662 100644 --- a/library/secret-collection.c +++ b/library/secret-collection.c @@ -699,131 +699,6 @@ secret_collection_async_initable_iface (GAsyncInitableIface *iface) iface->init_finish = secret_collection_async_initable_init_finish; } -/** - * secret_collection_new: - * @service: (allow-none): a secret service object - * @collection_path: the D-Bus path of the collection - * @flags: options for the collection initialization - * @cancellable: optional cancellation object - * @callback: called when the operation completes - * @user_data: data to be passed to the callback - * - * Get a new collection proxy for a collection in the secret service. - * - * If @service is NULL, then secret_service_get() will be called to get - * the default #SecretService proxy. - * - * This method will return immediately and complete asynchronously. - */ -void -secret_collection_new (SecretService *service, - const gchar *collection_path, - SecretCollectionFlags flags, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GDBusProxy *proxy; - - g_return_if_fail (service == NULL || 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 (SECRET_SERVICE_GET_CLASS (service)->collection_gtype, - G_PRIORITY_DEFAULT, cancellable, callback, user_data, - "g-flags", G_DBUS_CALL_FLAGS_NONE, - "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", SECRET_COLLECTION_INTERFACE, - "service", service, - "flags", flags, - NULL); -} - -/** - * secret_collection_new_finish: - * @result: the asynchronous result passed to the callback - * @error: location to place an error on failure - * - * Finish asynchronous operation to get a new collection proxy for a - * collection in the secret service. - * - * Returns: (transfer full): the new collection, which should be unreferenced - * with g_object_unref() - */ -SecretCollection * -secret_collection_new_finish (GAsyncResult *result, - GError **error) -{ - GObject *source_object; - GObject *object; - - g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL); - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - source_object = g_async_result_get_source_object (result); - object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), - result, error); - g_object_unref (source_object); - - if (object == NULL) - return NULL; - - return SECRET_COLLECTION (object); -} - -/** - * secret_collection_new_sync: - * @service: (allow-none): a secret service object - * @collection_path: the D-Bus path of the collection - * @flags: options for the collection initialization - * @cancellable: optional cancellation object - * @error: location to place an error on failure - * - * Get a new collection proxy for a collection in the secret service. - * - * If @service is NULL, then secret_service_get_sync() will be called to get - * the default #SecretService proxy. - * - * This method may block indefinitely and should not be used in user interface - * threads. - * - * Returns: (transfer full): the new collection, which should be unreferenced - * with g_object_unref() - */ -SecretCollection * -secret_collection_new_sync (SecretService *service, - const gchar *collection_path, - SecretCollectionFlags flags, - GCancellable *cancellable, - GError **error) -{ - GDBusProxy *proxy; - - g_return_val_if_fail (service == NULL || 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 (SECRET_SERVICE_GET_CLASS (service)->collection_gtype, - cancellable, error, - "g-flags", G_DBUS_CALL_FLAGS_NONE, - "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", SECRET_COLLECTION_INTERFACE, - "service", service, - "flags", flags, - NULL); -} - typedef struct { GCancellable *cancellable; GHashTable *items; @@ -853,7 +728,7 @@ on_load_item (GObject *source, closure->items_loading--; - item = secret_item_new_finish (result, &error); + item = secret_item_new_for_dbus_path_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -921,8 +796,8 @@ secret_collection_load_items (SecretCollection *self, /* No such collection yet create a new one */ if (item == NULL) { - secret_item_new (self->pv->service, path, SECRET_ITEM_NONE, - cancellable, on_load_item, g_object_ref (res)); + secret_item_new_for_dbus_path (self->pv->service, path, SECRET_ITEM_NONE, + cancellable, on_load_item, g_object_ref (res)); closure->items_loading++; } else { @@ -1012,9 +887,9 @@ secret_collection_load_items_sync (SecretCollection *self, /* No such collection yet create a new one */ if (item == NULL) { - item = secret_item_new_sync (self->pv->service, path, - SECRET_ITEM_NONE, - cancellable, error); + item = secret_item_new_for_dbus_path_sync (self->pv->service, path, + SECRET_ITEM_NONE, + cancellable, error); if (item == NULL) { ret = FALSE; break; @@ -1079,7 +954,7 @@ on_create_collection (GObject *source, CreateClosure *closure = g_simple_async_result_get_op_res_gpointer (res); GError *error = NULL; - closure->collection = secret_collection_new_finish (result, &error); + closure->collection = secret_collection_new_for_dbus_path_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -1098,11 +973,11 @@ on_create_path (GObject *source, GError *error = NULL; gchar *path; - path = secret_service_create_collection_path_finish (service, result, &error); + path = secret_service_create_collection_dbus_path_finish (service, result, &error); if (error == NULL) { - secret_collection_new (service, path, SECRET_COLLECTION_LOAD_ITEMS, - closure->cancellable, - on_create_collection, g_object_ref (res)); + secret_collection_new_for_dbus_path (service, path, SECRET_COLLECTION_LOAD_ITEMS, + closure->cancellable, + on_create_collection, g_object_ref (res)); } else { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); @@ -1123,9 +998,9 @@ on_create_service (GObject *source, service = secret_service_get_finish (result, &error); if (error == NULL) { - secret_service_create_collection_path (service, create->properties, - create->alias, create->cancellable, - on_create_path, g_object_ref (async)); + secret_service_create_collection_dbus_path (service, create->properties, + create->alias, create->cancellable, + on_create_path, g_object_ref (async)); g_object_unref (service); } else { @@ -1205,9 +1080,9 @@ secret_collection_create (SecretService *service, on_create_service, g_object_ref (res)); } else { - secret_service_create_collection_path (service, closure->properties, - closure->alias, closure->cancellable, - on_create_path, g_object_ref (res)); + secret_service_create_collection_dbus_path (service, closure->properties, + closure->alias, closure->cancellable, + on_create_path, g_object_ref (res)); } g_object_unref (res); @@ -1298,8 +1173,8 @@ secret_collection_create_sync (SecretService *service, properties = collection_properties_new (label); - path = secret_service_create_collection_path_sync (service, properties, alias, - cancellable, error); + path = secret_service_create_collection_dbus_path_sync (service, properties, alias, + cancellable, error); g_hash_table_unref (properties); @@ -1308,9 +1183,9 @@ secret_collection_create_sync (SecretService *service, return NULL; } - collection = secret_collection_new_sync (service, path, - SECRET_COLLECTION_LOAD_ITEMS, - cancellable, error); + collection = secret_collection_new_for_dbus_path_sync (service, path, + SECRET_COLLECTION_LOAD_ITEMS, + cancellable, error); g_object_unref (service); g_free (path); @@ -1326,7 +1201,7 @@ on_service_delete_path (GObject *source, GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data); GError *error = NULL; - secret_service_delete_path_finish (SECRET_SERVICE (source), result, &error); + _secret_service_delete_path_finish (SECRET_SERVICE (source), result, &error); if (error != NULL) g_simple_async_result_take_error (async, error); g_simple_async_result_complete (async); diff --git a/library/secret-collection.h b/library/secret-collection.h index 89fb111..ca9c15b 100644 --- a/library/secret-collection.h +++ b/library/secret-collection.h @@ -56,22 +56,6 @@ struct _SecretCollectionClass { GType secret_collection_get_type (void) G_GNUC_CONST; -void secret_collection_new (SecretService *service, - const gchar *collection_path, - SecretCollectionFlags flags, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -SecretCollection * secret_collection_new_finish (GAsyncResult *result, - GError **error); - -SecretCollection * secret_collection_new_sync (SecretService *service, - const gchar *collection_path, - SecretCollectionFlags flags, - GCancellable *cancellable, - GError **error); - void secret_collection_load_items (SecretCollection *self, GCancellable *cancellable, GAsyncReadyCallback callback, diff --git a/library/secret-item.c b/library/secret-item.c index 5219092..910b652 100644 --- a/library/secret-item.c +++ b/library/secret-item.c @@ -597,128 +597,6 @@ secret_item_async_initable_iface (GAsyncInitableIface *iface) iface->init_finish = secret_item_async_initable_init_finish; } -/** - * secret_item_new: - * @service: (allow-none): a secret service object - * @item_path: the D-Bus path of the collection - * @flags: initialization flags for the new item - * @cancellable: optional cancellation object - * @callback: called when the operation completes - * @user_data: data to be passed to the callback - * - * Get a new item proxy for a secret item in the secret service. - * - * If @service is NULL, then secret_service_get() will be called to get - * the default #SecretService proxy. - * - * This method will return immediately and complete asynchronously. - */ -void -secret_item_new (SecretService *service, - const gchar *item_path, - SecretItemFlags flags, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GDBusProxy *proxy; - - g_return_if_fail (service == NULL || 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 (SECRET_SERVICE_GET_CLASS (service)->item_gtype, - G_PRIORITY_DEFAULT, cancellable, callback, user_data, - "g-flags", G_DBUS_CALL_FLAGS_NONE, - "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", SECRET_ITEM_INTERFACE, - "service", service, - "flags", flags, - NULL); -} - -/** - * secret_item_new_finish: - * @result: the asynchronous result passed to the callback - * @error: location to place an error on failure - * - * Finish asynchronous operation to get a new item proxy for an secret - * item in the secret service. - * - * Returns: (transfer full): the new item, which should be unreferenced - * with g_object_unref() - */ -SecretItem * -secret_item_new_finish (GAsyncResult *result, - GError **error) -{ - GObject *object; - GObject *source_object; - - source_object = g_async_result_get_source_object (result); - object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), - result, error); - g_object_unref (source_object); - - if (object == NULL) - return NULL; - - return SECRET_ITEM (object); -} - -/** - * secret_item_new_sync: - * @service: (allow-none): a secret service object - * @item_path: the D-Bus path of the item - * @flags: initialization flags for the new item - * @cancellable: optional cancellation object - * @error: location to place an error on failure - * - * Get a new item proxy for a secret item in the secret service. - * - * If @service is NULL, then secret_service_get_sync() will be called to get - * the default #SecretService proxy. - * - * This method may block indefinitely and should not be used in user interface - * threads. - * - * Returns: (transfer full): the new item, which should be unreferenced - * with g_object_unref() - */ -SecretItem * -secret_item_new_sync (SecretService *service, - const gchar *item_path, - SecretItemFlags flags, - GCancellable *cancellable, - GError **error) -{ - GDBusProxy *proxy; - - g_return_val_if_fail (service == NULL || 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 (SECRET_SERVICE_GET_CLASS (service)->item_gtype, - cancellable, error, - "g-flags", G_DBUS_CALL_FLAGS_NONE, - "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", SECRET_ITEM_INTERFACE, - "service", service, - "flags", flags, - NULL); -} - /** * secret_item_refresh: * @self: the collection @@ -795,7 +673,7 @@ on_create_item (GObject *source, CreateClosure *closure = g_simple_async_result_get_op_res_gpointer (res); GError *error = NULL; - closure->item = secret_item_new_finish (result, &error); + closure->item = secret_item_new_for_dbus_path_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -817,11 +695,11 @@ on_create_path (GObject *source, GError *error = NULL; gchar *path; - path = secret_service_create_item_path_finish (service, result, &error); + path = secret_service_create_item_dbus_path_finish (service, result, &error); if (error == NULL) { - secret_item_new (service, path, SECRET_ITEM_NONE, - closure->cancellable, on_create_item, - g_object_ref (res)); + secret_item_new_for_dbus_path (service, path, SECRET_ITEM_NONE, + closure->cancellable, on_create_item, + g_object_ref (res)); } else { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); @@ -908,9 +786,9 @@ secret_item_create (SecretCollection *collection, collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)); - secret_service_create_item_path (service, collection_path, properties, - value, replace, cancellable, - on_create_path, g_object_ref (res)); + secret_service_create_item_dbus_path (service, collection_path, properties, + value, replace, cancellable, + on_create_path, g_object_ref (res)); g_hash_table_unref (properties); g_object_unref (service); @@ -1000,12 +878,12 @@ secret_item_create_sync (SecretCollection *collection, collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)); - path = secret_service_create_item_path_sync (service, collection_path, properties, - value, replace, cancellable, error); + path = secret_service_create_item_dbus_path_sync (service, collection_path, properties, + value, replace, cancellable, error); if (path != NULL) { - item = secret_item_new_sync (service, path, SECRET_ITEM_NONE, - cancellable, error); + item = secret_item_new_for_dbus_path_sync (service, path, SECRET_ITEM_NONE, + cancellable, error); g_free (path); } @@ -1024,7 +902,7 @@ on_item_deleted (GObject *source, SecretItem *self = SECRET_ITEM (g_async_result_get_source_object (user_data)); GError *error = NULL; - if (secret_service_delete_path_finish (SECRET_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); if (error != NULL) @@ -1279,12 +1157,13 @@ on_load_ensure_session (GObject *source, const gchar *session_path; GError *error = NULL; - session_path = secret_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_path = secret_service_get_session_dbus_path (self->pv->service); g_assert (session_path != NULL && session_path[0] != '\0'); g_dbus_proxy_call (G_DBUS_PROXY (self), "GetSecret", g_variant_new ("(o)", session_path), @@ -1481,13 +1360,13 @@ on_loads_secrets_session (GObject *source, GError *error = NULL; const gchar *session; - session = secret_service_ensure_session_finish (SECRET_SERVICE (source), - result, &error); + secret_service_ensure_session_finish (SECRET_SERVICE (source), result, &error); if (error != NULL) { g_simple_async_result_take_error (async, error); g_simple_async_result_complete (async); } else { + session = secret_service_get_session_dbus_path (SECRET_SERVICE (source)); g_dbus_proxy_call (G_DBUS_PROXY (source), "GetSecrets", g_variant_new ("(@aoo)", loads->in, session), G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, diff --git a/library/secret-item.h b/library/secret-item.h index ffcbe5c..b1fdcf2 100644 --- a/library/secret-item.h +++ b/library/secret-item.h @@ -58,22 +58,6 @@ struct _SecretItemClass { GType secret_item_get_type (void) G_GNUC_CONST; -void secret_item_new (SecretService *service, - const gchar *item_path, - SecretItemFlags flags, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -SecretItem * secret_item_new_finish (GAsyncResult *result, - GError **error); - -SecretItem * secret_item_new_sync (SecretService *service, - const gchar *item_path, - SecretItemFlags flags, - GCancellable *cancellable, - GError **error); - void secret_item_refresh (SecretItem *self); void secret_item_create (SecretCollection *collection, diff --git a/library/secret-methods.c b/library/secret-methods.c index 2a5b467..97901d9 100644 --- a/library/secret-methods.c +++ b/library/secret-methods.c @@ -127,7 +127,7 @@ on_search_loaded (GObject *source, closure->loading--; - item = secret_item_new_finish (result, &error); + item = secret_item_new_for_dbus_path_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -170,8 +170,8 @@ search_load_item_async (SecretService *self, item = _secret_service_find_item_instance (self, path); if (item == NULL) { - secret_item_new (self, path, SECRET_ITEM_NONE, closure->cancellable, - on_search_loaded, g_object_ref (res)); + secret_item_new_for_dbus_path (self, path, SECRET_ITEM_NONE, closure->cancellable, + on_search_loaded, g_object_ref (res)); closure->loading++; } else { search_closure_take_item (closure, item); @@ -190,8 +190,8 @@ on_search_paths (GObject *source, gint want = 1; guint i; - secret_service_search_for_paths_finish (self, result, &closure->unlocked, - &closure->locked, &error); + secret_service_search_for_dbus_paths_finish (self, result, &closure->unlocked, + &closure->locked, &error); if (error == NULL) { want = 1; if (closure->flags & SECRET_SEARCH_ALL) @@ -367,8 +367,8 @@ service_load_items_sync (SecretService *service, for (i = 0; *have < want && paths[i] != NULL; i++) { item = _secret_service_find_item_instance (service, paths[i]); if (item == NULL) - item = secret_item_new_sync (service, paths[i], SECRET_ITEM_NONE, - cancellable, error); + item = secret_item_new_for_dbus_path_sync (service, paths[i], SECRET_ITEM_NONE, + cancellable, error); if (item == NULL) { return FALSE; @@ -448,8 +448,8 @@ secret_service_search_sync (SecretService *service, g_object_ref (service); } - if (!secret_service_search_for_paths_sync (service, schema, attributes, cancellable, - &unlocked_paths, &locked_paths, error)) { + if (!secret_service_search_for_dbus_paths_sync (service, schema, attributes, cancellable, + &unlocked_paths, &locked_paths, error)) { g_object_unref (service); return NULL; } @@ -714,10 +714,6 @@ service_xlock_finish (SecretService *service, * * Lock items or collections in the secret service. * - * This method takes a list of #SecretItem or #SecretCollection proxy objects. - * If you only have the D-Bus object paths of the items or collections, use - * secret_service_lock_paths() instead. - * * The secret service may not be able to lock items individually, and may * lock an entire collection instead. * @@ -780,10 +776,6 @@ secret_service_lock_finish (SecretService *service, * * Lock items or collections in the secret service. * - * This method takes a list of #SecretItem or #SecretCollection proxy objects. - * If you only have the D-Bus object paths of the items or collections, use - * secret_service_lock_paths_sync() instead. - * * The secret service may not be able to lock items individually, and may * lock an entire collection instead. * @@ -836,10 +828,6 @@ secret_service_lock_sync (SecretService *service, * * Unlock items or collections in the secret service. * - * This method takes a list of #SecretItem or #SecretCollection proxy objects. - * If you only have the D-Bus object paths of the items or collections, use - * secret_service_unlock_paths() instead. - * * The secret service may not be able to unlock items individually, and may * unlock an entire collection instead. * @@ -902,10 +890,6 @@ secret_service_unlock_finish (SecretService *service, * * Unlock items or collections in the secret service. * - * This method takes a list of #SecretItem or #SecretCollection proxy objects. - * If you only have the D-Bus object paths of the items or collections, use - * secret_service_unlock_paths_sync() instead. - * * The secret service may not be able to unlock items individually, and may * unlock an entire collection instead. * @@ -976,7 +960,7 @@ on_store_create (GObject *source, GError *error = NULL; gchar *path; - path = secret_service_create_item_path_finish (SECRET_SERVICE (source), result, &error); + path = secret_service_create_item_dbus_path_finish (SECRET_SERVICE (source), result, &error); if (error != NULL) g_simple_async_result_take_error (async, error); g_free (path); @@ -997,10 +981,10 @@ on_store_service (GObject *source, service = secret_service_get_finish (result, &error); if (error == NULL) { - secret_service_create_item_path (service, store->collection_path, - store->properties, store->value, - TRUE, store->cancellable, - on_store_create, g_object_ref (async)); + secret_service_create_item_dbus_path (service, store->collection_path, + store->properties, store->value, + TRUE, store->cancellable, + on_store_create, g_object_ref (async)); g_object_unref (service); } else { @@ -1093,10 +1077,10 @@ secret_service_store (SecretService *service, on_store_service, g_object_ref (async)); } else { - secret_service_create_item_path (service, store->collection_path, - store->properties, store->value, - TRUE, store->cancellable, - on_store_create, g_object_ref (async)); + secret_service_create_item_dbus_path (service, store->collection_path, + store->properties, store->value, + TRUE, store->cancellable, + on_store_create, g_object_ref (async)); } g_object_unref (async); @@ -1225,7 +1209,7 @@ on_lookup_get_secret (GObject *source, SecretService *self = SECRET_SERVICE (source); GError *error = NULL; - closure->value = secret_service_get_secret_for_path_finish (self, result, &error); + closure->value = secret_service_get_secret_for_dbus_path_finish (self, result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -1244,17 +1228,17 @@ on_lookup_unlocked (GObject *source, GError *error = NULL; gchar **unlocked = NULL; - secret_service_unlock_paths_finish (SECRET_SERVICE (source), - result, &unlocked, &error); + secret_service_unlock_dbus_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]) { - secret_service_get_secret_for_path (self, unlocked[0], - closure->cancellable, - on_lookup_get_secret, - g_object_ref (res)); + secret_service_get_secret_for_dbus_path (self, unlocked[0], + closure->cancellable, + on_lookup_get_secret, + g_object_ref (res)); } else { g_simple_async_result_complete (res); @@ -1276,23 +1260,23 @@ on_lookup_searched (GObject *source, gchar **unlocked = NULL; gchar **locked = NULL; - secret_service_search_for_paths_finish (self, result, &unlocked, &locked, &error); + secret_service_search_for_dbus_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]) { - secret_service_get_secret_for_path (self, unlocked[0], - closure->cancellable, - on_lookup_get_secret, - g_object_ref (res)); + secret_service_get_secret_for_dbus_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 }; - secret_service_unlock_paths (self, paths, - closure->cancellable, - on_lookup_unlocked, - g_object_ref (res)); + secret_service_unlock_dbus_paths (self, paths, + closure->cancellable, + on_lookup_unlocked, + g_object_ref (res)); } else { g_simple_async_result_complete (res); @@ -1510,7 +1494,7 @@ on_delete_password_complete (GObject *source, DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (res); GError *error = NULL; - closure->deleted = secret_service_delete_path_finish (SECRET_SERVICE (source), result, &error); + closure->deleted = _secret_service_delete_path_finish (SECRET_SERVICE (source), result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -1531,7 +1515,7 @@ on_delete_searched (GObject *source, gchar **locked; gchar **unlocked; - secret_service_search_for_paths_finish (SECRET_SERVICE (source), result, &unlocked, &locked, &error); + secret_service_search_for_dbus_paths_finish (SECRET_SERVICE (source), result, &unlocked, &locked, &error); if (error != NULL) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); @@ -1765,7 +1749,7 @@ on_read_alias_collection (GObject *source, ReadClosure *read = g_simple_async_result_get_op_res_gpointer (async); GError *error = NULL; - read->collection = secret_collection_new_finish (result, &error); + read->collection = secret_collection_new_for_dbus_path_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (async, error); @@ -1784,7 +1768,7 @@ on_read_alias_path (GObject *source, GError *error = NULL; gchar *collection_path; - collection_path = secret_service_read_alias_path_finish (self, result, &error); + collection_path = secret_service_read_alias_dbus_path_finish (self, result, &error); if (error == NULL) { /* No collection for this alias */ @@ -1799,9 +1783,11 @@ on_read_alias_path (GObject *source, /* No collection loaded, but valid path, load */ } else { - secret_collection_new (self, collection_path, SECRET_COLLECTION_NONE, - read->cancellable, - on_read_alias_collection, g_object_ref (async)); + secret_collection_new_for_dbus_path (self, collection_path, + SECRET_COLLECTION_NONE, + read->cancellable, + on_read_alias_collection, + g_object_ref (async)); } } @@ -1826,8 +1812,8 @@ on_read_alias_service (GObject *source, service = secret_service_get_finish (result, &error); if (error == NULL) { - secret_service_read_alias_path (service, read->alias, read->cancellable, - on_read_alias_path, g_object_ref (async)); + secret_service_read_alias_dbus_path (service, read->alias, read->cancellable, + on_read_alias_path, g_object_ref (async)); g_object_unref (service); } else { @@ -1879,8 +1865,8 @@ secret_service_read_alias (SecretService *service, secret_service_get (SECRET_SERVICE_NONE, cancellable, on_read_alias_service, g_object_ref (async)); } else { - secret_service_read_alias_path (service, read->alias, read->cancellable, - on_read_alias_path, g_object_ref (async)); + secret_service_read_alias_dbus_path (service, read->alias, read->cancellable, + on_read_alias_path, g_object_ref (async)); } g_object_unref (async); @@ -1950,8 +1936,8 @@ secret_service_read_alias_sync (SecretService *service, g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); - collection_path = secret_service_read_alias_path_sync (service, alias, - cancellable, error); + collection_path = secret_service_read_alias_dbus_path_sync (service, alias, + cancellable, error); if (collection_path == NULL) return NULL; @@ -1965,9 +1951,9 @@ secret_service_read_alias_sync (SecretService *service, /* No collection loaded, but valid path, load */ if (collection == NULL) { - collection = secret_collection_new_sync (service, collection_path, - SECRET_COLLECTION_LOAD_ITEMS, - cancellable, error); + collection = secret_collection_new_for_dbus_path_sync (service, collection_path, + SECRET_COLLECTION_LOAD_ITEMS, + cancellable, error); } } @@ -2021,8 +2007,8 @@ secret_service_set_alias (SecretService *service, g_object_ref (service); } - secret_service_set_alias_path (service, alias, collection_path, cancellable, - callback, user_data); + secret_service_set_alias_to_dbus_path (service, alias, collection_path, cancellable, + callback, user_data); g_object_unref (service); } @@ -2052,7 +2038,7 @@ secret_service_set_alias_finish (SecretService *service, else g_object_ref (service); - ret = secret_service_set_alias_path_finish (service, result, error); + ret = secret_service_set_alias_to_dbus_path_finish (service, result, error); g_object_unref (service); diff --git a/library/secret-paths.c b/library/secret-paths.c index f757741..d1bde90 100644 --- a/library/secret-paths.c +++ b/library/secret-paths.c @@ -39,6 +39,254 @@ * Stability: Unstable */ +/** + * secret_collection_new_for_dbus_path: + * @service: (allow-none): a secret service object + * @collection_path: the D-Bus path of the collection + * @flags: options for the collection initialization + * @cancellable: optional cancellation object + * @callback: called when the operation completes + * @user_data: data to be passed to the callback + * + * Get a new collection proxy for a collection in the secret service. + * + * If @service is NULL, then secret_service_get() will be called to get + * the default #SecretService proxy. + * + * This method will return immediately and complete asynchronously. + */ +void +secret_collection_new_for_dbus_path (SecretService *service, + const gchar *collection_path, + SecretCollectionFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GDBusProxy *proxy; + + g_return_if_fail (service == NULL || 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 (SECRET_SERVICE_GET_CLASS (service)->collection_gtype, + G_PRIORITY_DEFAULT, cancellable, callback, user_data, + "g-flags", G_DBUS_CALL_FLAGS_NONE, + "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", SECRET_COLLECTION_INTERFACE, + "service", service, + "flags", flags, + NULL); +} + +/** + * secret_collection_new_for_dbus_path_finish: + * @result: the asynchronous result passed to the callback + * @error: location to place an error on failure + * + * Finish asynchronous operation to get a new collection proxy for a + * collection in the secret service. + * + * Returns: (transfer full): the new collection, which should be unreferenced + * with g_object_unref() + */ +SecretCollection * +secret_collection_new_for_dbus_path_finish (GAsyncResult *result, + GError **error) +{ + GObject *source_object; + GObject *object; + + g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL); + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + + source_object = g_async_result_get_source_object (result); + object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), + result, error); + g_object_unref (source_object); + + if (object == NULL) + return NULL; + + return SECRET_COLLECTION (object); +} + +/** + * secret_collection_new_for_dbus_path_sync: + * @service: (allow-none): a secret service object + * @collection_path: the D-Bus path of the collection + * @flags: options for the collection initialization + * @cancellable: optional cancellation object + * @error: location to place an error on failure + * + * Get a new collection proxy for a collection in the secret service. + * + * If @service is NULL, then secret_service_get_sync() will be called to get + * the default #SecretService proxy. + * + * This method may block indefinitely and should not be used in user interface + * threads. + * + * Returns: (transfer full): the new collection, which should be unreferenced + * with g_object_unref() + */ +SecretCollection * +secret_collection_new_for_dbus_path_sync (SecretService *service, + const gchar *collection_path, + SecretCollectionFlags flags, + GCancellable *cancellable, + GError **error) +{ + GDBusProxy *proxy; + + g_return_val_if_fail (service == NULL || 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 (SECRET_SERVICE_GET_CLASS (service)->collection_gtype, + cancellable, error, + "g-flags", G_DBUS_CALL_FLAGS_NONE, + "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", SECRET_COLLECTION_INTERFACE, + "service", service, + "flags", flags, + NULL); +} + +/** + * secret_item_new_for_dbus_path: + * @service: (allow-none): a secret service object + * @item_path: the D-Bus path of the collection + * @flags: initialization flags for the new item + * @cancellable: optional cancellation object + * @callback: called when the operation completes + * @user_data: data to be passed to the callback + * + * Get a new item proxy for a secret item in the secret service. + * + * If @service is NULL, then secret_service_get() will be called to get + * the default #SecretService proxy. + * + * This method will return immediately and complete asynchronously. + */ +void +secret_item_new_for_dbus_path (SecretService *service, + const gchar *item_path, + SecretItemFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GDBusProxy *proxy; + + g_return_if_fail (service == NULL || 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 (SECRET_SERVICE_GET_CLASS (service)->item_gtype, + G_PRIORITY_DEFAULT, cancellable, callback, user_data, + "g-flags", G_DBUS_CALL_FLAGS_NONE, + "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", SECRET_ITEM_INTERFACE, + "service", service, + "flags", flags, + NULL); +} + +/** + * secret_item_new_for_dbus_path_finish: + * @result: the asynchronous result passed to the callback + * @error: location to place an error on failure + * + * Finish asynchronous operation to get a new item proxy for an secret + * item in the secret service. + * + * Returns: (transfer full): the new item, which should be unreferenced + * with g_object_unref() + */ +SecretItem * +secret_item_new_for_dbus_path_finish (GAsyncResult *result, + GError **error) +{ + GObject *object; + GObject *source_object; + + source_object = g_async_result_get_source_object (result); + object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), + result, error); + g_object_unref (source_object); + + if (object == NULL) + return NULL; + + return SECRET_ITEM (object); +} + +/** + * secret_item_new_dbus_path_sync: + * @service: (allow-none): a secret service object + * @item_path: the D-Bus path of the item + * @flags: initialization flags for the new item + * @cancellable: optional cancellation object + * @error: location to place an error on failure + * + * Get a new item proxy for a secret item in the secret service. + * + * If @service is NULL, then secret_service_get_sync() will be called to get + * the default #SecretService proxy. + * + * This method may block indefinitely and should not be used in user interface + * threads. + * + * Returns: (transfer full): the new item, which should be unreferenced + * with g_object_unref() + */ +SecretItem * +secret_item_new_for_dbus_path_sync (SecretService *service, + const gchar *item_path, + SecretItemFlags flags, + GCancellable *cancellable, + GError **error) +{ + GDBusProxy *proxy; + + g_return_val_if_fail (service == NULL || 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 (SECRET_SERVICE_GET_CLASS (service)->item_gtype, + cancellable, error, + "g-flags", G_DBUS_CALL_FLAGS_NONE, + "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", SECRET_ITEM_INTERFACE, + "service", service, + "flags", flags, + NULL); +} + + static void on_search_items_complete (GObject *source, GAsyncResult *result, @@ -60,7 +308,7 @@ on_search_items_complete (GObject *source, } /** - * secret_service_search_for_paths: + * secret_service_search_for_dbus_paths: * @self: the secret service * @schema: (allow-none): the schema for the attributes * @attributes: (element-type utf8 utf8): search for items matching these attributes @@ -74,18 +322,18 @@ on_search_items_complete (GObject *source, * * This function returns immediately and completes asynchronously. * - * When your callback is called use secret_service_search_for_paths_finish() + * When your callback is called use secret_service_search_for_dbus_paths_finish() * to get the results of this function. Only the D-Bus object paths of the * items will be returned. If you would like #SecretItem objects to be returned * instead, then use the secret_service_search() function. */ void -secret_service_search_for_paths (SecretService *self, - const SecretSchema *schema, - GHashTable *attributes, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_search_for_dbus_paths (SecretService *self, + const SecretSchema *schema, + GHashTable *attributes, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { const gchar *schema_name = NULL; @@ -118,7 +366,7 @@ _secret_service_search_for_paths_variant (SecretService *self, g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - secret_service_search_for_paths); + secret_service_search_for_dbus_paths); g_dbus_proxy_call (G_DBUS_PROXY (self), "SearchItems", g_variant_new ("(@a{ss})", attributes), @@ -129,7 +377,7 @@ _secret_service_search_for_paths_variant (SecretService *self, } /** - * secret_service_search_for_paths_finish: + * secret_service_search_for_dbus_paths_finish: * @self: the secret service * @result: asynchronous result passed to callback * @unlocked: (out) (transfer full) (array zero-terminated=1) (allow-none): @@ -154,18 +402,18 @@ _secret_service_search_for_paths_variant (SecretService *self, * Returns: whether the search was successful or not */ gboolean -secret_service_search_for_paths_finish (SecretService *self, - GAsyncResult *result, - gchar ***unlocked, - gchar ***locked, - GError **error) +secret_service_search_for_dbus_paths_finish (SecretService *self, + GAsyncResult *result, + gchar ***unlocked, + gchar ***locked, + GError **error) { GVariant *response; GSimpleAsyncResult *res; gchar **dummy = NULL; g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - secret_service_search_for_paths), FALSE); + secret_service_search_for_dbus_paths), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); res = G_SIMPLE_ASYNC_RESULT (result); @@ -186,7 +434,7 @@ secret_service_search_for_paths_finish (SecretService *self, } /** - * secret_service_search_for_paths_sync: + * secret_service_search_for_dbus_paths_sync: * @self: the secret service * @schema: (allow-none): the schema for the attributes * @attributes: (element-type utf8 utf8): search for items matching these attributes @@ -216,13 +464,13 @@ secret_service_search_for_paths_finish (SecretService *self, * Returns: whether the search was successful or not */ gboolean -secret_service_search_for_paths_sync (SecretService *self, - const SecretSchema *schema, - GHashTable *attributes, - GCancellable *cancellable, - gchar ***unlocked, - gchar ***locked, - GError **error) +secret_service_search_for_dbus_paths_sync (SecretService *self, + const SecretSchema *schema, + GHashTable *attributes, + GCancellable *cancellable, + gchar ***unlocked, + gchar ***locked, + GError **error) { const gchar *schema_name = NULL; gchar **dummy = NULL; @@ -308,12 +556,12 @@ on_get_secrets_session (GObject *source, GError *error = NULL; const gchar *session; - session = secret_service_ensure_session_finish (SECRET_SERVICE (source), - result, &error); + secret_service_ensure_session_finish (SECRET_SERVICE (source), result, &error); if (error != NULL) { g_simple_async_result_take_error (res, error); g_simple_async_result_complete (res); } else { + session = secret_service_get_session_dbus_path (SECRET_SERVICE (source)); g_dbus_proxy_call (G_DBUS_PROXY (source), "GetSecrets", g_variant_new ("(@aoo)", closure->in, session), G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, @@ -325,7 +573,7 @@ on_get_secrets_session (GObject *source, } /** - * secret_service_get_secret_for_path: + * secret_service_get_secret_for_dbus_path: * @self: the secret service * @item_path: the D-Bus path to item to retrieve secret for * @cancellable: optional cancellation object @@ -341,11 +589,11 @@ on_get_secrets_session (GObject *source, * This function returns immediately and completes asynchronously. */ void -secret_service_get_secret_for_path (SecretService *self, - const gchar *item_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_get_secret_for_dbus_path (SecretService *self, + const gchar *item_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { GSimpleAsyncResult *res; GetClosure *closure; @@ -355,7 +603,7 @@ secret_service_get_secret_for_path (SecretService *self, g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - secret_service_get_secret_for_path); + secret_service_get_secret_for_dbus_path); closure = g_slice_new0 (GetClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; @@ -370,7 +618,7 @@ secret_service_get_secret_for_path (SecretService *self, } /** - * secret_service_get_secret_for_path_finish: + * secret_service_get_secret_for_dbus_path_finish: * @self: the secret service * @result: asynchronous result passed to callback * @error: location to place an error on failure @@ -384,16 +632,16 @@ secret_service_get_secret_for_path (SecretService *self, * for the item, which should be released with secret_value_unref() */ SecretValue * -secret_service_get_secret_for_path_finish (SecretService *self, - GAsyncResult *result, - GError **error) +secret_service_get_secret_for_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error) { GSimpleAsyncResult *res; GetClosure *closure; 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), - secret_service_get_secret_for_path), NULL); + secret_service_get_secret_for_dbus_path), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -405,7 +653,7 @@ secret_service_get_secret_for_path_finish (SecretService *self, } /** - * secret_service_get_secret_for_path_sync: + * secret_service_get_secret_for_dbus_path_sync: * @self: the secret service * @item_path: the D-Bus path to item to retrieve secret for * @cancellable: optional cancellation object @@ -426,10 +674,10 @@ secret_service_get_secret_for_path_finish (SecretService *self, * for the item, which should be released with secret_value_unref() */ SecretValue * -secret_service_get_secret_for_path_sync (SecretService *self, - const gchar *item_path, - GCancellable *cancellable, - GError **error) +secret_service_get_secret_for_dbus_path_sync (SecretService *self, + const gchar *item_path, + GCancellable *cancellable, + GError **error) { SecretSync *sync; SecretValue *value; @@ -442,12 +690,12 @@ secret_service_get_secret_for_path_sync (SecretService *self, sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - secret_service_get_secret_for_path (self, item_path, cancellable, - _secret_sync_on_result, sync); + secret_service_get_secret_for_dbus_path (self, item_path, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - value = secret_service_get_secret_for_path_finish (self, sync->result, error); + value = secret_service_get_secret_for_dbus_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); @@ -456,7 +704,7 @@ secret_service_get_secret_for_path_sync (SecretService *self, } /** - * secret_service_get_secrets_for_paths: + * secret_service_get_secrets_for_dbus_paths: * @self: the secret service * @item_paths: the D-Bus paths to items to retrieve secrets for * @cancellable: optional cancellation object @@ -472,11 +720,11 @@ secret_service_get_secret_for_path_sync (SecretService *self, * This function returns immediately and completes asynchronously. */ void -secret_service_get_secrets_for_paths (SecretService *self, - const gchar **item_paths, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_get_secrets_for_dbus_paths (SecretService *self, + const gchar **item_paths, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { GSimpleAsyncResult *res; GetClosure *closure; @@ -486,7 +734,7 @@ secret_service_get_secrets_for_paths (SecretService *self, g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - secret_service_get_secret_for_path); + secret_service_get_secret_for_dbus_path); closure = g_slice_new0 (GetClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; @@ -501,7 +749,7 @@ secret_service_get_secrets_for_paths (SecretService *self, } /** - * secret_service_get_secrets_for_paths_finish: + * secret_service_get_secrets_for_dbus_paths_finish: * @self: the secret service * @result: asynchronous result passed to callback * @error: location to place an error on failure @@ -515,16 +763,16 @@ secret_service_get_secrets_for_paths (SecretService *self, * #SecretValue values. */ GHashTable * -secret_service_get_secrets_for_paths_finish (SecretService *self, - GAsyncResult *result, - GError **error) +secret_service_get_secrets_for_dbus_paths_finish (SecretService *self, + GAsyncResult *result, + GError **error) { GSimpleAsyncResult *res; GetClosure *closure; 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), - secret_service_get_secret_for_path), NULL); + secret_service_get_secret_for_dbus_path), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -536,7 +784,7 @@ secret_service_get_secrets_for_paths_finish (SecretService *self, } /** - * secret_service_get_secrets_for_paths_sync: + * secret_service_get_secrets_for_dbus_paths_sync: * @self: the secret service * @item_paths: the D-Bus paths to items to retrieve secrets for * @cancellable: optional cancellation object @@ -557,10 +805,10 @@ secret_service_get_secrets_for_paths_finish (SecretService *self, * #SecretValue values. */ GHashTable * -secret_service_get_secrets_for_paths_sync (SecretService *self, - const gchar **item_paths, - GCancellable *cancellable, - GError **error) +secret_service_get_secrets_for_dbus_paths_sync (SecretService *self, + const gchar **item_paths, + GCancellable *cancellable, + GError **error) { SecretSync *sync; GHashTable *secrets; @@ -573,12 +821,12 @@ secret_service_get_secrets_for_paths_sync (SecretService *self, sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - secret_service_get_secrets_for_paths (self, item_paths, cancellable, - _secret_sync_on_result, sync); + secret_service_get_secrets_for_dbus_paths (self, item_paths, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - secrets = secret_service_get_secrets_for_paths_finish (self, sync->result, error); + secrets = secret_service_get_secrets_for_dbus_paths_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); @@ -726,7 +974,7 @@ _secret_service_xlock_paths_finish (SecretService *self, } /** - * secret_service_lock_paths_sync: + * secret_service_lock_dbus_paths_sync: * @self: the secret service * @paths: the D-Bus object paths of the items or collections to lock * @cancellable: optional cancellation object @@ -751,11 +999,11 @@ _secret_service_xlock_paths_finish (SecretService *self, * Returns: the number of items or collections that were locked */ gint -secret_service_lock_paths_sync (SecretService *self, - const gchar **paths, - GCancellable *cancellable, - gchar ***locked, - GError **error) +secret_service_lock_dbus_paths_sync (SecretService *self, + const gchar **paths, + GCancellable *cancellable, + gchar ***locked, + GError **error) { SecretSync *sync; gint count; @@ -768,13 +1016,13 @@ secret_service_lock_paths_sync (SecretService *self, sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - secret_service_lock_paths (self, paths, cancellable, - _secret_sync_on_result, sync); + secret_service_lock_dbus_paths (self, paths, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - count = secret_service_lock_paths_finish (self, sync->result, - locked, error); + count = secret_service_lock_dbus_paths_finish (self, sync->result, + locked, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); @@ -783,7 +1031,7 @@ secret_service_lock_paths_sync (SecretService *self, } /** - * secret_service_lock_paths: + * secret_service_lock_dbus_paths: * @self: the secret service * @paths: the D-Bus paths for items or collections to lock * @cancellable: optional cancellation object @@ -804,11 +1052,11 @@ secret_service_lock_paths_sync (SecretService *self, * any prompts that show up. */ void -secret_service_lock_paths (SecretService *self, - const gchar **paths, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_lock_dbus_paths (SecretService *self, + const gchar **paths, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (paths != NULL); @@ -819,7 +1067,7 @@ secret_service_lock_paths (SecretService *self, } /** - * secret_service_lock_paths_finish: + * secret_service_lock_dbus_paths_finish: * @self: the secret service * @result: asynchronous result passed to the callback * @locked: (out) (array zero-terminated=1) (transfer full) (allow-none): @@ -836,10 +1084,10 @@ secret_service_lock_paths (SecretService *self, * Returns: the number of items or collections that were locked */ gint -secret_service_lock_paths_finish (SecretService *self, - GAsyncResult *result, - gchar ***locked, - GError **error) +secret_service_lock_dbus_paths_finish (SecretService *self, + GAsyncResult *result, + gchar ***locked, + GError **error) { g_return_val_if_fail (SECRET_IS_SERVICE (self), -1); g_return_val_if_fail (locked != NULL, -1); @@ -849,7 +1097,7 @@ secret_service_lock_paths_finish (SecretService *self, } /** - * secret_service_unlock_paths_sync: + * secret_service_unlock_dbus_paths_sync: * @self: the secret service * @paths: the D-Bus object paths of the items or collections to unlock * @cancellable: optional cancellation object @@ -874,11 +1122,11 @@ secret_service_lock_paths_finish (SecretService *self, * Returns: the number of items or collections that were unlocked */ gint -secret_service_unlock_paths_sync (SecretService *self, - const gchar **paths, - GCancellable *cancellable, - gchar ***unlocked, - GError **error) +secret_service_unlock_dbus_paths_sync (SecretService *self, + const gchar **paths, + GCancellable *cancellable, + gchar ***unlocked, + GError **error) { SecretSync *sync; gint count; @@ -892,13 +1140,13 @@ secret_service_unlock_paths_sync (SecretService *self, sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - secret_service_unlock_paths (self, paths, cancellable, - _secret_sync_on_result, sync); + secret_service_unlock_dbus_paths (self, paths, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - count = secret_service_unlock_paths_finish (self, sync->result, - unlocked, error); + count = secret_service_unlock_dbus_paths_finish (self, sync->result, + unlocked, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); @@ -907,7 +1155,7 @@ secret_service_unlock_paths_sync (SecretService *self, } /** - * secret_service_unlock_paths: + * secret_service_unlock_dbus_paths: * @self: the secret service * @paths: the D-Bus paths for items or collections to unlock * @cancellable: optional cancellation object @@ -928,11 +1176,11 @@ secret_service_unlock_paths_sync (SecretService *self, * any prompts that show up. */ void -secret_service_unlock_paths (SecretService *self, - const gchar **paths, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_unlock_dbus_paths (SecretService *self, + const gchar **paths, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (paths != NULL); @@ -944,7 +1192,7 @@ secret_service_unlock_paths (SecretService *self, } /** - * secret_service_unlock_paths_finish: + * secret_service_unlock_dbus_paths_finish: * @self: the secret service * @result: asynchronous result passed to the callback * @unlocked: (out) (array zero-terminated=1) (transfer full) (allow-none): @@ -961,10 +1209,10 @@ secret_service_unlock_paths (SecretService *self, * Returns: the number of items or collections that were unlocked */ gint -secret_service_unlock_paths_finish (SecretService *self, - GAsyncResult *result, - gchar ***unlocked, - GError **error) +secret_service_unlock_dbus_paths_finish (SecretService *self, + GAsyncResult *result, + gchar ***unlocked, + GError **error) { g_return_val_if_fail (SECRET_IS_SERVICE (self), -1); g_return_val_if_fail (error == NULL || *error == NULL, -1); @@ -1082,50 +1330,10 @@ _secret_service_delete_path (SecretService *self, g_object_unref (res); } -/** - * secret_service_delete_path: - * @self: the secret service - * @item_path: the D-Bus path of item to delete - * @cancellable: optional cancellation object - * @callback: called when the operation completes - * @user_data: data to be passed to the callback - * - * Delete a secret item from the secret service. - * - * The item is represented by its D-Bus object path. If you already have a - * #SecretItem proxy objects, use use secret_item_delete() instead. - * - * This method will return immediately and complete asynchronously. - */ -void -secret_service_delete_path (SecretService *self, - const gchar *item_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - 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)); - - _secret_service_delete_path (self, item_path, TRUE, cancellable, callback, user_data); -} - -/** - * secret_service_delete_path_finish: - * @self: the secret service - * @result: the asynchronous result passed to the callback - * @error: location to place an error on failure - * - * Complete an asynchronous operation to delete a secret item from the secret - * service. - * - * Returns: whether the deletion was successful or not - */ gboolean -secret_service_delete_path_finish (SecretService *self, - GAsyncResult *result, - GError **error) +_secret_service_delete_path_finish (SecretService *self, + GAsyncResult *result, + GError **error) { GSimpleAsyncResult *res; DeleteClosure *closure; @@ -1144,7 +1352,60 @@ secret_service_delete_path_finish (SecretService *self, } /** - * secret_service_delete_path_sync: + * secret_service_delete_item_dbus_path: + * @self: the secret service + * @item_path: the D-Bus path of item to delete + * @cancellable: optional cancellation object + * @callback: called when the operation completes + * @user_data: data to be passed to the callback + * + * Delete a secret item from the secret service. + * + * The item is represented by its D-Bus object path. If you already have a + * #SecretItem proxy objects, use use secret_item_delete() instead. + * + * This method will return immediately and complete asynchronously. + */ +void +secret_service_delete_item_dbus_path (SecretService *self, + const gchar *item_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + 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)); + + _secret_service_delete_path (self, item_path, TRUE, cancellable, callback, user_data); +} + +/** + * secret_service_delete_item_dbus_path_finish: + * @self: the secret service + * @result: the asynchronous result passed to the callback + * @error: location to place an error on failure + * + * Complete an asynchronous operation to delete a secret item from the secret + * service. + * + * Returns: whether the deletion was successful or not + */ +gboolean +secret_service_delete_item_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error) +{ + 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), + _secret_service_delete_path), FALSE); + + return _secret_service_delete_path_finish (self, result, error); +} + +/** + * secret_service_delete_item_dbus_path_sync: * @self: the secret service * @item_path: the D-Bus path of item to delete * @cancellable: optional cancellation object @@ -1161,10 +1422,10 @@ secret_service_delete_path_finish (SecretService *self, * Returns: whether the deletion was successful or not */ gboolean -secret_service_delete_path_sync (SecretService *self, - const gchar *item_path, - GCancellable *cancellable, - GError **error) +secret_service_delete_item_dbus_path_sync (SecretService *self, + const gchar *item_path, + GCancellable *cancellable, + GError **error) { SecretSync *sync; gboolean result; @@ -1177,12 +1438,12 @@ secret_service_delete_path_sync (SecretService *self, sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - secret_service_delete_path (self, item_path, cancellable, - _secret_sync_on_result, sync); + secret_service_delete_item_dbus_path (self, item_path, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - result = secret_service_delete_path_finish (self, sync->result, error); + result = secret_service_delete_item_dbus_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); @@ -1267,7 +1528,7 @@ on_create_collection_called (GObject *source, } /** - * secret_service_create_collection_path: + * secret_service_create_collection_dbus_path: * @self: a secret service object * @properties: (element-type utf8 GLib.Variant): hash table of properties for * the new collection @@ -1302,12 +1563,12 @@ on_create_collection_called (GObject *source, * any prompts that are required. */ void -secret_service_create_collection_path (SecretService *self, - GHashTable *properties, - const gchar *alias, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_create_collection_dbus_path (SecretService *self, + GHashTable *properties, + const gchar *alias, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { GSimpleAsyncResult *res; CollectionClosure *closure; @@ -1323,7 +1584,7 @@ secret_service_create_collection_path (SecretService *self, alias = ""; res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - secret_service_create_collection_path); + secret_service_create_collection_dbus_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); @@ -1347,7 +1608,7 @@ secret_service_create_collection_path (SecretService *self, } /** - * secret_service_create_collection_path_finish: + * secret_service_create_collection_dbus_path_finish: * @self: a secret service object * @result: the asynchronous result passed to the callback * @error: location to place an error on failure @@ -1359,16 +1620,16 @@ secret_service_create_collection_path (SecretService *self, * of the collection */ gchar * -secret_service_create_collection_path_finish (SecretService *self, - GAsyncResult *result, - GError **error) +secret_service_create_collection_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error) { GSimpleAsyncResult *res; CollectionClosure *closure; gchar *path; g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - secret_service_create_collection_path), NULL); + secret_service_create_collection_dbus_path), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -1383,7 +1644,7 @@ secret_service_create_collection_path_finish (SecretService *self, } /** - * secret_service_create_collection_path_sync: + * secret_service_create_collection_dbus_path_sync: * @self: a secret service object * @properties: (element-type utf8 GLib.Variant): hash table of D-Bus properties * for the new collection @@ -1418,11 +1679,11 @@ secret_service_create_collection_path_finish (SecretService *self, * of the collection */ gchar * -secret_service_create_collection_path_sync (SecretService *self, - GHashTable *properties, - const gchar *alias, - GCancellable *cancellable, - GError **error) +secret_service_create_collection_dbus_path_sync (SecretService *self, + GHashTable *properties, + const gchar *alias, + GCancellable *cancellable, + GError **error) { SecretSync *sync; gchar *path; @@ -1435,12 +1696,12 @@ secret_service_create_collection_path_sync (SecretService *self, sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - secret_service_create_collection_path (self, properties, alias, cancellable, - _secret_sync_on_result, sync); + secret_service_create_collection_dbus_path (self, properties, alias, cancellable, + _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - path = secret_service_create_collection_path_finish (self, sync->result, error); + path = secret_service_create_collection_dbus_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); @@ -1571,7 +1832,7 @@ on_create_item_session (GObject *source, } /** - * secret_service_create_item_path: + * secret_service_create_item_dbus_path: * @self: a secret service object * @collection_path: (allow-none): the D-Bus object path of the collection in which to create item * @properties: (element-type utf8 GLib.Variant): hash table of D-Bus properties @@ -1607,14 +1868,14 @@ on_create_item_session (GObject *source, * any prompts that are required. */ void -secret_service_create_item_path (SecretService *self, - const gchar *collection_path, - GHashTable *properties, - SecretValue *value, - gboolean replace, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_create_item_dbus_path (SecretService *self, + const gchar *collection_path, + GHashTable *properties, + SecretValue *value, + gboolean replace, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { GSimpleAsyncResult *res; ItemClosure *closure; @@ -1628,7 +1889,7 @@ secret_service_create_item_path (SecretService *self, collection_path = SECRET_COLLECTION_DEFAULT; res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, - secret_service_create_item_path); + secret_service_create_item_dbus_path); closure = g_slice_new0 (ItemClosure); closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL; closure->properties = _secret_util_variant_for_properties (properties); @@ -1646,7 +1907,7 @@ secret_service_create_item_path (SecretService *self, } /** - * secret_service_create_item_path_finish: + * secret_service_create_item_dbus_path_finish: * @self: a secret service object * @result: the asynchronous result passed to the callback * @error: location to place an error on failure @@ -1658,16 +1919,16 @@ secret_service_create_item_path (SecretService *self, * of the item */ gchar * -secret_service_create_item_path_finish (SecretService *self, - GAsyncResult *result, - GError **error) +secret_service_create_item_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error) { GSimpleAsyncResult *res; ItemClosure *closure; gchar *path; g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), - secret_service_create_item_path), NULL); + secret_service_create_item_dbus_path), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); res = G_SIMPLE_ASYNC_RESULT (result); @@ -1682,7 +1943,7 @@ secret_service_create_item_path_finish (SecretService *self, } /** - * secret_service_create_item_path_sync: + * secret_service_create_item_dbus_path_sync: * @self: a secret service object * @collection_path: (allow-none): the D-Bus path of the collection in which to create item * @properties: (element-type utf8 GLib.Variant): hash table of D-Bus properties @@ -1716,13 +1977,13 @@ secret_service_create_item_path_finish (SecretService *self, * of the item */ gchar * -secret_service_create_item_path_sync (SecretService *self, - const gchar *collection_path, - GHashTable *properties, - SecretValue *value, - gboolean replace, - GCancellable *cancellable, - GError **error) +secret_service_create_item_dbus_path_sync (SecretService *self, + const gchar *collection_path, + GHashTable *properties, + SecretValue *value, + gboolean replace, + GCancellable *cancellable, + GError **error) { SecretSync *sync; gchar *path; @@ -1735,12 +1996,12 @@ secret_service_create_item_path_sync (SecretService *self, sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - secret_service_create_item_path (self, collection_path, properties, value, replace, - cancellable, _secret_sync_on_result, sync); + secret_service_create_item_dbus_path (self, collection_path, properties, value, replace, + cancellable, _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - path = secret_service_create_item_path_finish (self, sync->result, error); + path = secret_service_create_item_dbus_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); @@ -1749,7 +2010,7 @@ secret_service_create_item_path_sync (SecretService *self, } /** - * secret_service_read_alias_path: + * secret_service_read_alias_dbus_path: * @self: a secret service object * @alias: the alias to lookup * @cancellable: (allow-none): optional cancellation object @@ -1763,11 +2024,11 @@ secret_service_create_item_path_sync (SecretService *self, * This method will return immediately and complete asynchronously. */ void -secret_service_read_alias_path (SecretService *self, - const gchar *alias, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_read_alias_dbus_path (SecretService *self, + const gchar *alias, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (alias != NULL); @@ -1780,7 +2041,7 @@ secret_service_read_alias_path (SecretService *self, } /** - * secret_service_read_alias_path_finish: + * secret_service_read_alias_dbus_path_finish: * @self: a secret service object * @result: asynchronous result passed to callback * @error: location to place error on failure @@ -1792,9 +2053,9 @@ secret_service_read_alias_path (SecretService *self, * none assigned to the alias */ gchar * -secret_service_read_alias_path_finish (SecretService *self, - GAsyncResult *result, - GError **error) +secret_service_read_alias_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error) { gchar *collection_path; GVariant *retval; @@ -1815,7 +2076,7 @@ secret_service_read_alias_path_finish (SecretService *self, } /** - * secret_service_read_alias_path_sync: + * secret_service_read_alias_dbus_path_sync: * @self: a secret service object * @alias: the alias to lookup * @cancellable: (allow-none): optional cancellation object @@ -1831,10 +2092,10 @@ secret_service_read_alias_path_finish (SecretService *self, * none assigned to the alias */ gchar * -secret_service_read_alias_path_sync (SecretService *self, - const gchar *alias, - GCancellable *cancellable, - GError **error) +secret_service_read_alias_dbus_path_sync (SecretService *self, + const gchar *alias, + GCancellable *cancellable, + GError **error) { SecretSync *sync; gchar *collection_path; @@ -1847,11 +2108,11 @@ secret_service_read_alias_path_sync (SecretService *self, sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - secret_service_read_alias_path (self, alias, cancellable, _secret_sync_on_result, sync); + secret_service_read_alias_dbus_path (self, alias, cancellable, _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - collection_path = secret_service_read_alias_path_finish (self, sync->result, error); + collection_path = secret_service_read_alias_dbus_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); @@ -1860,7 +2121,7 @@ secret_service_read_alias_path_sync (SecretService *self, } /** - * secret_service_set_alias_path: + * secret_service_set_alias_to_dbus_path: * @self: a secret service object * @alias: the alias to assign the collection to * @collection_path: (allow-none): the dbus object path of the collection to assign to the alias @@ -1875,12 +2136,12 @@ secret_service_read_alias_path_sync (SecretService *self, * This method will return immediately and complete asynchronously. */ void -secret_service_set_alias_path (SecretService *self, - const gchar *alias, - const gchar *collection_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_set_alias_to_dbus_path (SecretService *self, + const gchar *alias, + const gchar *collection_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (alias != NULL); @@ -1898,7 +2159,7 @@ secret_service_set_alias_path (SecretService *self, } /** - * secret_service_set_alias_path_finish: + * secret_service_set_alias_to_dbus_path_finish: * @self: a secret service object * @result: asynchronous result passed to callback * @error: location to place error on failure @@ -1908,9 +2169,9 @@ secret_service_set_alias_path (SecretService *self, * Returns: %TRUE if successful */ gboolean -secret_service_set_alias_path_finish (SecretService *self, - GAsyncResult *result, - GError **error) +secret_service_set_alias_to_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error) { GVariant *retval; @@ -1926,7 +2187,7 @@ secret_service_set_alias_path_finish (SecretService *self, } /** - * secret_service_set_alias_path_sync: + * secret_service_set_alias_to_dbus_path_sync: * @self: a secret service object * @alias: the alias to assign the collection to * @collection_path: (allow-none): the dbus object path of the collection to assign to the alias @@ -1942,11 +2203,11 @@ secret_service_set_alias_path_finish (SecretService *self, * Returns: %TRUE if successful */ gboolean -secret_service_set_alias_path_sync (SecretService *self, - const gchar *alias, - const gchar *collection_path, - GCancellable *cancellable, - GError **error) +secret_service_set_alias_to_dbus_path_sync (SecretService *self, + const gchar *alias, + const gchar *collection_path, + GCancellable *cancellable, + GError **error) { SecretSync *sync; gboolean ret; @@ -1964,12 +2225,12 @@ secret_service_set_alias_path_sync (SecretService *self, sync = _secret_sync_new (); g_main_context_push_thread_default (sync->context); - secret_service_set_alias_path (self, alias, collection_path, - cancellable, _secret_sync_on_result, sync); + secret_service_set_alias_to_dbus_path (self, alias, collection_path, + cancellable, _secret_sync_on_result, sync); g_main_loop_run (sync->loop); - ret = secret_service_set_alias_path_finish (self, sync->result, error); + ret = secret_service_set_alias_to_dbus_path_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); @@ -1978,11 +2239,11 @@ secret_service_set_alias_path_sync (SecretService *self, } GVariant * -secret_service_prompt_path_sync (SecretService *self, - const gchar *prompt_path, - GCancellable *cancellable, - const GVariantType *return_type, - GError **error) +secret_service_prompt_at_dbus_path_sync (SecretService *self, + const gchar *prompt_path, + GCancellable *cancellable, + const GVariantType *return_type, + GError **error) { SecretPrompt *prompt; GVariant *retval; @@ -2000,7 +2261,7 @@ secret_service_prompt_path_sync (SecretService *self, } /** - * secret_service_prompt_path: + * secret_service_prompt_at_dbus_path: * @self: the secret service * @prompt_path: the D-Bus object path of the prompt * @cancellable: optional cancellation object @@ -2017,11 +2278,11 @@ secret_service_prompt_path_sync (SecretService *self, * run secret_prompt_perform() on the prompt. */ void -secret_service_prompt_path (SecretService *self, - const gchar *prompt_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +secret_service_prompt_at_dbus_path (SecretService *self, + const gchar *prompt_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { SecretPrompt *prompt; @@ -2035,7 +2296,7 @@ secret_service_prompt_path (SecretService *self, } /** - * secret_service_prompt_path_finish: + * secret_service_prompt_at_dbus_path_finish: * @self: the secret service * @result: the asynchronous result passed to the callback * @return_type: the variant type of the prompt result @@ -2051,10 +2312,10 @@ secret_service_prompt_path (SecretService *self, * a variant result if the prompt was successful */ GVariant * -secret_service_prompt_path_finish (SecretService *self, - GAsyncResult *result, - const GVariantType *return_type, - GError **error) +secret_service_prompt_at_dbus_path_finish (SecretService *self, + GAsyncResult *result, + const GVariantType *return_type, + GError **error) { g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL); diff --git a/library/secret-paths.h b/library/secret-paths.h index 3d804f1..e61c9d5 100644 --- a/library/secret-paths.h +++ b/library/secret-paths.h @@ -22,6 +22,8 @@ #include +#include "secret-collection.h" +#include "secret-item.h" #include "secret-prompt.h" #include "secret-schema.h" #include "secret-types.h" @@ -29,192 +31,228 @@ G_BEGIN_DECLS -void secret_service_search_for_paths (SecretService *self, - const SecretSchema *schema, - GHashTable *attributes, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -gboolean secret_service_search_for_paths_finish (SecretService *self, - GAsyncResult *result, - gchar ***unlocked, - gchar ***locked, - GError **error); +void secret_collection_new_for_dbus_path (SecretService *service, + const gchar *collection_path, + SecretCollectionFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -gboolean secret_service_search_for_paths_sync (SecretService *self, - const SecretSchema *schema, - GHashTable *attributes, - GCancellable *cancellable, - gchar ***unlocked, - gchar ***locked, - GError **error); +SecretCollection * secret_collection_new_for_dbus_path_finish (GAsyncResult *result, + GError **error); -void secret_service_get_secret_for_path (SecretService *self, - const gchar *item_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +SecretCollection * secret_collection_new_for_dbus_path_sync (SecretService *service, + const gchar *collection_path, + SecretCollectionFlags flags, + GCancellable *cancellable, + GError **error); -SecretValue * secret_service_get_secret_for_path_finish (SecretService *self, - GAsyncResult *result, - GError **error); -SecretValue * secret_service_get_secret_for_path_sync (SecretService *self, - const gchar *item_path, - GCancellable *cancellable, - GError **error); +void secret_item_new_for_dbus_path (SecretService *service, + const gchar *item_path, + SecretItemFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -void secret_service_get_secrets_for_paths (SecretService *self, - const gchar **item_paths, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +SecretItem * secret_item_new_for_dbus_path_finish (GAsyncResult *result, + GError **error); -GHashTable * secret_service_get_secrets_for_paths_finish (SecretService *self, - GAsyncResult *result, - GError **error); +SecretItem * secret_item_new_for_dbus_path_sync (SecretService *service, + const gchar *item_path, + SecretItemFlags flags, + GCancellable *cancellable, + GError **error); -GHashTable * secret_service_get_secrets_for_paths_sync (SecretService *self, - const gchar **item_paths, - GCancellable *cancellable, - GError **error); +const gchar * secret_service_get_session_dbus_path (SecretService *self); -gint secret_service_lock_paths_sync (SecretService *self, - const gchar **paths, - GCancellable *cancellable, - gchar ***locked, - GError **error); +void secret_service_search_for_dbus_paths (SecretService *self, + const SecretSchema *schema, + GHashTable *attributes, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -void secret_service_lock_paths (SecretService *self, - const gchar **paths, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +gboolean secret_service_search_for_dbus_paths_finish (SecretService *self, + GAsyncResult *result, + gchar ***unlocked, + gchar ***locked, + GError **error); -gint secret_service_lock_paths_finish (SecretService *self, - GAsyncResult *result, - gchar ***locked, - GError **error); +gboolean secret_service_search_for_dbus_paths_sync (SecretService *self, + const SecretSchema *schema, + GHashTable *attributes, + GCancellable *cancellable, + gchar ***unlocked, + gchar ***locked, + GError **error); -gint secret_service_unlock_paths_sync (SecretService *self, - const gchar **paths, - GCancellable *cancellable, - gchar ***unlocked, - GError **error); +void secret_service_get_secret_for_dbus_path (SecretService *self, + const gchar *item_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -void secret_service_unlock_paths (SecretService *self, - const gchar **paths, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +SecretValue * secret_service_get_secret_for_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error); -gint secret_service_unlock_paths_finish (SecretService *self, - GAsyncResult *result, - gchar ***unlocked, - GError **error); +SecretValue * secret_service_get_secret_for_dbus_path_sync (SecretService *self, + const gchar *item_path, + GCancellable *cancellable, + GError **error); -GVariant * secret_service_prompt_path_sync (SecretService *self, - const gchar *prompt_path, - GCancellable *cancellable, - const GVariantType *return_type, - GError **error); +void secret_service_get_secrets_for_dbus_paths (SecretService *self, + const gchar **item_paths, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -void secret_service_prompt_path (SecretService *self, - const gchar *prompt_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +GHashTable * secret_service_get_secrets_for_dbus_paths_finish (SecretService *self, + GAsyncResult *result, + GError **error); -GVariant * secret_service_prompt_path_finish (SecretService *self, - GAsyncResult *result, - const GVariantType *return_type, - GError **error); +GHashTable * secret_service_get_secrets_for_dbus_paths_sync (SecretService *self, + const gchar **item_paths, + GCancellable *cancellable, + GError **error); -void secret_service_delete_path (SecretService *self, - const gchar *item_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +gint secret_service_lock_dbus_paths_sync (SecretService *self, + const gchar **paths, + GCancellable *cancellable, + gchar ***locked, + GError **error); -gboolean secret_service_delete_path_finish (SecretService *self, - GAsyncResult *result, - GError **error); +void secret_service_lock_dbus_paths (SecretService *self, + const gchar **paths, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -gboolean secret_service_delete_path_sync (SecretService *self, - const gchar *item_path, - GCancellable *cancellable, - GError **error); +gint secret_service_lock_dbus_paths_finish (SecretService *self, + GAsyncResult *result, + gchar ***locked, + GError **error); -void secret_service_create_collection_path (SecretService *self, - GHashTable *properties, - const gchar *alias, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +gint secret_service_unlock_dbus_paths_sync (SecretService *self, + const gchar **paths, + GCancellable *cancellable, + gchar ***unlocked, + GError **error); -gchar * secret_service_create_collection_path_finish (SecretService *self, - GAsyncResult *result, - GError **error); +void secret_service_unlock_dbus_paths (SecretService *self, + const gchar **paths, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -gchar * secret_service_create_collection_path_sync (SecretService *self, - GHashTable *properties, - const gchar *alias, - GCancellable *cancellable, - GError **error); +gint secret_service_unlock_dbus_paths_finish (SecretService *self, + GAsyncResult *result, + gchar ***unlocked, + GError **error); -void secret_service_create_item_path (SecretService *self, - const gchar *collection_path, - GHashTable *properties, - SecretValue *value, - gboolean replace, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +GVariant * secret_service_prompt_at_dbus_path_sync (SecretService *self, + const gchar *prompt_path, + GCancellable *cancellable, + const GVariantType *return_type, + GError **error); -gchar * secret_service_create_item_path_finish (SecretService *self, - GAsyncResult *result, - GError **error); +void secret_service_prompt_at_dbus_path (SecretService *self, + const gchar *prompt_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -gchar * secret_service_create_item_path_sync (SecretService *self, - const gchar *collection_path, - GHashTable *properties, - SecretValue *value, - gboolean replace, - GCancellable *cancellable, - GError **error); +GVariant * secret_service_prompt_at_dbus_path_finish (SecretService *self, + GAsyncResult *result, + const GVariantType *return_type, + GError **error); -void secret_service_read_alias_path (SecretService *self, - const gchar *alias, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +void secret_service_delete_item_dbus_path (SecretService *self, + const gchar *item_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -gchar * secret_service_read_alias_path_finish (SecretService *self, - GAsyncResult *result, - GError **error); +gboolean secret_service_delete_item_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error); -gchar * secret_service_read_alias_path_sync (SecretService *self, - const gchar *alias, - GCancellable *cancellable, - GError **error); +gboolean secret_service_delete_item_dbus_path_sync (SecretService *self, + const gchar *item_path, + GCancellable *cancellable, + GError **error); -void secret_service_set_alias_path (SecretService *self, - const gchar *alias, - const gchar *collection_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +void secret_service_create_collection_dbus_path (SecretService *self, + GHashTable *properties, + const gchar *alias, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); -gboolean secret_service_set_alias_path_finish (SecretService *self, - GAsyncResult *result, - GError **error); +gchar * secret_service_create_collection_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error); -gboolean secret_service_set_alias_path_sync (SecretService *self, - const gchar *alias, - const gchar *collection_path, - GCancellable *cancellable, - GError **error); +gchar * secret_service_create_collection_dbus_path_sync (SecretService *self, + GHashTable *properties, + const gchar *alias, + GCancellable *cancellable, + GError **error); + +void secret_service_create_item_dbus_path (SecretService *self, + const gchar *collection_path, + GHashTable *properties, + SecretValue *value, + gboolean replace, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gchar * secret_service_create_item_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error); + +gchar * secret_service_create_item_dbus_path_sync (SecretService *self, + const gchar *collection_path, + GHashTable *properties, + SecretValue *value, + gboolean replace, + GCancellable *cancellable, + GError **error); + +void secret_service_read_alias_dbus_path (SecretService *self, + const gchar *alias, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gchar * secret_service_read_alias_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error); + +gchar * secret_service_read_alias_dbus_path_sync (SecretService *self, + const gchar *alias, + GCancellable *cancellable, + GError **error); + +void secret_service_set_alias_to_dbus_path (SecretService *self, + const gchar *alias, + const gchar *collection_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean secret_service_set_alias_to_dbus_path_finish (SecretService *self, + GAsyncResult *result, + GError **error); + +gboolean secret_service_set_alias_to_dbus_path_sync (SecretService *self, + const gchar *alias, + const gchar *collection_path, + GCancellable *cancellable, + GError **error); G_END_DECLS diff --git a/library/secret-private.h b/library/secret-private.h index 2acd460..ae021ca 100644 --- a/library/secret-private.h +++ b/library/secret-private.h @@ -127,6 +127,10 @@ void _secret_service_delete_path (SecretService *se GAsyncReadyCallback callback, gpointer user_data); +gboolean _secret_service_delete_path_finish (SecretService *self, + GAsyncResult *result, + GError **error); + void _secret_service_search_for_paths_variant (SecretService *self, GVariant *attributes, GCancellable *cancellable, diff --git a/library/secret-service.c b/library/secret-service.c index c073f6b..b56c334 100644 --- a/library/secret-service.c +++ b/library/secret-service.c @@ -1145,7 +1145,7 @@ secret_service_get_session_algorithms (SecretService *self) } /** - * secret_service_get_session_path: + * secret_service_get_session_dbus_path: * @self: the secret service proxy * * Get the D-Bus object path of the session object being used to transfer @@ -1158,7 +1158,7 @@ secret_service_get_session_algorithms (SecretService *self) * session */ const gchar * -secret_service_get_session_path (SecretService *self) +secret_service_get_session_dbus_path (SecretService *self) { SecretSession *session; const gchar *path; @@ -1227,24 +1227,24 @@ secret_service_ensure_session (SecretService *self, * Finish an asynchronous operation to ensure that the #SecretService proxy * has established a session with the Secret Service. * - * Returns: the path of the established session + * Returns: whether a session is established or not */ -const gchar * +gboolean secret_service_ensure_session_finish (SecretService *self, GAsyncResult *result, GError **error) { - 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 (SECRET_IS_SERVICE (self), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); if (!g_simple_async_result_is_valid (result, G_OBJECT (self), secret_service_ensure_session)) { if (!_secret_session_open_finish (result, error)) - return NULL; + return FALSE; } - g_return_val_if_fail (self->pv->session != NULL, NULL); - return secret_service_get_session_path (self); + g_return_val_if_fail (self->pv->session != NULL, FALSE); + return TRUE; } /** @@ -1264,19 +1264,19 @@ secret_service_ensure_session_finish (SecretService *self, * This method may block indefinitely and should not be used in user interface * threads. * - * Returns: the path of the established session + * Returns: whether a session is established or not */ -const gchar * +gboolean secret_service_ensure_session_sync (SecretService *self, GCancellable *cancellable, GError **error) { SecretSync *sync; - const gchar *path; + gboolean ret; - 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); + 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 = _secret_sync_new (); g_main_context_push_thread_default (sync->context); @@ -1286,12 +1286,12 @@ secret_service_ensure_session_sync (SecretService *self, g_main_loop_run (sync->loop); - path = secret_service_ensure_session_finish (self, sync->result, error); + ret = secret_service_ensure_session_finish (self, sync->result, error); g_main_context_pop_thread_default (sync->context); _secret_sync_free (sync); - return path; + return ret; } static SecretCollection * @@ -1370,7 +1370,7 @@ on_ensure_collection (GObject *source, closure->collections_loading--; - collection = secret_collection_new_finish (result, &error); + collection = secret_collection_new_for_dbus_path_finish (result, &error); if (error != NULL) g_simple_async_result_take_error (res, error); @@ -1438,8 +1438,8 @@ secret_service_load_collections (SecretService *self, /* No such collection yet create a new one */ if (collection == NULL) { - secret_collection_new (self, path, SECRET_COLLECTION_LOAD_ITEMS, cancellable, - on_ensure_collection, g_object_ref (res)); + secret_collection_new_for_dbus_path (self, path, SECRET_COLLECTION_LOAD_ITEMS, + cancellable, on_ensure_collection, g_object_ref (res)); closure->collections_loading++; } else { g_hash_table_insert (closure->collections, g_strdup (path), collection); @@ -1528,9 +1528,9 @@ secret_service_load_collections_sync (SecretService *self, /* No such collection yet create a new one */ if (collection == NULL) { - collection = secret_collection_new_sync (self, path, - SECRET_COLLECTION_LOAD_ITEMS, - cancellable, error); + collection = secret_collection_new_for_dbus_path_sync (self, path, + SECRET_COLLECTION_LOAD_ITEMS, + cancellable, error); if (collection == NULL) { ret = FALSE; break; diff --git a/library/secret-service.h b/library/secret-service.h index b4626be..b2e9e5d 100644 --- a/library/secret-service.h +++ b/library/secret-service.h @@ -122,8 +122,6 @@ SecretServiceFlags secret_service_get_flags (SecretService const gchar * secret_service_get_session_algorithms (SecretService *self); -const gchar * secret_service_get_session_path (SecretService *self); - GList * secret_service_get_collections (SecretService *self); void secret_service_ensure_session (SecretService *self, @@ -131,11 +129,11 @@ void secret_service_ensure_session (SecretService GAsyncReadyCallback callback, gpointer user_data); -const gchar * secret_service_ensure_session_finish (SecretService *self, +gboolean secret_service_ensure_session_finish (SecretService *self, GAsyncResult *result, GError **error); -const gchar * secret_service_ensure_session_sync (SecretService *self, +gboolean secret_service_ensure_session_sync (SecretService *self, GCancellable *cancellable, GError **error); diff --git a/library/tests/test-collection.c b/library/tests/test-collection.c index 71212a3..4385548 100644 --- a/library/tests/test-collection.c +++ b/library/tests/test-collection.c @@ -17,6 +17,7 @@ #include "secret-collection.h" #include "secret-service.h" +#include "secret-paths.h" #include "secret-private.h" #include "mock-service.h" @@ -89,8 +90,8 @@ test_new_sync (Test *test, GError *error = NULL; SecretCollection *collection; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path); @@ -108,13 +109,13 @@ test_new_async (Test *test, SecretCollection *collection; GAsyncResult *result = NULL; - secret_collection_new (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, on_async_result, &result); + secret_collection_new_for_dbus_path (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, on_async_result, &result); g_assert (result == NULL); egg_test_wait (); - collection = secret_collection_new_finish (result, &error); + collection = secret_collection_new_for_dbus_path_finish (result, &error); g_assert_no_error (error); g_object_unref (result); @@ -132,8 +133,8 @@ test_new_sync_noexist (Test *test, GError *error = NULL; SecretCollection *collection; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); g_assert (collection == NULL); } @@ -147,13 +148,13 @@ test_new_async_noexist (Test *test, SecretCollection *collection; GAsyncResult *result = NULL; - secret_collection_new (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, on_async_result, &result); + secret_collection_new_for_dbus_path (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, on_async_result, &result); g_assert (result == NULL); egg_test_wait (); - collection = secret_collection_new_finish (result, &error); + collection = secret_collection_new_for_dbus_path_finish (result, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); g_assert (collection == NULL); g_object_unref (result); @@ -216,8 +217,8 @@ test_properties (Test *test, gboolean locked; gchar *label; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); g_assert (secret_collection_get_locked (collection) == FALSE); @@ -287,8 +288,8 @@ test_items (Test *test, GError *error = NULL; GList *items; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_LOAD_ITEMS, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_LOAD_ITEMS, NULL, &error); g_assert_no_error (error); items = secret_collection_get_items (collection); @@ -319,8 +320,8 @@ test_items_empty (Test *test, GError *error = NULL; GList *items; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_LOAD_ITEMS, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_LOAD_ITEMS, NULL, &error); g_assert_no_error (error); items = secret_collection_get_items (collection); @@ -344,14 +345,14 @@ test_items_empty_async (Test *test, GError *error = NULL; GList *items; - secret_collection_new (test->service, collection_path, - SECRET_COLLECTION_LOAD_ITEMS, - NULL, on_async_result, &result); + secret_collection_new_for_dbus_path (test->service, collection_path, + SECRET_COLLECTION_LOAD_ITEMS, + NULL, on_async_result, &result); g_assert (result == NULL); egg_test_wait (); - collection = secret_collection_new_finish (result, &error); + collection = secret_collection_new_for_dbus_path_finish (result, &error); g_assert_no_error (error); g_object_unref (result); @@ -376,8 +377,8 @@ test_set_label_sync (Test *test, gboolean ret; gchar *label; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); label = secret_collection_get_label (collection); @@ -406,8 +407,8 @@ test_set_label_async (Test *test, gboolean ret; gchar *label; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); label = secret_collection_get_label (collection); @@ -442,10 +443,11 @@ test_set_label_prop (Test *test, guint sigs = 2; gchar *label; - secret_collection_new (test->service, collection_path, SECRET_COLLECTION_NONE, NULL, on_async_result, &result); + secret_collection_new_for_dbus_path (test->service, collection_path, SECRET_COLLECTION_NONE, + NULL, on_async_result, &result); g_assert (result == NULL); egg_test_wait (); - collection = secret_collection_new_finish (result, &error); + collection = secret_collection_new_for_dbus_path_finish (result, &error); g_assert_no_error (error); g_object_unref (result); @@ -475,8 +477,8 @@ test_delete_sync (Test *test, GError *error = NULL; gboolean ret; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); ret = secret_collection_delete_sync (collection, NULL, &error); @@ -485,8 +487,8 @@ test_delete_sync (Test *test, g_object_unref (collection); - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); g_assert (collection == NULL); } @@ -501,8 +503,8 @@ test_delete_async (Test *test, GError *error = NULL; gboolean ret; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); secret_collection_delete (collection, NULL, on_async_result, &result); @@ -517,8 +519,8 @@ test_delete_async (Test *test, g_object_unref (collection); - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, 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 c2eb480..1f462b6 100644 --- a/library/tests/test-item.c +++ b/library/tests/test-item.c @@ -18,6 +18,7 @@ #include "secret-collection.h" #include "secret-item.h" #include "secret-service.h" +#include "secret-paths.h" #include "secret-private.h" #include "mock-service.h" @@ -90,7 +91,7 @@ test_new_sync (Test *test, GError *error = NULL; SecretItem *item; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), ==, item_path); @@ -106,7 +107,7 @@ test_new_sync_noexist (Test *test, GError *error = NULL; SecretItem *item; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); g_assert (item == NULL); } @@ -120,13 +121,13 @@ test_new_async (Test *test, GError *error = NULL; SecretItem *item; - secret_item_new (test->service, item_path, SECRET_ITEM_NONE, - NULL, on_async_result, &result); + secret_item_new_for_dbus_path (test->service, item_path, SECRET_ITEM_NONE, + NULL, on_async_result, &result); g_assert (result == NULL); egg_test_wait (); - item = secret_item_new_finish (result, &error); + item = secret_item_new_for_dbus_path_finish (result, &error); g_assert_no_error (error); g_object_unref (result); @@ -144,13 +145,13 @@ test_new_async_noexist (Test *test, GError *error = NULL; SecretItem *item; - secret_item_new (test->service, item_path, SECRET_ITEM_NONE, - NULL, on_async_result, &result); + secret_item_new_for_dbus_path (test->service, item_path, SECRET_ITEM_NONE, + NULL, on_async_result, &result); g_assert (result == NULL); egg_test_wait (); - item = secret_item_new_finish (result, &error); + item = secret_item_new_for_dbus_path_finish (result, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); g_assert (item == NULL); g_object_unref (result); @@ -167,8 +168,8 @@ test_create_sync (Test *test, GHashTable *attributes; SecretValue *value; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); attributes = g_hash_table_new (g_str_hash, g_str_equal); @@ -206,8 +207,8 @@ test_create_async (Test *test, GHashTable *attributes; SecretValue *value; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); attributes = g_hash_table_new (g_str_hash, g_str_equal); @@ -253,7 +254,7 @@ test_properties (Test *test, gboolean locked; gchar *label; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); g_assert (secret_item_get_locked (item) == FALSE); @@ -309,7 +310,7 @@ test_set_label_sync (Test *test, gboolean ret; gchar *label; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); label = secret_item_get_label (item); @@ -338,7 +339,7 @@ test_set_label_async (Test *test, gboolean ret; gchar *label; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); label = secret_item_get_label (item); @@ -373,10 +374,10 @@ test_set_label_prop (Test *test, guint sigs = 2; gchar *label; - secret_item_new (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result); + secret_item_new_for_dbus_path (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result); g_assert (result == NULL); egg_test_wait (); - item = secret_item_new_finish (result, &error); + item = secret_item_new_for_dbus_path_finish (result, &error); g_assert_no_error (error); g_object_unref (result); @@ -407,7 +408,7 @@ test_set_attributes_sync (Test *test, gboolean ret; GHashTable *attributes; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); attributes = secret_item_get_attributes (item); @@ -445,7 +446,7 @@ test_set_attributes_async (Test *test, SecretItem *item; gboolean ret; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); attributes = secret_item_get_attributes (item); @@ -488,10 +489,10 @@ test_set_attributes_prop (Test *test, GHashTable *attributes; guint sigs = 2; - secret_item_new (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result); + secret_item_new_for_dbus_path (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result); g_assert (result == NULL); egg_test_wait (); - item = secret_item_new_finish (result, &error); + item = secret_item_new_for_dbus_path_finish (result, &error); g_assert_no_error (error); g_object_unref (result); @@ -534,7 +535,7 @@ test_load_secret_sync (Test *test, gboolean ret; gsize length; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); value = secret_item_get_secret (item); @@ -568,7 +569,7 @@ test_load_secret_async (Test *test, gboolean ret; gsize length; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); value = secret_item_get_secret (item); @@ -610,7 +611,7 @@ test_set_secret_sync (Test *test, value = secret_value_new ("Sinking", -1, "strange/content-type"); - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); ret = secret_item_set_secret_sync (item, value, NULL, &error); @@ -653,9 +654,9 @@ test_secrets_sync (Test *test, gboolean ret; gsize length; - item_one = secret_item_new_sync (test->service, path_item_one, SECRET_ITEM_NONE, NULL, &error); - item_two = secret_item_new_sync (test->service, path_item_two, SECRET_ITEM_NONE, NULL, &error); - item_three = secret_item_new_sync (test->service, path_item_three, SECRET_ITEM_NONE, NULL, &error); + item_one = secret_item_new_for_dbus_path_sync (test->service, path_item_one, SECRET_ITEM_NONE, NULL, &error); + item_two = secret_item_new_for_dbus_path_sync (test->service, path_item_two, SECRET_ITEM_NONE, NULL, &error); + item_three = secret_item_new_for_dbus_path_sync (test->service, path_item_three, SECRET_ITEM_NONE, NULL, &error); items = g_list_append (items, item_one); items = g_list_append (items, item_two); @@ -702,13 +703,13 @@ test_secrets_async (Test *test, gsize length; gboolean ret; - item_one = secret_item_new_sync (test->service, path_item_one, SECRET_ITEM_NONE, NULL, &error); + item_one = secret_item_new_for_dbus_path_sync (test->service, path_item_one, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); - item_two = secret_item_new_sync (test->service, path_item_two, SECRET_ITEM_NONE, NULL, &error); + item_two = secret_item_new_for_dbus_path_sync (test->service, path_item_two, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); - item_three = secret_item_new_sync (test->service, path_item_three, SECRET_ITEM_NONE, NULL, &error); + item_three = secret_item_new_for_dbus_path_sync (test->service, path_item_three, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); @@ -759,7 +760,7 @@ test_delete_sync (Test *test, SecretItem *item; gboolean ret; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); ret = secret_item_delete_sync (item, NULL, &error); @@ -768,7 +769,7 @@ test_delete_sync (Test *test, g_object_unref (item); - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); g_assert (item == NULL); } @@ -783,7 +784,7 @@ test_delete_async (Test *test, SecretItem *item; gboolean ret; - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); secret_item_delete (item, NULL, on_async_result, &result); @@ -797,7 +798,7 @@ test_delete_async (Test *test, g_object_unref (item); - item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); + item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, 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 b000b56..9dc8214 100644 --- a/library/tests/test-methods.c +++ b/library/tests/test-methods.c @@ -398,8 +398,8 @@ test_lock_sync (Test *test, GList *objects; gboolean ret; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); objects = g_list_append (NULL, collection); @@ -428,8 +428,8 @@ test_unlock_sync (Test *test, GList *objects; gboolean ret; - collection = secret_collection_new_sync (test->service, collection_path, - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); objects = g_list_append (NULL, collection); @@ -736,8 +736,8 @@ test_store_sync (Test *test, g_hash_table_insert (attributes, "string", "seventeen"); g_hash_table_insert (attributes, "number", "17"); - ret = secret_service_search_for_paths_sync (test->service, &MOCK_SCHEMA, attributes, - NULL, &paths, NULL, &error); + ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, + NULL, &paths, NULL, &error); g_hash_table_unref (attributes); g_assert (ret == TRUE); @@ -745,8 +745,8 @@ test_store_sync (Test *test, g_assert (paths[0] != NULL); g_assert (paths[1] == NULL); - value = secret_service_get_secret_for_path_sync (test->service, paths[0], - NULL, &error); + value = secret_service_get_secret_for_dbus_path_sync (test->service, paths[0], + NULL, &error); g_assert_no_error (error); g_assert (value != NULL); @@ -789,8 +789,8 @@ test_store_replace (Test *test, g_hash_table_insert (attributes, "string", "seventeen"); g_hash_table_insert (attributes, "number", "17"); - ret = secret_service_search_for_paths_sync (test->service, &MOCK_SCHEMA, attributes, - NULL, &paths, NULL, &error); + ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, + NULL, &paths, NULL, &error); g_hash_table_unref (attributes); g_assert (ret == TRUE); @@ -837,8 +837,8 @@ test_store_async (Test *test, g_hash_table_insert (attributes, "string", "seventeen"); g_hash_table_insert (attributes, "number", "17"); - ret = secret_service_search_for_paths_sync (test->service, &MOCK_SCHEMA, attributes, - NULL, &paths, NULL, &error); + ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, + NULL, &paths, NULL, &error); g_hash_table_unref (attributes); g_assert (ret == TRUE); @@ -846,8 +846,8 @@ test_store_async (Test *test, g_assert (paths[0] != NULL); g_assert (paths[1] == NULL); - value = secret_service_get_secret_for_path_sync (test->service, paths[0], - NULL, &error); + value = secret_service_get_secret_for_dbus_path_sync (test->service, paths[0], + NULL, &error); g_assert_no_error (error); g_assert (value != NULL); @@ -925,8 +925,9 @@ test_set_alias_sync (Test *test, g_assert_no_error (error); g_assert (blah == NULL); - collection = secret_collection_new_sync (test->service, "/org/freedesktop/secrets/collection/english", - SECRET_COLLECTION_NONE, NULL, &error); + collection = secret_collection_new_for_dbus_path_sync (test->service, + "/org/freedesktop/secrets/collection/english", + SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); g_assert (SECRET_IS_COLLECTION (collection)); diff --git a/library/tests/test-paths.c b/library/tests/test-paths.c index 2a6f04d..1c7a586 100644 --- a/library/tests/test-paths.c +++ b/library/tests/test-paths.c @@ -130,8 +130,8 @@ 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 = secret_service_search_for_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, - &unlocked, &locked, &error); + ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, + &unlocked, &locked, &error); g_assert_no_error (error); g_assert (ret == TRUE); @@ -161,14 +161,14 @@ test_search_paths_async (Test *test, attributes = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_insert (attributes, "number", "1"); - secret_service_search_for_paths (test->service, &MOCK_SCHEMA, attributes, NULL, - on_complete_get_result, &result); + secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL, + on_complete_get_result, &result); egg_test_wait (); g_assert (G_IS_ASYNC_RESULT (result)); - ret = secret_service_search_for_paths_finish (test->service, result, - &unlocked, &locked, - &error); + ret = secret_service_search_for_dbus_paths_finish (test->service, result, + &unlocked, &locked, + &error); g_assert_no_error (error); g_assert (ret == TRUE); @@ -198,7 +198,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 = secret_service_search_for_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, + ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &paths, NULL, &error); g_assert_no_error (error); g_assert (ret == TRUE); @@ -206,25 +206,25 @@ test_search_paths_nulls (Test *test, g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/english/1"); g_strfreev (paths); - ret = secret_service_search_for_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, - NULL, &paths, &error); + ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, + NULL, &paths, &error); g_assert_no_error (error); g_assert (ret == TRUE); g_assert (paths != NULL); g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/spanish/10"); g_strfreev (paths); - ret = secret_service_search_for_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, - NULL, NULL, &error); + ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, + NULL, NULL, &error); g_assert_no_error (error); g_assert (ret == TRUE); - secret_service_search_for_paths (test->service, &MOCK_SCHEMA, attributes, NULL, - on_complete_get_result, &result); + secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL, + on_complete_get_result, &result); egg_test_wait (); g_assert (G_IS_ASYNC_RESULT (result)); - ret = secret_service_search_for_paths_finish (test->service, result, - &paths, NULL, &error); + ret = secret_service_search_for_dbus_paths_finish (test->service, result, + &paths, NULL, &error); g_assert_no_error (error); g_assert (ret == TRUE); g_assert (paths != NULL); @@ -232,12 +232,12 @@ test_search_paths_nulls (Test *test, g_strfreev (paths); g_clear_object (&result); - secret_service_search_for_paths (test->service, &MOCK_SCHEMA, attributes, NULL, - on_complete_get_result, &result); + secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL, + on_complete_get_result, &result); egg_test_wait (); g_assert (G_IS_ASYNC_RESULT (result)); - ret = secret_service_search_for_paths_finish (test->service, result, - NULL, &paths, &error); + ret = secret_service_search_for_dbus_paths_finish (test->service, result, + NULL, &paths, &error); g_assert_no_error (error); g_assert (ret == TRUE); g_assert (paths != NULL); @@ -245,12 +245,12 @@ test_search_paths_nulls (Test *test, g_strfreev (paths); g_clear_object (&result); - secret_service_search_for_paths (test->service, &MOCK_SCHEMA, attributes, NULL, - on_complete_get_result, &result); + secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL, + on_complete_get_result, &result); egg_test_wait (); g_assert (G_IS_ASYNC_RESULT (result)); - ret = secret_service_search_for_paths_finish (test->service, result, - NULL, NULL, &error); + ret = secret_service_search_for_dbus_paths_finish (test->service, result, + NULL, NULL, &error); g_assert_no_error (error); g_assert (ret == TRUE); g_clear_object (&result); @@ -269,7 +269,7 @@ test_secret_for_path_sync (Test *test, gsize length; path = "/org/freedesktop/secrets/collection/english/1"; - value = secret_service_get_secret_for_path_sync (test->service, path, NULL, &error); + value = secret_service_get_secret_for_dbus_path_sync (test->service, path, NULL, &error); g_assert_no_error (error); g_assert (value != NULL); @@ -295,12 +295,12 @@ test_secret_for_path_async (Test *test, gsize length; path = "/org/freedesktop/secrets/collection/english/1"; - secret_service_get_secret_for_path (test->service, path, NULL, - on_complete_get_result, &result); + secret_service_get_secret_for_dbus_path (test->service, path, NULL, + on_complete_get_result, &result); g_assert (result == NULL); egg_test_wait (); - value = secret_service_get_secret_for_path_finish (test->service, result, &error); + value = secret_service_get_secret_for_dbus_path_finish (test->service, result, &error); g_assert_no_error (error); g_assert (value != NULL); g_object_unref (result); @@ -336,7 +336,7 @@ test_secrets_for_paths_sync (Test *test, const gchar *password; gsize length; - values = secret_service_get_secrets_for_paths_sync (test->service, paths, NULL, &error); + values = secret_service_get_secrets_for_dbus_paths_sync (test->service, paths, NULL, &error); g_assert_no_error (error); g_assert (values != NULL); @@ -379,12 +379,12 @@ test_secrets_for_paths_async (Test *test, GAsyncResult *result = NULL; gsize length; - secret_service_get_secrets_for_paths (test->service, paths, NULL, - on_complete_get_result, &result); + secret_service_get_secrets_for_dbus_paths (test->service, paths, NULL, + on_complete_get_result, &result); g_assert (result == NULL); egg_test_wait (); - values = secret_service_get_secrets_for_paths_finish (test->service, result, &error); + values = secret_service_get_secrets_for_dbus_paths_finish (test->service, result, &error); g_assert_no_error (error); g_object_unref (result); @@ -415,7 +415,7 @@ test_delete_for_path_sync (Test *test, GError *error = NULL; gboolean ret; - ret = secret_service_delete_path_sync (test->service, path_item_one, NULL, &error); + ret = secret_service_delete_item_dbus_path_sync (test->service, path_item_one, NULL, &error); g_assert_no_error (error); g_assert (ret == TRUE); } @@ -429,7 +429,7 @@ test_delete_for_path_sync_prompt (Test *test, GError *error = NULL; gboolean ret; - ret = secret_service_delete_path_sync (test->service, path_item_one, NULL, &error); + ret = secret_service_delete_item_dbus_path_sync (test->service, path_item_one, NULL, &error); g_assert_no_error (error); g_assert (ret == TRUE); } @@ -448,7 +448,7 @@ test_lock_paths_sync (Test *test, gchar **locked = NULL; gboolean ret; - ret = secret_service_lock_paths_sync (test->service, paths, NULL, &locked, &error); + ret = secret_service_lock_dbus_paths_sync (test->service, paths, NULL, &locked, &error); g_assert_no_error (error); g_assert (ret == TRUE); @@ -472,7 +472,7 @@ test_lock_prompt_sync (Test *test, gchar **locked = NULL; gboolean ret; - ret = secret_service_lock_paths_sync (test->service, paths, NULL, &locked, &error); + ret = secret_service_lock_dbus_paths_sync (test->service, paths, NULL, &locked, &error); g_assert_no_error (error); g_assert (ret == TRUE); @@ -496,7 +496,7 @@ test_unlock_paths_sync (Test *test, gchar **unlocked = NULL; gboolean ret; - ret = secret_service_unlock_paths_sync (test->service, paths, NULL, &unlocked, &error); + ret = secret_service_unlock_dbus_paths_sync (test->service, paths, NULL, &unlocked, &error); g_assert_no_error (error); g_assert (ret == TRUE); @@ -520,7 +520,7 @@ test_unlock_prompt_sync (Test *test, gchar **unlocked = NULL; gboolean ret; - ret = secret_service_unlock_paths_sync (test->service, paths, NULL, &unlocked, &error); + ret = secret_service_unlock_dbus_paths_sync (test->service, paths, NULL, &unlocked, &error); g_assert_no_error (error); g_assert (ret == TRUE); @@ -543,8 +543,8 @@ test_collection_sync (Test *test, g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label", g_variant_ref_sink (g_variant_new_string ("Wheeee"))); - path = secret_service_create_collection_path_sync (test->service, properties, - NULL, NULL, &error); + path = secret_service_create_collection_dbus_path_sync (test->service, properties, + NULL, NULL, &error); g_hash_table_unref (properties); @@ -569,15 +569,15 @@ test_collection_async (Test *test, g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label", g_variant_ref_sink (g_variant_new_string ("Wheeee"))); - secret_service_create_collection_path (test->service, properties, - NULL, NULL, on_complete_get_result, &result); + secret_service_create_collection_dbus_path (test->service, properties, + NULL, NULL, on_complete_get_result, &result); g_hash_table_unref (properties); g_assert (result == NULL); egg_test_wait (); - path = secret_service_create_collection_path_finish (test->service, result, &error); + path = secret_service_create_collection_dbus_path_finish (test->service, result, &error); g_object_unref (result); g_assert_no_error (error); @@ -614,9 +614,9 @@ test_item_sync (Test *test, value = secret_value_new ("andmoreandmore", -1, "text/plain"); - path = secret_service_create_item_path_sync (test->service, collection_path, - properties, value, FALSE, - NULL, &error); + path = secret_service_create_item_dbus_path_sync (test->service, collection_path, + properties, value, FALSE, + NULL, &error); secret_value_unref (value); g_hash_table_unref (properties); @@ -656,9 +656,9 @@ test_item_async (Test *test, value = secret_value_new ("andmoreandmore", -1, "text/plain"); - secret_service_create_item_path (test->service, collection_path, - properties, value, FALSE, - NULL, on_complete_get_result, &result); + secret_service_create_item_dbus_path (test->service, collection_path, + properties, value, FALSE, + NULL, on_complete_get_result, &result); g_assert (result == NULL); secret_value_unref (value); @@ -666,7 +666,7 @@ test_item_async (Test *test, egg_test_wait (); - path = secret_service_create_item_path_finish (test->service, result, &error); + path = secret_service_create_item_dbus_path_finish (test->service, result, &error); g_object_unref (result); g_assert_no_error (error); @@ -684,24 +684,24 @@ test_set_alias_path (Test *test, GError *error = NULL; gboolean ret; - path = secret_service_read_alias_path_sync (test->service, "blah", NULL, &error); + path = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error); g_assert_no_error (error); g_assert (path == NULL); - ret = secret_service_set_alias_path_sync (test->service, "blah", "/org/freedesktop/secrets/collection/english", NULL, &error); + ret = secret_service_set_alias_to_dbus_path_sync (test->service, "blah", "/org/freedesktop/secrets/collection/english", NULL, &error); g_assert_no_error (error); g_assert (ret == TRUE); - path = secret_service_read_alias_path_sync (test->service, "blah", NULL, &error); + path = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error); g_assert_no_error (error); g_assert_cmpstr (path, ==, "/org/freedesktop/secrets/collection/english"); g_free (path); - ret = secret_service_set_alias_path_sync (test->service, "blah", NULL, NULL, &error); + ret = secret_service_set_alias_to_dbus_path_sync (test->service, "blah", NULL, NULL, &error); g_assert_no_error (error); g_assert (ret == TRUE); - path = secret_service_read_alias_path_sync (test->service, "blah", NULL, &error); + path = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error); g_assert_no_error (error); g_assert (path == NULL); } diff --git a/library/tests/test-service.c b/library/tests/test-service.c index 85820e4..557c76c 100644 --- a/library/tests/test-service.c +++ b/library/tests/test-service.c @@ -16,6 +16,7 @@ #include "secret-collection.h" #include "secret-item.h" #include "secret-service.h" +#include "secret-paths.h" #include "secret-private.h" #include "mock-service.h" @@ -177,7 +178,7 @@ test_get_more_sync (Test *test, g_assert_no_error (error); g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS); - path = secret_service_get_session_path (service); + path = secret_service_get_session_dbus_path (service); g_assert (path != NULL); g_object_unref (service2); @@ -208,7 +209,7 @@ test_get_more_async (Test *test, result = NULL; g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS); - path = secret_service_get_session_path (service); + path = secret_service_get_session_dbus_path (service); g_assert (path != NULL); collections = secret_service_get_collections (service); @@ -231,7 +232,7 @@ test_get_more_async (Test *test, g_object_unref (result); g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS); - path = secret_service_get_session_path (service); + path = secret_service_get_session_dbus_path (service); g_assert (path == NULL); collections = secret_service_get_collections (service); @@ -324,7 +325,7 @@ test_new_more_sync (Test *test, 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_assert (secret_service_get_session_dbus_path (service) == NULL); g_object_unref (service); egg_assert_not_object (service); @@ -338,7 +339,7 @@ test_new_more_sync (Test *test, collections = secret_service_get_collections (service); g_assert (collections != NULL); g_list_free_full (collections, g_object_unref); - g_assert (secret_service_get_session_path (service) == NULL); + g_assert (secret_service_get_session_dbus_path (service) == NULL); g_object_unref (service); egg_assert_not_object (service); @@ -350,7 +351,7 @@ test_new_more_sync (Test *test, 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); + path = secret_service_get_session_dbus_path (service); g_assert (path != NULL); g_object_unref (service); @@ -379,7 +380,7 @@ test_new_more_async (Test *test, result = NULL; g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS); - path = secret_service_get_session_path (service); + path = secret_service_get_session_dbus_path (service); g_assert (path != NULL); collections = secret_service_get_collections (service); @@ -402,7 +403,7 @@ test_new_more_async (Test *test, g_object_unref (result); g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS); - path = secret_service_get_session_path (service); + path = secret_service_get_session_dbus_path (service); g_assert (path == NULL); collections = secret_service_get_collections (service); @@ -433,7 +434,7 @@ test_connect_async (Test *test, g_assert_no_error (error); g_object_unref (result); - path = secret_service_get_session_path (service); + path = secret_service_get_session_dbus_path (service); g_assert (path == NULL); g_object_unref (service); @@ -461,7 +462,7 @@ test_connect_ensure_async (Test *test, g_assert (SECRET_IS_SERVICE (service)); g_object_unref (result); - path = secret_service_get_session_path (service); + path = secret_service_get_session_dbus_path (service); g_assert (path != NULL); g_object_unref (service); @@ -476,7 +477,6 @@ test_ensure_sync (Test *test, GError *error = NULL; SecretService *service; SecretServiceFlags flags; - const gchar *path; gboolean ret; /* Passing true, ensures session is established */ @@ -495,9 +495,9 @@ test_ensure_sync (Test *test, g_object_get (service, "flags", &flags, NULL); g_assert_cmpuint (flags, ==, SECRET_SERVICE_LOAD_COLLECTIONS); - path = secret_service_ensure_session_sync (service, NULL, &error); + ret = secret_service_ensure_session_sync (service, NULL, &error); g_assert_no_error (error); - g_assert (path != NULL); + g_assert (ret == TRUE); flags = secret_service_get_flags (service); g_assert_cmpuint (flags, ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS); @@ -514,7 +514,6 @@ test_ensure_async (Test *test, SecretServiceFlags flags; SecretService *service; GError *error = NULL; - const gchar *path; gboolean ret; /* Passing true, ensures session is established */ @@ -545,9 +544,9 @@ test_ensure_async (Test *test, egg_test_wait (); - path = secret_service_ensure_session_finish (service, result, &error); + ret = secret_service_ensure_session_finish (service, result, &error); g_assert_no_error (error); - g_assert (path != NULL); + g_assert (ret == TRUE); g_object_unref (result); result = NULL; diff --git a/library/tests/test-session.c b/library/tests/test-session.c index 0439e1b..778470e 100644 --- a/library/tests/test-session.c +++ b/library/tests/test-session.c @@ -15,6 +15,7 @@ #include "secret-item.h" #include "secret-service.h" +#include "secret-paths.h" #include "secret-private.h" #include "mock-service.h" @@ -60,15 +61,15 @@ test_ensure (Test *test, gconstpointer unused) { GError *error = NULL; - const gchar *path; + gboolean ret; - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, NULL); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), ==, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, NULL); - path = secret_service_ensure_session_sync (test->service, NULL, &error); + ret = secret_service_ensure_session_sync (test->service, NULL, &error); g_assert_no_error (error); - g_assert (path != NULL); - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path); + g_assert (ret == TRUE); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7"); } @@ -77,22 +78,26 @@ test_ensure_twice (Test *test, gconstpointer unused) { GError *error = NULL; - const gchar *path; + gchar *path; + gboolean ret; - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, NULL); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), ==, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, NULL); - path = secret_service_ensure_session_sync (test->service, NULL, &error); + ret = secret_service_ensure_session_sync (test->service, NULL, &error); g_assert_no_error (error); - g_assert (path != NULL); - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path); + g_assert (ret == TRUE); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7"); - path = secret_service_ensure_session_sync (test->service, NULL, &error); + path = g_strdup (secret_service_get_session_dbus_path (test->service)); + ret = secret_service_ensure_session_sync (test->service, NULL, &error); g_assert_no_error (error); - g_assert (path != NULL); - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path); + g_assert (ret == TRUE); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), ==, path); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7"); + + g_free (path); } static void @@ -100,16 +105,16 @@ test_ensure_plain (Test *test, gconstpointer unused) { GError *error = NULL; - const gchar *path; + gboolean ret; - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, NULL); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), ==, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, NULL); - path = secret_service_ensure_session_sync (test->service, NULL, &error); + ret = secret_service_ensure_session_sync (test->service, NULL, &error); g_assert_no_error (error); - g_assert (path != NULL); - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path); + g_assert (ret == TRUE); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain"); } @@ -131,17 +136,17 @@ test_ensure_async_plain (Test *test, { GAsyncResult *result = NULL; GError *error = NULL; - const gchar *path; + gboolean ret; secret_service_ensure_session (test->service, NULL, on_complete_get_result, &result); egg_test_wait (); g_assert (G_IS_ASYNC_RESULT (result)); - path = secret_service_ensure_session_finish (test->service, result, &error); + ret = secret_service_ensure_session_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (path != NULL); - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path); + g_assert (ret == TRUE); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain"); g_object_unref (result); @@ -153,17 +158,17 @@ test_ensure_async_aes (Test *test, { GAsyncResult *result = NULL; GError *error = NULL; - const gchar *path; + gboolean ret; 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 = secret_service_ensure_session_finish (test->service, result, &error); + ret = secret_service_ensure_session_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (path != NULL); - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path); + g_assert (ret == TRUE); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7"); g_object_unref (result); @@ -175,34 +180,37 @@ test_ensure_async_twice (Test *test, { GAsyncResult *result = NULL; GError *error = NULL; - const gchar *path; + gboolean ret; + gchar *path; 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 = secret_service_ensure_session_finish (test->service, result, &error); + ret = secret_service_ensure_session_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (path != NULL); - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path); + g_assert (ret == TRUE); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain"); g_object_unref (result); result = NULL; + path = g_strdup (secret_service_get_session_dbus_path (test->service)); 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 = secret_service_ensure_session_finish (test->service, result, &error); + ret = secret_service_ensure_session_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (path != NULL); - g_assert_cmpstr (secret_service_get_session_path (test->service), ==, path); + g_assert (ret == TRUE); + g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), ==, path); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain"); g_object_unref (result); + g_free (path); } int