[libsecret] service: Rename secret_service_new() and friends to open()
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsecret] service: Rename secret_service_new() and friends to open()
- Date: Fri, 21 Jun 2013 13:13:44 +0000 (UTC)
commit 1758194f26a41f660bf1504731053a37fd422315
Author: Stef Walter <stefw gnome org>
Date: Fri Jun 21 10:05:08 2013 +0200
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.
docs/reference/libsecret/libsecret-sections.txt | 6 +-
libsecret/secret-service.c | 42 +++++++-------
libsecret/secret-service.h | 6 +-
libsecret/tests/test-service.c | 68 +++++++++++-----------
4 files changed, 61 insertions(+), 61 deletions(-)
---
diff --git a/docs/reference/libsecret/libsecret-sections.txt b/docs/reference/libsecret/libsecret-sections.txt
index 34045bc..a18b89e 100644
--- a/docs/reference/libsecret/libsecret-sections.txt
+++ b/docs/reference/libsecret/libsecret-sections.txt
@@ -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
diff --git a/libsecret/secret-service.c b/libsecret/secret-service.c
index 171a6c2..a6df85e 100644
--- a/libsecret/secret-service.c
+++ b/libsecret/secret-service.c
@@ -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,12 +937,12 @@ secret_service_disconnect (void)
* This method will return immediately and complete asynchronously.
*/
void
-secret_service_new (GType service_gtype,
- const gchar *service_bus_name,
- SecretServiceFlags flags,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+secret_service_open (GType service_gtype,
+ const gchar *service_bus_name,
+ SecretServiceFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
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
* @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().
*/
SecretService *
-secret_service_new_finish (GAsyncResult *result,
- GError **error)
+secret_service_open_finish (GAsyncResult *result,
+ GError **error)
{
GObject *source_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_bus_name: (allow-none): the D-Bus service name of the secret service
* @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().
*/
SecretService *
-secret_service_new_sync (GType service_gtype,
- const gchar *service_bus_name,
- SecretServiceFlags flags,
- GCancellable *cancellable,
- GError **error)
+secret_service_open_sync (GType service_gtype,
+ const gchar *service_bus_name,
+ SecretServiceFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
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);
diff --git a/libsecret/secret-service.h b/libsecret/secret-service.h
index 9f06ab3..cb11ff6 100644
--- a/libsecret/secret-service.h
+++ b/libsecret/secret-service.h
@@ -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,
diff --git a/libsecret/tests/test-service.c b/libsecret/tests/test-service.c
index 0680046..d78d8df 100644
--- a/libsecret/tests/test-service.c
+++ b/libsecret/tests/test-service.c
@@ -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,12 +254,12 @@ test_new_sync (void)
/* Both these sohuld point to different things */
- service1 = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
- SECRET_SERVICE_NONE, NULL, &error);
+ 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,
- SECRET_SERVICE_NONE, NULL, &error);
+ service2 = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
+ SECRET_SERVICE_NONE, NULL, &error);
g_assert_no_error (error);
g_assert (SECRET_IS_SERVICE (service1));
@@ -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,
- NULL, on_complete_get_result, &result);
+ 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,
- on_complete_get_result, &result);
+ 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,8 +319,8 @@ test_new_more_sync (Test *test,
const gchar *path;
GList *collections;
- service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE,
- NULL, &error);
+ 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,8 +331,8 @@ test_new_more_sync (Test *test,
g_object_unref (service);
egg_assert_not_object (service);
- service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
- SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
+ 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,8 +345,8 @@ test_new_more_sync (Test *test,
g_object_unref (service);
egg_assert_not_object (service);
- service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
- SECRET_SERVICE_OPEN_SESSION, NULL, &error);
+ 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_LOAD_COLLECTIONS | SECRET_SERVICE_OPEN_SESSION, NULL,
on_complete_get_result, &result);
+ 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,
- NULL, on_complete_get_result, &result);
+ 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,8 +481,8 @@ test_ensure_sync (Test *test,
gboolean ret;
/* Passing true, ensures session is established */
- service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
- SECRET_SERVICE_NONE, NULL, &error);
+ service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
+ SECRET_SERVICE_NONE, NULL, &error);
g_assert_no_error (error);
g_assert (service != NULL);
@@ -518,8 +518,8 @@ test_ensure_async (Test *test,
gboolean ret;
/* Passing true, ensures session is established */
- service = secret_service_new_sync (SECRET_TYPE_SERVICE, NULL,
- SECRET_SERVICE_NONE, NULL, &error);
+ 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]