mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 12:48:51 +00:00
service: Rename secret_service_new() and friends to open()
The _new() suffix confuses vala and gobject introspection thinking that it's a constructor, and there's no way to tell it otherwise. And things really get messy because they're async functions. So while we're still unstable, rename these functions to secret_service_open() secret_service_open_sync() and secret_service_open_finish(). This is an API/API break, but its to the portion of the library marked as unstable. Only used by seahorse (in jhbuild) and updated usage there.
This commit is contained in:
parent
cec740fea9
commit
1758194f26
@ -189,9 +189,9 @@ secret_service_get
|
|||||||
secret_service_get_sync
|
secret_service_get_sync
|
||||||
secret_service_get_finish
|
secret_service_get_finish
|
||||||
secret_service_disconnect
|
secret_service_disconnect
|
||||||
secret_service_new
|
secret_service_open
|
||||||
secret_service_new_finish
|
secret_service_open_finish
|
||||||
secret_service_new_sync
|
secret_service_open_sync
|
||||||
secret_service_get_collections
|
secret_service_get_collections
|
||||||
secret_service_get_flags
|
secret_service_get_flags
|
||||||
secret_service_get_session_algorithms
|
secret_service_get_session_algorithms
|
||||||
|
@ -38,12 +38,12 @@
|
|||||||
* Normally a single #SecretService object can be shared between multiple
|
* Normally a single #SecretService object can be shared between multiple
|
||||||
* callers. The secret_service_get() method is used to access this #SecretService
|
* callers. The secret_service_get() method is used to access this #SecretService
|
||||||
* object. If a new independent #SecretService object is required, use
|
* object. If a new independent #SecretService object is required, use
|
||||||
* secret_service_new().
|
* secret_service_open().
|
||||||
*
|
*
|
||||||
* In order to securely transfer secrets to the Sercret Service, an session
|
* In order to securely transfer secrets to the Sercret Service, an session
|
||||||
* is established. This session can be established while initializing a
|
* is established. This session can be established while initializing a
|
||||||
* #SecretService object by passing the %SECRET_SERVICE_OPEN_SESSION flag
|
* #SecretService object by passing the %SECRET_SERVICE_OPEN_SESSION flag
|
||||||
* to the secret_service_get() or secret_service_new() functions. In order to
|
* to the secret_service_get() or secret_service_open() functions. In order to
|
||||||
* establish a session on an already existing #SecretService, use the
|
* establish a session on an already existing #SecretService, use the
|
||||||
* secret_service_ensure_session() function.
|
* secret_service_ensure_session() function.
|
||||||
*
|
*
|
||||||
@ -53,7 +53,7 @@
|
|||||||
* secret items. In order to instantiate #SecretCollection objects which
|
* secret items. In order to instantiate #SecretCollection objects which
|
||||||
* represent those collections while initializing a #SecretService then pass
|
* represent those collections while initializing a #SecretService then pass
|
||||||
* the %SECRET_SERVICE_LOAD_COLLECTIONS flag to the secret_service_get() or
|
* the %SECRET_SERVICE_LOAD_COLLECTIONS flag to the secret_service_get() or
|
||||||
* secret_service_new() functions. In order to establish a session on an already
|
* secret_service_open() functions. In order to establish a session on an already
|
||||||
* existing #SecretService, use the secret_service_load_collections() function.
|
* existing #SecretService, use the secret_service_load_collections() function.
|
||||||
* To access the list of collections use secret_service_get_collections().
|
* To access the list of collections use secret_service_get_collections().
|
||||||
*
|
*
|
||||||
@ -101,7 +101,7 @@
|
|||||||
* #SecretService
|
* #SecretService
|
||||||
*
|
*
|
||||||
* Flags which determine which parts of the #SecretService proxy are initialized
|
* Flags which determine which parts of the #SecretService proxy are initialized
|
||||||
* during a secret_service_get() or secret_service_new() operation.
|
* during a secret_service_get() or secret_service_open() operation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EGG_SECURE_DEFINE_GLIB_GLOBALS ();
|
EGG_SECURE_DEFINE_GLIB_GLOBALS ();
|
||||||
@ -537,7 +537,7 @@ secret_service_class_init (SecretServiceClass *klass)
|
|||||||
*
|
*
|
||||||
* To load the collections, specify the %SECRET_SERVICE_LOAD_COLLECTIONS
|
* To load the collections, specify the %SECRET_SERVICE_LOAD_COLLECTIONS
|
||||||
* initialization flag when calling the secret_service_get() or
|
* initialization flag when calling the secret_service_get() or
|
||||||
* secret_service_new() functions. Or call the secret_service_load_collections()
|
* secret_service_open() functions. Or call the secret_service_load_collections()
|
||||||
* method.
|
* method.
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class, PROP_COLLECTIONS,
|
g_object_class_install_property (object_class, PROP_COLLECTIONS,
|
||||||
@ -914,7 +914,7 @@ secret_service_disconnect (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* secret_service_new:
|
* secret_service_open:
|
||||||
* @service_gtype: the GType of the new secret service
|
* @service_gtype: the GType of the new secret service
|
||||||
* @service_bus_name: (allow-none): the D-Bus service name of the secret service
|
* @service_bus_name: (allow-none): the D-Bus service name of the secret service
|
||||||
* @flags: flags for which service functionality to ensure is initialized
|
* @flags: flags for which service functionality to ensure is initialized
|
||||||
@ -937,12 +937,12 @@ secret_service_disconnect (void)
|
|||||||
* This method will return immediately and complete asynchronously.
|
* This method will return immediately and complete asynchronously.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
secret_service_new (GType service_gtype,
|
secret_service_open (GType service_gtype,
|
||||||
const gchar *service_bus_name,
|
const gchar *service_bus_name,
|
||||||
SecretServiceFlags flags,
|
SecretServiceFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||||
g_return_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE));
|
g_return_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE));
|
||||||
@ -963,7 +963,7 @@ secret_service_new (GType service_gtype,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* secret_service_new_finish:
|
* secret_service_open_finish:
|
||||||
* @result: the asynchronous result passed to the callback
|
* @result: the asynchronous result passed to the callback
|
||||||
* @error: location to place an error on failure
|
* @error: location to place an error on failure
|
||||||
*
|
*
|
||||||
@ -974,8 +974,8 @@ secret_service_new (GType service_gtype,
|
|||||||
* should be released with g_object_unref().
|
* should be released with g_object_unref().
|
||||||
*/
|
*/
|
||||||
SecretService *
|
SecretService *
|
||||||
secret_service_new_finish (GAsyncResult *result,
|
secret_service_open_finish (GAsyncResult *result,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GObject *source_object;
|
GObject *source_object;
|
||||||
GObject *object;
|
GObject *object;
|
||||||
@ -995,7 +995,7 @@ secret_service_new_finish (GAsyncResult *result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* secret_service_new_sync:
|
* secret_service_open_sync:
|
||||||
* @service_gtype: the GType of the new secret service
|
* @service_gtype: the GType of the new secret service
|
||||||
* @service_bus_name: (allow-none): the D-Bus service name of the secret service
|
* @service_bus_name: (allow-none): the D-Bus service name of the secret service
|
||||||
* @flags: flags for which service functionality to ensure is initialized
|
* @flags: flags for which service functionality to ensure is initialized
|
||||||
@ -1021,11 +1021,11 @@ secret_service_new_finish (GAsyncResult *result,
|
|||||||
* should be released with g_object_unref().
|
* should be released with g_object_unref().
|
||||||
*/
|
*/
|
||||||
SecretService *
|
SecretService *
|
||||||
secret_service_new_sync (GType service_gtype,
|
secret_service_open_sync (GType service_gtype,
|
||||||
const gchar *service_bus_name,
|
const gchar *service_bus_name,
|
||||||
SecretServiceFlags flags,
|
SecretServiceFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
|
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
|
||||||
g_return_val_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE), NULL);
|
g_return_val_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE), NULL);
|
||||||
|
@ -104,17 +104,17 @@ SecretService * secret_service_get_sync (SecretService
|
|||||||
|
|
||||||
void secret_service_disconnect (void);
|
void secret_service_disconnect (void);
|
||||||
|
|
||||||
void secret_service_new (GType service_gtype,
|
void secret_service_open (GType service_gtype,
|
||||||
const gchar *service_bus_name,
|
const gchar *service_bus_name,
|
||||||
SecretServiceFlags flags,
|
SecretServiceFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
SecretService * secret_service_new_finish (GAsyncResult *result,
|
SecretService * secret_service_open_finish (GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
SecretService * secret_service_new_sync (GType service_gtype,
|
SecretService * secret_service_open_sync (GType service_gtype,
|
||||||
const gchar *service_bus_name,
|
const gchar *service_bus_name,
|
||||||
SecretServiceFlags flags,
|
SecretServiceFlags flags,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
|
@ -246,7 +246,7 @@ test_get_more_async (Test *test,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_new_sync (void)
|
test_open_sync (void)
|
||||||
{
|
{
|
||||||
SecretService *service1;
|
SecretService *service1;
|
||||||
SecretService *service2;
|
SecretService *service2;
|
||||||
@ -254,12 +254,12 @@ test_new_sync (void)
|
|||||||
|
|
||||||
/* Both these sohuld point to different things */
|
/* Both these sohuld point to different things */
|
||||||
|
|
||||||
service1 = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
|
service1 = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_NONE, NULL, &error);
|
SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
service2 = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
|
service2 = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_NONE, NULL, &error);
|
SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
g_assert (SECRET_IS_SERVICE (service1));
|
g_assert (SECRET_IS_SERVICE (service1));
|
||||||
@ -274,7 +274,7 @@ test_new_sync (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_new_async (void)
|
test_open_async (void)
|
||||||
{
|
{
|
||||||
SecretService *service1;
|
SecretService *service1;
|
||||||
SecretService *service2;
|
SecretService *service2;
|
||||||
@ -283,19 +283,19 @@ test_new_async (void)
|
|||||||
|
|
||||||
/* Both these sohuld point to different things */
|
/* Both these sohuld point to different things */
|
||||||
|
|
||||||
secret_service_new (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE,
|
secret_service_open (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE,
|
||||||
NULL, on_complete_get_result, &result);
|
NULL, on_complete_get_result, &result);
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
egg_test_wait ();
|
egg_test_wait ();
|
||||||
service1 = secret_service_new_finish (result, &error);
|
service1 = secret_service_open_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_clear_object (&result);
|
g_clear_object (&result);
|
||||||
|
|
||||||
secret_service_new (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE, NULL,
|
secret_service_open (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE, NULL,
|
||||||
on_complete_get_result, &result);
|
on_complete_get_result, &result);
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
egg_test_wait ();
|
egg_test_wait ();
|
||||||
service2 = secret_service_new_finish (result, &error);
|
service2 = secret_service_open_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_clear_object (&result);
|
g_clear_object (&result);
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ test_new_async (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_new_more_sync (Test *test,
|
test_open_more_sync (Test *test,
|
||||||
gconstpointer data)
|
gconstpointer data)
|
||||||
{
|
{
|
||||||
SecretService *service;
|
SecretService *service;
|
||||||
@ -319,8 +319,8 @@ test_new_more_sync (Test *test,
|
|||||||
const gchar *path;
|
const gchar *path;
|
||||||
GList *collections;
|
GList *collections;
|
||||||
|
|
||||||
service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE,
|
service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE,
|
||||||
NULL, &error);
|
NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (SECRET_IS_SERVICE (service));
|
g_assert (SECRET_IS_SERVICE (service));
|
||||||
|
|
||||||
@ -331,8 +331,8 @@ test_new_more_sync (Test *test,
|
|||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
egg_assert_not_object (service);
|
egg_assert_not_object (service);
|
||||||
|
|
||||||
service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
|
service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
|
SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (SECRET_IS_SERVICE (service));
|
g_assert (SECRET_IS_SERVICE (service));
|
||||||
|
|
||||||
@ -345,8 +345,8 @@ test_new_more_sync (Test *test,
|
|||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
egg_assert_not_object (service);
|
egg_assert_not_object (service);
|
||||||
|
|
||||||
service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
|
service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_OPEN_SESSION, NULL, &error);
|
SECRET_SERVICE_OPEN_SESSION, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (SECRET_IS_SERVICE (service));
|
g_assert (SECRET_IS_SERVICE (service));
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ test_new_more_sync (Test *test,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_new_more_async (Test *test,
|
test_open_more_async (Test *test,
|
||||||
gconstpointer data)
|
gconstpointer data)
|
||||||
{
|
{
|
||||||
GAsyncResult *result = NULL;
|
GAsyncResult *result = NULL;
|
||||||
@ -369,13 +369,13 @@ test_new_more_async (Test *test,
|
|||||||
const gchar *path;
|
const gchar *path;
|
||||||
GList *collections;
|
GList *collections;
|
||||||
|
|
||||||
secret_service_new (SECRET_TYPE_SERVICE, NULL,
|
secret_service_open (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_LOAD_COLLECTIONS | SECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result);
|
SECRET_SERVICE_LOAD_COLLECTIONS | SECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result);
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
|
|
||||||
egg_test_wait ();
|
egg_test_wait ();
|
||||||
|
|
||||||
service = secret_service_new_finish (result, &error);
|
service = secret_service_open_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
result = NULL;
|
result = NULL;
|
||||||
@ -393,13 +393,13 @@ test_new_more_async (Test *test,
|
|||||||
|
|
||||||
/* Now get a session with just collections */
|
/* Now get a session with just collections */
|
||||||
|
|
||||||
secret_service_new (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_LOAD_COLLECTIONS,
|
secret_service_open (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_LOAD_COLLECTIONS,
|
||||||
NULL, on_complete_get_result, &result);
|
NULL, on_complete_get_result, &result);
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
|
|
||||||
egg_test_wait ();
|
egg_test_wait ();
|
||||||
|
|
||||||
service = secret_service_new_finish (result, &error);
|
service = secret_service_open_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
|
|
||||||
@ -481,8 +481,8 @@ test_ensure_sync (Test *test,
|
|||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
/* Passing true, ensures session is established */
|
/* Passing true, ensures session is established */
|
||||||
service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
|
service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_NONE, NULL, &error);
|
SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (service != NULL);
|
g_assert (service != NULL);
|
||||||
|
|
||||||
@ -518,8 +518,8 @@ test_ensure_async (Test *test,
|
|||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
/* Passing true, ensures session is established */
|
/* Passing true, ensures session is established */
|
||||||
service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
|
service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_NONE, NULL, &error);
|
SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (service != NULL);
|
g_assert (service != NULL);
|
||||||
|
|
||||||
@ -572,10 +572,10 @@ main (int argc, char **argv)
|
|||||||
g_test_add ("/service/get-more-sync", Test, "mock-service-normal.py", setup_mock, test_get_more_sync, teardown_mock);
|
g_test_add ("/service/get-more-sync", Test, "mock-service-normal.py", setup_mock, test_get_more_sync, teardown_mock);
|
||||||
g_test_add ("/service/get-more-async", Test, "mock-service-normal.py", setup_mock, test_get_more_async, teardown_mock);
|
g_test_add ("/service/get-more-async", Test, "mock-service-normal.py", setup_mock, test_get_more_async, teardown_mock);
|
||||||
|
|
||||||
g_test_add_func ("/service/new-sync", test_new_sync);
|
g_test_add_func ("/service/open-sync", test_open_sync);
|
||||||
g_test_add_func ("/service/new-async", test_new_async);
|
g_test_add_func ("/service/open-async", test_open_async);
|
||||||
g_test_add ("/service/new-more-sync", Test, "mock-service-normal.py", setup_mock, test_new_more_sync, teardown_mock);
|
g_test_add ("/service/open-more-sync", Test, "mock-service-normal.py", setup_mock, test_open_more_sync, teardown_mock);
|
||||||
g_test_add ("/service/new-more-async", Test, "mock-service-normal.py", setup_mock, test_new_more_async, teardown_mock);
|
g_test_add ("/service/open-more-async", Test, "mock-service-normal.py", setup_mock, test_open_more_async, teardown_mock);
|
||||||
|
|
||||||
g_test_add ("/service/connect-sync", Test, "mock-service-normal.py", setup_mock, test_connect_async, teardown_mock);
|
g_test_add ("/service/connect-sync", Test, "mock-service-normal.py", setup_mock, test_connect_async, teardown_mock);
|
||||||
g_test_add ("/service/connect-ensure-sync", Test, "mock-service-normal.py", setup_mock, test_connect_ensure_async, teardown_mock);
|
g_test_add ("/service/connect-ensure-sync", Test, "mock-service-normal.py", setup_mock, test_connect_ensure_async, teardown_mock);
|
||||||
|
Loading…
Reference in New Issue
Block a user