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_finish
|
||||
secret_service_disconnect
|
||||
secret_service_new
|
||||
secret_service_new_finish
|
||||
secret_service_new_sync
|
||||
secret_service_open
|
||||
secret_service_open_finish
|
||||
secret_service_open_sync
|
||||
secret_service_get_collections
|
||||
secret_service_get_flags
|
||||
secret_service_get_session_algorithms
|
||||
|
@ -38,12 +38,12 @@
|
||||
* Normally a single #SecretService object can be shared between multiple
|
||||
* callers. The secret_service_get() method is used to access this #SecretService
|
||||
* 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
|
||||
* is established. This session can be established while initializing a
|
||||
* #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
|
||||
* secret_service_ensure_session() function.
|
||||
*
|
||||
@ -53,7 +53,7 @@
|
||||
* secret items. In order to instantiate #SecretCollection objects which
|
||||
* represent those collections while initializing a #SecretService then pass
|
||||
* 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.
|
||||
* To access the list of collections use secret_service_get_collections().
|
||||
*
|
||||
@ -101,7 +101,7 @@
|
||||
* #SecretService
|
||||
*
|
||||
* 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 ();
|
||||
@ -537,7 +537,7 @@ secret_service_class_init (SecretServiceClass *klass)
|
||||
*
|
||||
* To load the collections, specify the %SECRET_SERVICE_LOAD_COLLECTIONS
|
||||
* 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.
|
||||
*/
|
||||
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_bus_name: (allow-none): the D-Bus service name of the secret service
|
||||
* @flags: flags for which service functionality to ensure is initialized
|
||||
@ -937,7 +937,7 @@ secret_service_disconnect (void)
|
||||
* This method will return immediately and complete asynchronously.
|
||||
*/
|
||||
void
|
||||
secret_service_new (GType service_gtype,
|
||||
secret_service_open (GType service_gtype,
|
||||
const gchar *service_bus_name,
|
||||
SecretServiceFlags flags,
|
||||
GCancellable *cancellable,
|
||||
@ -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
|
||||
* @error: location to place an error on failure
|
||||
*
|
||||
@ -974,7 +974,7 @@ secret_service_new (GType service_gtype,
|
||||
* should be released with g_object_unref().
|
||||
*/
|
||||
SecretService *
|
||||
secret_service_new_finish (GAsyncResult *result,
|
||||
secret_service_open_finish (GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
GObject *source_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_bus_name: (allow-none): the D-Bus service name of the secret service
|
||||
* @flags: flags for which service functionality to ensure is initialized
|
||||
@ -1021,7 +1021,7 @@ secret_service_new_finish (GAsyncResult *result,
|
||||
* should be released with g_object_unref().
|
||||
*/
|
||||
SecretService *
|
||||
secret_service_new_sync (GType service_gtype,
|
||||
secret_service_open_sync (GType service_gtype,
|
||||
const gchar *service_bus_name,
|
||||
SecretServiceFlags flags,
|
||||
GCancellable *cancellable,
|
||||
|
@ -104,17 +104,17 @@ SecretService * secret_service_get_sync (SecretService
|
||||
|
||||
void secret_service_disconnect (void);
|
||||
|
||||
void secret_service_new (GType service_gtype,
|
||||
void secret_service_open (GType service_gtype,
|
||||
const gchar *service_bus_name,
|
||||
SecretServiceFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
SecretService * secret_service_new_finish (GAsyncResult *result,
|
||||
SecretService * secret_service_open_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
SecretService * secret_service_new_sync (GType service_gtype,
|
||||
SecretService * secret_service_open_sync (GType service_gtype,
|
||||
const gchar *service_bus_name,
|
||||
SecretServiceFlags flags,
|
||||
GCancellable *cancellable,
|
||||
|
@ -246,7 +246,7 @@ test_get_more_async (Test *test,
|
||||
}
|
||||
|
||||
static void
|
||||
test_new_sync (void)
|
||||
test_open_sync (void)
|
||||
{
|
||||
SecretService *service1;
|
||||
SecretService *service2;
|
||||
@ -254,11 +254,11 @@ test_new_sync (void)
|
||||
|
||||
/* 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);
|
||||
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);
|
||||
g_assert_no_error (error);
|
||||
|
||||
@ -274,7 +274,7 @@ test_new_sync (void)
|
||||
}
|
||||
|
||||
static void
|
||||
test_new_async (void)
|
||||
test_open_async (void)
|
||||
{
|
||||
SecretService *service1;
|
||||
SecretService *service2;
|
||||
@ -283,19 +283,19 @@ test_new_async (void)
|
||||
|
||||
/* 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);
|
||||
g_assert (result == NULL);
|
||||
egg_test_wait ();
|
||||
service1 = secret_service_new_finish (result, &error);
|
||||
service1 = secret_service_open_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
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);
|
||||
g_assert (result == NULL);
|
||||
egg_test_wait ();
|
||||
service2 = secret_service_new_finish (result, &error);
|
||||
service2 = secret_service_open_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_clear_object (&result);
|
||||
|
||||
@ -311,7 +311,7 @@ test_new_async (void)
|
||||
}
|
||||
|
||||
static void
|
||||
test_new_more_sync (Test *test,
|
||||
test_open_more_sync (Test *test,
|
||||
gconstpointer data)
|
||||
{
|
||||
SecretService *service;
|
||||
@ -319,7 +319,7 @@ test_new_more_sync (Test *test,
|
||||
const gchar *path;
|
||||
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);
|
||||
g_assert_no_error (error);
|
||||
g_assert (SECRET_IS_SERVICE (service));
|
||||
@ -331,7 +331,7 @@ test_new_more_sync (Test *test,
|
||||
g_object_unref (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);
|
||||
g_assert_no_error (error);
|
||||
g_assert (SECRET_IS_SERVICE (service));
|
||||
@ -345,7 +345,7 @@ test_new_more_sync (Test *test,
|
||||
g_object_unref (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);
|
||||
g_assert_no_error (error);
|
||||
g_assert (SECRET_IS_SERVICE (service));
|
||||
@ -360,7 +360,7 @@ test_new_more_sync (Test *test,
|
||||
}
|
||||
|
||||
static void
|
||||
test_new_more_async (Test *test,
|
||||
test_open_more_async (Test *test,
|
||||
gconstpointer data)
|
||||
{
|
||||
GAsyncResult *result = NULL;
|
||||
@ -369,13 +369,13 @@ test_new_more_async (Test *test,
|
||||
const gchar *path;
|
||||
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);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
service = secret_service_new_finish (result, &error);
|
||||
service = secret_service_open_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
result = NULL;
|
||||
@ -393,13 +393,13 @@ test_new_more_async (Test *test,
|
||||
|
||||
/* 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);
|
||||
g_assert (result == NULL);
|
||||
|
||||
egg_test_wait ();
|
||||
|
||||
service = secret_service_new_finish (result, &error);
|
||||
service = secret_service_open_finish (result, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (result);
|
||||
|
||||
@ -481,7 +481,7 @@ test_ensure_sync (Test *test,
|
||||
gboolean ret;
|
||||
|
||||
/* 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);
|
||||
g_assert_no_error (error);
|
||||
g_assert (service != NULL);
|
||||
@ -518,7 +518,7 @@ test_ensure_async (Test *test,
|
||||
gboolean ret;
|
||||
|
||||
/* 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);
|
||||
g_assert_no_error (error);
|
||||
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-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/new-async", test_new_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/new-more-async", Test, "mock-service-normal.py", setup_mock, test_new_more_async, teardown_mock);
|
||||
g_test_add_func ("/service/open-sync", test_open_sync);
|
||||
g_test_add_func ("/service/open-async", test_open_async);
|
||||
g_test_add ("/service/open-more-sync", Test, "mock-service-normal.py", setup_mock, test_open_more_sync, 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-ensure-sync", Test, "mock-service-normal.py", setup_mock, test_connect_ensure_async, teardown_mock);
|
||||
|
Loading…
Reference in New Issue
Block a user