[evolution-data-server] Avoid GSList in new public APIs.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Avoid GSList in new public APIs.
- Date: Sat, 12 Jan 2013 19:14:57 +0000 (UTC)
commit 50392dde24ebf058dba41046ab6ddd4bc360e774
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Jan 12 11:47:16 2013 -0500
Avoid GSList in new public APIs.
camel/camel-session.c | 7 ++++---
camel/camel-session.h | 8 ++++----
camel/camel-tcp-stream-ssl.c | 11 +++++++----
libebackend/e-backend.c | 10 +++++-----
libebackend/e-user-prompter.c | 25 ++++++++++++-------------
libebackend/e-user-prompter.h | 4 ++--
tests/libedataserver/e-user-prompter-test.c | 6 +++---
7 files changed, 37 insertions(+), 34 deletions(-)
---
diff --git a/camel/camel-session.c b/camel/camel-session.c
index ebfffff..ffbf661 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -1290,7 +1290,7 @@ gint
camel_session_alert_user (CamelSession *session,
CamelSessionAlertType type,
const gchar *prompt,
- GSList *button_captions,
+ GList *button_captions,
GCancellable *cancellable)
{
CamelSessionClass *class;
@@ -1301,7 +1301,8 @@ camel_session_alert_user (CamelSession *session,
class = CAMEL_SESSION_GET_CLASS (session);
g_return_val_if_fail (class->alert_user != NULL, -1);
- return class->alert_user (session, type, prompt, button_captions, cancellable);
+ return class->alert_user (
+ session, type, prompt, button_captions, cancellable);
}
/**
@@ -1329,7 +1330,7 @@ camel_session_trust_prompt (CamelSession *session,
const gchar *host,
const gchar *certificate,
guint32 certificate_errors,
- const GSList *issuers,
+ GList *issuers,
GCancellable *cancellable)
{
CamelSessionClass *class;
diff --git a/camel/camel-session.h b/camel/camel-session.h
index 0c7a338..12c72d4 100644
--- a/camel/camel-session.h
+++ b/camel/camel-session.h
@@ -116,13 +116,13 @@ struct _CamelSessionClass {
gint (*alert_user) (CamelSession *session,
CamelSessionAlertType type,
const gchar *prompt,
- GSList *button_captions,
+ GList *button_captions,
GCancellable *cancellable);
CamelCertTrust (*trust_prompt) (CamelSession *session,
const gchar *host,
const gchar *certificate,
guint32 certificate_errors,
- const GSList *issuers,
+ GList *issuers,
GCancellable *cancellable);
CamelFilterDriver *
(*get_filter_driver) (CamelSession *session,
@@ -216,13 +216,13 @@ gboolean camel_session_forget_password (CamelSession *session,
gint camel_session_alert_user (CamelSession *session,
CamelSessionAlertType type,
const gchar *prompt,
- GSList *button_captions,
+ GList *button_captions,
GCancellable *cancellable);
CamelCertTrust camel_session_trust_prompt (CamelSession *session,
const gchar *host,
const gchar *certificate,
guint32 certificate_errors,
- const GSList *issuers,
+ GList *issuers,
GCancellable *cancellable);
gchar * camel_session_build_password_prompt
(const gchar *type,
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index cd3cbc7..d9c6995 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -468,7 +468,7 @@ ssl_bad_cert (gpointer data,
CamelCertTrust trust_response;
gchar *base64;
guint32 certificate_errors = 0;
- GSList *issuers = NULL;
+ GList *issuers = NULL;
if (CERT_VerifyCertNow (cert->dbhandle, cert, TRUE, certUsageSSLClient, NULL) != SECSuccess) {
gint pr_error;
@@ -502,16 +502,19 @@ ssl_bad_cert (gpointer data,
if (!base64)
break;
- issuers = g_slist_append (issuers, base64);
+ issuers = g_list_append (issuers, base64);
}
base64 = g_base64_encode (cert->derCert.data, cert->derCert.len);
/* query the user to find out if we want to accept this certificate */
- trust_response = camel_session_trust_prompt (ssl->priv->session, ssl->priv->expected_host, base64, certificate_errors, issuers, NULL);
+ trust_response = camel_session_trust_prompt (
+ ssl->priv->session,
+ ssl->priv->expected_host,
+ base64, certificate_errors, issuers, NULL);
g_free (base64);
- g_slist_free_full (issuers, g_free);
+ g_list_free_full (issuers, g_free);
accept = trust_response != CAMEL_CERT_TRUST_UNKNOWN &&
trust_response != CAMEL_CERT_TRUST_NEVER;
diff --git a/libebackend/e-backend.c b/libebackend/e-backend.c
index 89a0818..c351bc9 100644
--- a/libebackend/e-backend.c
+++ b/libebackend/e-backend.c
@@ -552,15 +552,15 @@ e_backend_trust_prompt_sync (EBackend *backend,
* this code, together with other SOUP_CHECK_VERSION usages also
* in evolution, will be removed. */
if (!e_named_parameters_get (parameters, "cert")) {
- GSList *button_captions = NULL;
+ GList *button_captions = NULL;
const gchar *markup;
gchar *tmp = NULL;
- button_captions = g_slist_append (
+ button_captions = g_list_append (
button_captions, _("_Reject"));
- button_captions = g_slist_append (
+ button_captions = g_list_append (
button_captions, _("Accept _Temporarily"));
- button_captions = g_slist_append (
+ button_captions = g_list_append (
button_captions, _("_Accept Permanently"));
markup = e_named_parameters_get (parameters, "markup");
@@ -587,7 +587,7 @@ e_backend_trust_prompt_sync (EBackend *backend,
else if (response == 2)
response = 1;
- g_slist_free (button_captions);
+ g_list_free (button_captions);
g_free (tmp);
} else {
response = e_user_prompter_extension_prompt_sync (
diff --git a/libebackend/e-user-prompter.c b/libebackend/e-user-prompter.c
index 23da640..127b9fd 100644
--- a/libebackend/e-user-prompter.c
+++ b/libebackend/e-user-prompter.c
@@ -77,7 +77,7 @@ typedef struct _PrompterAsyncData {
gchar *primary_text;
gchar *secondary_text;
gboolean use_markup;
- GSList *button_captions;
+ GList *button_captions;
/* ExtensionPrompt data */
gchar *dialog_name;
@@ -110,7 +110,7 @@ prompter_async_data_free (PrompterAsyncData *async_data)
g_free (async_data->title);
g_free (async_data->primary_text);
g_free (async_data->secondary_text);
- g_slist_free_full (async_data->button_captions, g_free);
+ g_list_free_full (async_data->button_captions, g_free);
g_free (async_data->dialog_name);
e_named_parameters_free (async_data->in_parameters);
@@ -142,15 +142,18 @@ user_prompter_prompt_invoke (EDBusUserPrompter *dbus_prompter,
GError **error)
{
GPtrArray *captions;
- GSList *iter;
+ GList *list, *link;
gboolean success;
g_return_val_if_fail (dbus_prompter != NULL, FALSE);
g_return_val_if_fail (async_data != NULL, FALSE);
+ list = async_data->button_captions;
+
captions = g_ptr_array_new ();
- for (iter = async_data->button_captions; iter; iter = g_slist_next (iter)) {
- gchar *caption = iter->data;
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ gchar *caption = link->data;
g_ptr_array_add (captions, caption ? caption : (gchar *) "");
}
@@ -341,14 +344,13 @@ e_user_prompter_prompt (EUserPrompter *prompter,
const gchar *primary_text,
const gchar *secondary_text,
gboolean use_markup,
- const GSList *button_captions,
+ GList *button_captions,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *simple;
PrompterAsyncData *async_data;
- GSList *iter;
g_return_if_fail (E_IS_USER_PROMPTER (prompter));
g_return_if_fail (callback != NULL);
@@ -363,7 +365,8 @@ e_user_prompter_prompt (EUserPrompter *prompter,
async_data->primary_text = g_strdup (primary_text);
async_data->secondary_text = g_strdup (secondary_text);
async_data->use_markup = use_markup;
- async_data->button_captions = g_slist_copy ((GSList *) button_captions);
+ async_data->button_captions = g_list_copy_deep (
+ button_captions, (GCopyFunc) g_strdup, NULL);
async_data->prompt_id = -1;
async_data->response_button = -1;
@@ -371,10 +374,6 @@ e_user_prompter_prompt (EUserPrompter *prompter,
async_data->response_callback = G_CALLBACK (user_prompter_response_cb);
async_data->invoke = user_prompter_prompt_invoke;
- for (iter = async_data->button_captions; iter; iter = g_slist_next (iter)) {
- iter->data = g_strdup (iter->data);
- }
-
g_simple_async_result_set_op_res_gpointer (simple, async_data, (GDestroyNotify) prompter_async_data_free);
g_simple_async_result_run_in_thread (simple, user_prompter_prompt_thread, G_PRIORITY_DEFAULT, cancellable);
@@ -452,7 +451,7 @@ e_user_prompter_prompt_sync (EUserPrompter *prompter,
const gchar *primary_text,
const gchar *secondary_text,
gboolean use_markup,
- const GSList *button_captions,
+ GList *button_captions,
GCancellable *cancellable,
GError **error)
{
diff --git a/libebackend/e-user-prompter.h b/libebackend/e-user-prompter.h
index f572d4c..80477fc 100644
--- a/libebackend/e-user-prompter.h
+++ b/libebackend/e-user-prompter.h
@@ -74,7 +74,7 @@ void e_user_prompter_prompt (EUserPrompter *prompter,
const gchar *primary_text,
const gchar *secondary_text,
gboolean use_markup,
- const GSList *button_captions,
+ GList *button_captions,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -87,7 +87,7 @@ gint e_user_prompter_prompt_sync (EUserPrompter *prompter,
const gchar *primary_text,
const gchar *secondary_text,
gboolean use_markup,
- const GSList *button_captions,
+ GList *button_captions,
GCancellable *cancellable,
GError **error);
void e_user_prompter_extension_prompt
diff --git a/tests/libedataserver/e-user-prompter-test.c b/tests/libedataserver/e-user-prompter-test.c
index 72944f0..701353d 100644
--- a/tests/libedataserver/e-user-prompter-test.c
+++ b/tests/libedataserver/e-user-prompter-test.c
@@ -220,7 +220,7 @@ test_user_prompts_idle_cb (gpointer user_data)
sz = G_N_ELEMENTS (prompts);
for (ii = 0; !fixture->only_certificate && ii < sz && !error; ii++) {
gchar *title, *primary, *secondary, **buttons = NULL;
- GSList *captions = NULL;
+ GList *captions = NULL;
title = g_strdup_printf ("Prompt %d...", ii);
primary = g_strdup_printf (prompts[ii].primary, ii);
@@ -230,7 +230,7 @@ test_user_prompts_idle_cb (gpointer user_data)
buttons = g_strsplit (prompts[ii].buttons, ":", -1);
for (jj = 0; buttons[jj]; jj++) {
- captions = g_slist_append (captions, buttons[jj]);
+ captions = g_list_append (captions, buttons[jj]);
}
}
@@ -260,7 +260,7 @@ test_user_prompts_idle_cb (gpointer user_data)
g_free (primary);
g_free (secondary);
g_strfreev (buttons);
- g_slist_free (captions);
+ g_list_free (captions);
}
g_assert_no_error (error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]