[evolution-data-server/account-mgmt: 7/33] Adapt EClient to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/account-mgmt: 7/33] Adapt EClient to the new ESource API.
- Date: Wed, 7 Sep 2011 16:07:41 +0000 (UTC)
commit 1f145bb5c91f593011cea0bc125411ae85485e77
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed May 25 14:18:31 2011 -0400
Adapt EClient to the new ESource API.
.../libedataserver/libedataserver-sections.txt | 10 -
docs/reference/libedataserver/tmpl/e-client.sgml | 9 -
.../libedataserver/tmpl/e-credentials.sgml | 62 ------
libedataserver/e-client-private.h | 5 -
libedataserver/e-client.c | 208 --------------------
libedataserver/e-client.h | 2 -
libedataserver/e-credentials.c | 195 ++++---------------
libedataserver/e-credentials.h | 66 +------
8 files changed, 42 insertions(+), 515 deletions(-)
---
diff --git a/docs/reference/libedataserver/libedataserver-sections.txt b/docs/reference/libedataserver/libedataserver-sections.txt
index 3c96a0e..217563b 100644
--- a/docs/reference/libedataserver/libedataserver-sections.txt
+++ b/docs/reference/libedataserver/libedataserver-sections.txt
@@ -32,7 +32,6 @@ CLIENT_BACKEND_PROPERTY_CACHE_DIR
CLIENT_BACKEND_PROPERTY_CAPABILITIES
EClient
e_client_get_source
-e_client_get_uri
e_client_get_capabilities
e_client_check_capability
e_client_check_refresh_supported
@@ -86,15 +85,10 @@ e_client_error_quark
<FILE>e-credentials</FILE>
<TITLE>ECredentials</TITLE>
ECredentials
-E_CREDENTIALS_KEY_USERNAME
E_CREDENTIALS_KEY_PASSWORD
-E_CREDENTIALS_KEY_AUTH_METHOD
-E_CREDENTIALS_KEY_PROMPT_TITLE
E_CREDENTIALS_KEY_PROMPT_TEXT
E_CREDENTIALS_KEY_PROMPT_REASON
-E_CREDENTIALS_KEY_PROMPT_KEY
E_CREDENTIALS_KEY_PROMPT_FLAGS
-ECredentialsPromptFlags
e_credentials_new
e_credentials_new_strv
e_credentials_new_args
@@ -112,10 +106,6 @@ e_credentials_list_keys
e_credentials_clear
e_credentials_clear_peek
e_credentials_util_safe_free_string
-e_credentials_util_prompt_flags_to_string
-e_credentials_util_string_to_prompt_flags
-<SUBSECTION Private>
-ECredentialsPrivate
</SECTION>
<SECTION>
diff --git a/docs/reference/libedataserver/tmpl/e-client.sgml b/docs/reference/libedataserver/tmpl/e-client.sgml
index 2b80153..85564a7 100644
--- a/docs/reference/libedataserver/tmpl/e-client.sgml
+++ b/docs/reference/libedataserver/tmpl/e-client.sgml
@@ -196,15 +196,6 @@ EClient
@Returns:
-<!-- ##### FUNCTION e_client_get_uri ##### -->
-<para>
-
-</para>
-
- client:
- Returns:
-
-
<!-- ##### FUNCTION e_client_get_capabilities ##### -->
<para>
diff --git a/docs/reference/libedataserver/tmpl/e-credentials.sgml b/docs/reference/libedataserver/tmpl/e-credentials.sgml
index 547a5a6..3e74274 100644
--- a/docs/reference/libedataserver/tmpl/e-credentials.sgml
+++ b/docs/reference/libedataserver/tmpl/e-credentials.sgml
@@ -25,14 +25,6 @@ ECredentials
</para>
- priv:
-
-<!-- ##### MACRO E_CREDENTIALS_KEY_USERNAME ##### -->
-<para>
-
-</para>
-
-
<!-- ##### MACRO E_CREDENTIALS_KEY_PASSWORD ##### -->
<para>
@@ -41,20 +33,6 @@ ECredentials
-<!-- ##### MACRO E_CREDENTIALS_KEY_AUTH_METHOD ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO E_CREDENTIALS_KEY_PROMPT_TITLE ##### -->
-<para>
-
-</para>
-
-
-
<!-- ##### MACRO E_CREDENTIALS_KEY_PROMPT_TEXT ##### -->
<para>
@@ -69,13 +47,6 @@ ECredentials
-<!-- ##### MACRO E_CREDENTIALS_KEY_PROMPT_KEY ##### -->
-<para>
-
-</para>
-
-
-
<!-- ##### MACRO E_CREDENTIALS_KEY_PROMPT_FLAGS ##### -->
<para>
@@ -83,21 +54,6 @@ ECredentials
-<!-- ##### ENUM ECredentialsPromptFlags ##### -->
-<para>
-
-</para>
-
- E_CREDENTIALS_PROMPT_FLAG_REMEMBER_NEVER:
- E_CREDENTIALS_PROMPT_FLAG_REMEMBER_SESSION:
- E_CREDENTIALS_PROMPT_FLAG_REMEMBER_FOREVER:
- E_CREDENTIALS_PROMPT_FLAG_REMEMBER_MASK:
- E_CREDENTIALS_PROMPT_FLAG_SECRET:
- E_CREDENTIALS_PROMPT_FLAG_REPROMPT:
- E_CREDENTIALS_PROMPT_FLAG_ONLINE:
- E_CREDENTIALS_PROMPT_FLAG_DISABLE_REMEMBER:
- E_CREDENTIALS_PROMPT_FLAG_PASSPHRASE:
-
<!-- ##### FUNCTION e_credentials_new ##### -->
<para>
@@ -256,21 +212,3 @@ ECredentials
@str:
-<!-- ##### FUNCTION e_credentials_util_prompt_flags_to_string ##### -->
-<para>
-
-</para>
-
- prompt_flags:
- Returns:
-
-
-<!-- ##### FUNCTION e_credentials_util_string_to_prompt_flags ##### -->
-<para>
-
-</para>
-
- prompt_flags_string:
- Returns:
-
-
diff --git a/libedataserver/e-client-private.h b/libedataserver/e-client-private.h
index 23736d1..5f934f3 100644
--- a/libedataserver/e-client-private.h
+++ b/libedataserver/e-client-private.h
@@ -26,7 +26,6 @@
#include "libedataserver/e-credentials.h"
#include "libedataserver/e-source.h"
-#include "libedataserver/e-source-list.h"
#include "libedataserver/e-client.h"
G_BEGIN_DECLS
@@ -47,10 +46,6 @@ void e_client_emit_backend_property_changed (EClient *client, const gchar *pr
void e_client_update_backend_property_cache (EClient *client, const gchar *prop_name, const gchar *prop_value);
gchar * e_client_get_backend_property_from_cache (EClient *client, const gchar *prop_name);
-ESource * e_client_util_get_system_source (ESourceList *source_list);
-gboolean e_client_util_set_default (ESourceList *source_list, ESource *source);
-ESource * e_client_util_get_source_for_uri (ESourceList *source_list, const gchar *uri);
-
/* protected functions simplifying sync/async calls */
void e_client_finish_async_without_dbus (EClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer soure_tag, gpointer op_res, GDestroyNotify destroy_op_res);
GDBusProxy * e_client_get_dbus_proxy (EClient *client);
diff --git a/libedataserver/e-client.c b/libedataserver/e-client.c
index 1d7879c..82127e1 100644
--- a/libedataserver/e-client.c
+++ b/libedataserver/e-client.c
@@ -460,29 +460,6 @@ e_client_get_source (EClient *client)
return client->priv->source;
}
-/**
- * e_client_get_uri:
- * @client: an #EClient
- *
- * Get the URI that this client has assigned. This string should not be freed.
- *
- * Returns: The URI.
- *
- * Since: 3.2
- **/
-const gchar *
-e_client_get_uri (EClient *client)
-{
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (E_IS_CLIENT (client), NULL);
- g_return_val_if_fail (client->priv != NULL, NULL);
-
- if (!client->priv->uri)
- client->priv->uri = e_source_get_uri (e_client_get_source (client));
-
- return client->priv->uri;
-}
-
static void
client_ensure_capabilities (EClient *client)
{
@@ -1830,191 +1807,6 @@ e_client_util_parse_comma_strings (const gchar *strings)
return g_slist_reverse (strs_slist);
}
-/* for each known source calls check_func, which should return TRUE if the required
- * source have been found. Function returns NULL or the source on which was returned
- * TRUE by the check_func. Non - NULL pointer should be unreffed by g_object_unref. */
-static ESource *
-search_known_sources (ESourceList *sources,
- gboolean (*check_func) (ESource *source,
- gpointer user_data),
- gpointer user_data)
-{
- ESource *res = NULL;
- GSList *g;
-
- g_return_val_if_fail (check_func != NULL, NULL);
- g_return_val_if_fail (sources != NULL, NULL);
-
- for (g = e_source_list_peek_groups (sources); g; g = g->next) {
- ESourceGroup *group = E_SOURCE_GROUP (g->data);
- GSList *s;
-
- for (s = e_source_group_peek_sources (group); s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
-
- if (check_func (source, user_data)) {
- res = g_object_ref (source);
- break;
- }
- }
-
- if (res)
- break;
- }
-
- return res;
-}
-
-static gboolean
-check_uri (ESource *source,
- gpointer uri)
-{
- const gchar *suri;
- gchar *suri2;
- gboolean res;
-
- g_return_val_if_fail (source != NULL, FALSE);
- g_return_val_if_fail (uri != NULL, FALSE);
-
- suri = e_source_peek_absolute_uri (source);
-
- if (suri)
- return g_ascii_strcasecmp (suri, uri) == 0;
-
- suri2 = e_source_get_uri (source);
- res = suri2 && g_ascii_strcasecmp (suri2, uri) == 0;
- g_free (suri2);
-
- return res;
-}
-
-struct check_system_data
-{
- const gchar *uri;
- ESource *uri_source;
-};
-
-static gboolean
-check_system (ESource *source,
- gpointer data)
-{
- struct check_system_data *csd = data;
-
- g_return_val_if_fail (source != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- if (e_source_get_property (source, "system")) {
- return TRUE;
- }
-
- if (check_uri (source, (gpointer) csd->uri)) {
- if (csd->uri_source)
- g_object_unref (csd->uri_source);
- csd->uri_source = g_object_ref (source);
- }
-
- return FALSE;
-}
-
-ESource *
-e_client_util_get_system_source (ESourceList *source_list)
-{
- struct check_system_data csd;
- ESource *system_source = NULL;
-
- g_return_val_if_fail (source_list != NULL, NULL);
- g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
-
- csd.uri = "local:system";
- csd.uri_source = NULL;
-
- system_source = search_known_sources (source_list, check_system, &csd);
-
- if (!system_source) {
- system_source = csd.uri_source;
- csd.uri_source = NULL;
- }
-
- if (csd.uri_source)
- g_object_unref (csd.uri_source);
-
- if (!system_source) {
- /* create a new one, if not found */
- ESourceGroup *on_this_computer;
-
- on_this_computer = e_source_list_ensure_group (source_list,
- _("On This Computer"),
- "local:", TRUE);
- if (on_this_computer) {
- GError *error = NULL;
-
- system_source = e_source_new (_("Personal"), "system");
- e_source_set_color_spec (system_source, "#BECEDD");
- e_source_group_add_source (on_this_computer, system_source, -1);
-
- if (!e_source_list_sync (source_list, &error))
- g_warning ("Cannot add system source to GConf: %s", error ? error->message : "Unknown error");
-
- if (error)
- g_error_free (error);
- }
- }
-
- return system_source;
-}
-
-gboolean
-e_client_util_set_default (ESourceList *source_list,
- ESource *source)
-{
- const gchar *uid;
- GSList *g;
-
- g_return_val_if_fail (source_list != NULL, FALSE);
- g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), FALSE);
- g_return_val_if_fail (source != NULL, FALSE);
- g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
-
- uid = e_source_peek_uid (source);
-
- /* make sure the source is actually in the ESourceList. If
- * it's not we don't bother adding it, just return an error */
- source = e_source_list_peek_source_by_uid (source_list, uid);
- if (!source)
- return FALSE;
-
- /* loop over all the sources clearing out any "default"
- * properties we find */
- for (g = e_source_list_peek_groups (source_list); g; g = g->next) {
- GSList *s;
- for (s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data));
- s; s = s->next) {
- e_source_set_property (E_SOURCE (s->data), "default", NULL);
- }
- }
-
- /* set the "default" property on the source */
- e_source_set_property (source, "default", "true");
-
- return TRUE;
-}
-
-ESource *
-e_client_util_get_source_for_uri (ESourceList *source_list,
- const gchar *uri)
-{
- ESource *source;
-
- g_return_val_if_fail (source_list != NULL, NULL);
- g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
- g_return_val_if_fail (uri != NULL, NULL);
-
- source = search_known_sources (source_list, check_uri, (gpointer) uri);
- if (!source)
- source = e_source_new_with_absolute_uri ("", uri);
-
- return source;
-}
void
e_client_finish_async_without_dbus (EClient *client,
diff --git a/libedataserver/e-client.h b/libedataserver/e-client.h
index df3338f..10cd967 100644
--- a/libedataserver/e-client.h
+++ b/libedataserver/e-client.h
@@ -26,7 +26,6 @@
#include <libedataserver/e-credentials.h>
#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-list.h>
#define E_TYPE_CLIENT (e_client_get_type ())
#define E_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_CLIENT, EClient))
@@ -212,7 +211,6 @@ struct _EClientClass {
GType e_client_get_type (void);
ESource * e_client_get_source (EClient *client);
-const gchar * e_client_get_uri (EClient *client);
const GSList * e_client_get_capabilities (EClient *client);
gboolean e_client_check_capability (EClient *client, const gchar *capability);
gboolean e_client_check_refresh_supported (EClient *client);
diff --git a/libedataserver/e-credentials.c b/libedataserver/e-credentials.c
index f2cfb62..68d1f01 100644
--- a/libedataserver/e-credentials.c
+++ b/libedataserver/e-credentials.c
@@ -30,8 +30,7 @@
#include "e-credentials.h"
-struct _ECredentialsPrivate
-{
+struct _ECredentials {
GHashTable *keys;
GHashTable *peek_keys;
};
@@ -62,9 +61,8 @@ e_credentials_new (void)
ECredentials *credentials;
credentials = g_new0 (ECredentials, 1);
- credentials->priv = g_new0 (ECredentialsPrivate, 1);
- credentials->priv->keys = g_hash_table_new_full (g_str_hash, key_equal, g_free, (GDestroyNotify) e_credentials_util_safe_free_string);
- credentials->priv->peek_keys = g_hash_table_new_full (g_str_hash, key_equal, g_free, (GDestroyNotify) e_credentials_util_safe_free_string);
+ credentials->keys = g_hash_table_new_full (g_str_hash, key_equal, g_free, (GDestroyNotify) e_credentials_util_safe_free_string);
+ credentials->peek_keys = g_hash_table_new_full (g_str_hash, key_equal, g_free, (GDestroyNotify) e_credentials_util_safe_free_string);
return credentials;
}
@@ -97,7 +95,7 @@ e_credentials_new_strv (const gchar * const *keys)
/* skip empty and invalid values */
if (sep)
- g_hash_table_insert (credentials->priv->keys, g_strndup (key, sep - key), g_strdup (sep + 1));
+ g_hash_table_insert (credentials->keys, g_strndup (key, sep - key), g_strdup (sep + 1));
}
return credentials;
@@ -161,12 +159,11 @@ e_credentials_new_clone (const ECredentials *credentials)
ECredentials *res;
g_return_val_if_fail (credentials != NULL, NULL);
- g_return_val_if_fail (credentials->priv != NULL, NULL);
- g_return_val_if_fail (credentials->priv->keys != NULL, NULL);
+ g_return_val_if_fail (credentials->keys != NULL, NULL);
res = e_credentials_new ();
- g_hash_table_foreach (credentials->priv->keys, copy_keys_cb, res->priv->keys);
+ g_hash_table_foreach (credentials->keys, copy_keys_cb, res->keys);
return res;
}
@@ -184,11 +181,8 @@ e_credentials_free (ECredentials *credentials)
if (!credentials)
return;
- g_return_if_fail (credentials->priv != NULL);
-
- g_hash_table_destroy (credentials->priv->keys);
- g_hash_table_destroy (credentials->priv->peek_keys);
- g_free (credentials->priv);
+ g_hash_table_destroy (credentials->keys);
+ g_hash_table_destroy (credentials->peek_keys);
g_free (credentials);
}
@@ -225,12 +219,11 @@ e_credentials_to_strv (const ECredentials *credentials)
GPtrArray *array;
g_return_val_if_fail (credentials != NULL, NULL);
- g_return_val_if_fail (credentials->priv != NULL, NULL);
- g_return_val_if_fail (credentials->priv->keys != NULL, NULL);
+ g_return_val_if_fail (credentials->keys != NULL, NULL);
- array = g_ptr_array_sized_new (g_hash_table_size (credentials->priv->keys) + 1);
+ array = g_ptr_array_sized_new (g_hash_table_size (credentials->keys) + 1);
- g_hash_table_foreach (credentials->priv->keys, add_to_array_cb, array);
+ g_hash_table_foreach (credentials->keys, add_to_array_cb, array);
/* NULL-terminated */
g_ptr_array_add (array, NULL);
@@ -309,19 +302,18 @@ e_credentials_set (ECredentials *credentials,
const gchar *value)
{
g_return_if_fail (credentials != NULL);
- g_return_if_fail (credentials->priv != NULL);
- g_return_if_fail (credentials->priv->keys != NULL);
- g_return_if_fail (credentials->priv->peek_keys != NULL);
+ g_return_if_fail (credentials->keys != NULL);
+ g_return_if_fail (credentials->peek_keys != NULL);
g_return_if_fail (key != NULL);
g_return_if_fail (*key);
g_return_if_fail (strchr (key, ':') == NULL);
- g_hash_table_remove (credentials->priv->peek_keys, key);
+ g_hash_table_remove (credentials->peek_keys, key);
if (!value) {
- g_hash_table_remove (credentials->priv->keys, key);
+ g_hash_table_remove (credentials->keys, key);
} else {
- g_hash_table_insert (credentials->priv->keys, g_strdup (key), encode_string (value));
+ g_hash_table_insert (credentials->keys, g_strdup (key), encode_string (value));
}
}
@@ -342,12 +334,11 @@ e_credentials_get (const ECredentials *credentials,
* e_credentials_util_safe_free_string() when no longer needed. */
g_return_val_if_fail (credentials != NULL, NULL);
- g_return_val_if_fail (credentials->priv != NULL, NULL);
- g_return_val_if_fail (credentials->priv->keys != NULL, NULL);
+ g_return_val_if_fail (credentials->keys != NULL, NULL);
g_return_val_if_fail (key != NULL, NULL);
g_return_val_if_fail (*key, NULL);
- stored = g_hash_table_lookup (credentials->priv->keys, key);
+ stored = g_hash_table_lookup (credentials->keys, key);
if (!stored)
return NULL;
@@ -374,18 +365,17 @@ e_credentials_peek (ECredentials *credentials,
gchar *value;
g_return_val_if_fail (credentials != NULL, NULL);
- g_return_val_if_fail (credentials->priv != NULL, NULL);
- g_return_val_if_fail (credentials->priv->peek_keys != NULL, NULL);
+ g_return_val_if_fail (credentials->peek_keys != NULL, NULL);
g_return_val_if_fail (key != NULL, NULL);
g_return_val_if_fail (*key, NULL);
- value = g_hash_table_lookup (credentials->priv->peek_keys, key);
+ value = g_hash_table_lookup (credentials->peek_keys, key);
if (value)
return value;
value = e_credentials_get (credentials, key);
if (value)
- g_hash_table_insert (credentials->priv->peek_keys, g_strdup (key), value);
+ g_hash_table_insert (credentials->peek_keys, g_strdup (key), value);
return value;
}
@@ -438,18 +428,16 @@ e_credentials_equal (const ECredentials *credentials1,
if (!credentials1 || !credentials2)
return FALSE;
- g_return_val_if_fail (credentials1->priv != NULL, FALSE);
- g_return_val_if_fail (credentials1->priv->keys != NULL, FALSE);
- g_return_val_if_fail (credentials2->priv != NULL, FALSE);
- g_return_val_if_fail (credentials2->priv->keys != NULL, FALSE);
+ g_return_val_if_fail (credentials1->keys != NULL, FALSE);
+ g_return_val_if_fail (credentials2->keys != NULL, FALSE);
- if (g_hash_table_size (credentials1->priv->keys) != g_hash_table_size (credentials2->priv->keys))
+ if (g_hash_table_size (credentials1->keys) != g_hash_table_size (credentials2->keys))
return FALSE;
ed.equal = TRUE;
- ed.keys = credentials2->priv->keys;
+ ed.keys = credentials2->keys;
- g_hash_table_foreach (credentials1->priv->keys, check_equal_cb, &ed);
+ g_hash_table_foreach (credentials1->keys, check_equal_cb, &ed);
return ed.equal;
}
@@ -476,17 +464,15 @@ e_credentials_equal_keys (const ECredentials *credentials1,
gboolean equal = TRUE;
g_return_val_if_fail (credentials1 != NULL, FALSE);
- g_return_val_if_fail (credentials1->priv != NULL, FALSE);
- g_return_val_if_fail (credentials1->priv->keys != NULL, FALSE);
+ g_return_val_if_fail (credentials1->keys != NULL, FALSE);
g_return_val_if_fail (credentials2 != NULL, FALSE);
- g_return_val_if_fail (credentials2->priv != NULL, FALSE);
- g_return_val_if_fail (credentials2->priv->keys != NULL, FALSE);
+ g_return_val_if_fail (credentials2->keys != NULL, FALSE);
g_return_val_if_fail (key1 != NULL, FALSE);
va_start (va, key1);
while (key1 && equal) {
- equal = g_strcmp0 (g_hash_table_lookup (credentials1->priv->keys, key1), g_hash_table_lookup (credentials2->priv->keys, key1)) == 0;
+ equal = g_strcmp0 (g_hash_table_lookup (credentials1->keys, key1), g_hash_table_lookup (credentials2->keys, key1)) == 0;
key1 = va_arg (va, const gchar *);
}
@@ -512,12 +498,11 @@ e_credentials_has_key (const ECredentials *credentials,
const gchar *key)
{
g_return_val_if_fail (credentials != NULL, FALSE);
- g_return_val_if_fail (credentials->priv != NULL, FALSE);
- g_return_val_if_fail (credentials->priv->keys != NULL, FALSE);
+ g_return_val_if_fail (credentials->keys != NULL, FALSE);
g_return_val_if_fail (key != NULL, FALSE);
g_return_val_if_fail (*key, FALSE);
- return g_hash_table_lookup (credentials->priv->keys, key) != NULL;
+ return g_hash_table_lookup (credentials->keys, key) != NULL;
}
/**
@@ -534,10 +519,9 @@ guint
e_credentials_keys_size (const ECredentials *credentials)
{
g_return_val_if_fail (credentials != NULL, 0);
- g_return_val_if_fail (credentials->priv != NULL, 0);
- g_return_val_if_fail (credentials->priv->keys != NULL, 0);
+ g_return_val_if_fail (credentials->keys != NULL, 0);
- return g_hash_table_size (credentials->priv->keys);
+ return g_hash_table_size (credentials->keys);
}
static void
@@ -571,12 +555,11 @@ e_credentials_list_keys (const ECredentials *credentials)
GSList *keys = NULL;
g_return_val_if_fail (credentials != NULL, NULL);
- g_return_val_if_fail (credentials->priv != NULL, NULL);
- g_return_val_if_fail (credentials->priv->keys != NULL, NULL);
+ g_return_val_if_fail (credentials->keys != NULL, NULL);
/* XXX g_hash_table_get_keys() would have been
* easier had we used #GList instead. */
- g_hash_table_foreach (credentials->priv->keys, gather_key_names, &keys);
+ g_hash_table_foreach (credentials->keys, gather_key_names, &keys);
return g_slist_reverse (keys);
}
@@ -592,12 +575,11 @@ void
e_credentials_clear (ECredentials *credentials)
{
g_return_if_fail (credentials != NULL);
- g_return_if_fail (credentials->priv != NULL);
- g_return_if_fail (credentials->priv->keys != NULL);
- g_return_if_fail (credentials->priv->peek_keys != NULL);
+ g_return_if_fail (credentials->keys != NULL);
+ g_return_if_fail (credentials->peek_keys != NULL);
- g_hash_table_remove_all (credentials->priv->peek_keys);
- g_hash_table_remove_all (credentials->priv->keys);
+ g_hash_table_remove_all (credentials->peek_keys);
+ g_hash_table_remove_all (credentials->keys);
}
/**
@@ -611,10 +593,9 @@ void
e_credentials_clear_peek (ECredentials *credentials)
{
g_return_if_fail (credentials != NULL);
- g_return_if_fail (credentials->priv != NULL);
- g_return_if_fail (credentials->priv->peek_keys != NULL);
+ g_return_if_fail (credentials->peek_keys != NULL);
- g_hash_table_remove_all (credentials->priv->peek_keys);
+ g_hash_table_remove_all (credentials->peek_keys);
}
/**
@@ -636,97 +617,3 @@ e_credentials_util_safe_free_string (gchar *str)
g_free (str);
}
-static struct _PromptFlags {
- ECredentialsPromptFlags flag_uint;
- const gchar *flag_string;
- gboolean is_bit_flag; /* if false, then checked against E_CREDENTIALS_PROMPT_FLAG_REMEMBER_MASK */
-} PromptFlags[] = {
- { E_CREDENTIALS_PROMPT_FLAG_REMEMBER_NEVER, "remember-never", FALSE },
- { E_CREDENTIALS_PROMPT_FLAG_REMEMBER_SESSION, "remember-session", FALSE },
- { E_CREDENTIALS_PROMPT_FLAG_REMEMBER_FOREVER, "remember-forever", FALSE },
-
- { E_CREDENTIALS_PROMPT_FLAG_SECRET, "secret", TRUE },
- { E_CREDENTIALS_PROMPT_FLAG_REPROMPT, "reprompt", TRUE },
- { E_CREDENTIALS_PROMPT_FLAG_ONLINE, "online", TRUE },
- { E_CREDENTIALS_PROMPT_FLAG_DISABLE_REMEMBER, "disable-remember", TRUE },
- { E_CREDENTIALS_PROMPT_FLAG_PASSPHRASE, "passphrase", TRUE }
-};
-
-/**
- * e_credentials_util_prompt_flags_to_string:
- *
- * FIXME: Document me.
- *
- * Since: 3.2
- **/
-gchar *
-e_credentials_util_prompt_flags_to_string (guint prompt_flags)
-{
- gint ii;
- guint masked = prompt_flags & E_CREDENTIALS_PROMPT_FLAG_REMEMBER_MASK;
- GString *str = g_string_new ("");
-
- /* Returned pointer can be passed to
- * e_credentials_util_string_to prompt_flags() to decode
- * it back to flags. Free returned pointer with g_free(). */
-
- for (ii = 0; ii < G_N_ELEMENTS (PromptFlags); ii++) {
- const gchar *add = NULL;
-
- if (PromptFlags[ii].is_bit_flag) {
- if ((prompt_flags & PromptFlags[ii].flag_uint) != 0)
- add = PromptFlags[ii].flag_string;
- } else if (masked == PromptFlags[ii].flag_uint) {
- add = PromptFlags[ii].flag_string;
- }
-
- if (!add)
- continue;
-
- if (str->len)
- g_string_append (str, ",");
-
- g_string_append (str, add);
- }
-
- return g_string_free (str, FALSE);
-}
-
-/**
- * e_credentials_util_string_to_prompt_flags:
- *
- * FIXME: Document me.
- *
- * Since: 3.2
- **/
-guint
-e_credentials_util_string_to_prompt_flags (const gchar *prompt_flags_string)
-{
- gchar **strv;
- gint ii, jj;
- guint flags = 0;
-
- if (!prompt_flags_string || !*prompt_flags_string)
- return flags;
-
- strv = g_strsplit (prompt_flags_string, ",", -1);
- if (!strv)
- return flags;
-
- for (jj = 0; strv[jj]; jj++) {
- const gchar *str = strv[jj];
-
- for (ii = 0; ii < G_N_ELEMENTS (PromptFlags); ii++) {
- if (g_str_equal (PromptFlags[ii].flag_string, str)) {
- if (PromptFlags[ii].is_bit_flag)
- flags |= PromptFlags[ii].flag_uint;
- else
- flags = (flags & (~E_CREDENTIALS_PROMPT_FLAG_REMEMBER_MASK)) | PromptFlags[ii].flag_uint;
- }
- }
- }
-
- g_strfreev (strv);
-
- return flags;
-}
diff --git a/libedataserver/e-credentials.h b/libedataserver/e-credentials.h
index acbc436..77422a2 100644
--- a/libedataserver/e-credentials.h
+++ b/libedataserver/e-credentials.h
@@ -26,9 +26,6 @@
G_BEGIN_DECLS
-typedef struct _ECredentials ECredentials;
-typedef struct _ECredentialsPrivate ECredentialsPrivate;
-
/**
* ECredentials:
*
@@ -37,18 +34,7 @@ typedef struct _ECredentialsPrivate ECredentialsPrivate;
*
* Since: 3.2
**/
-struct _ECredentials {
- ECredentialsPrivate *priv;
-};
-
-/**
- * E_CREDENTIALS_KEY_USERNAME:
- *
- * FIXME Docment me.
- *
- * Since: 3.2
- **/
-#define E_CREDENTIALS_KEY_USERNAME "username"
+typedef struct _ECredentials ECredentials;
/**
* E_CREDENTIALS_KEY_PASSWORD:
@@ -60,24 +46,6 @@ struct _ECredentials {
#define E_CREDENTIALS_KEY_PASSWORD "password"
/**
- * E_CREDENTIALS_KEY_AUTH_METHOD:
- *
- * FIXME Document me.
- *
- * Since: 3.2
- **/
-#define E_CREDENTIALS_KEY_AUTH_METHOD "auth-method"
-
-/**
- * E_CREDENTIALS_KEY_PROMPT_TITLE:
- *
- * FIXME Document me.
- *
- * Since: 3.2
- **/
-#define E_CREDENTIALS_KEY_PROMPT_TITLE "prompt-title"
-
-/**
* E_CREDENTIALS_KEY_PROMPT_TEXT:
*
* FIXME: Document me.
@@ -96,15 +64,6 @@ struct _ECredentials {
#define E_CREDENTIALS_KEY_PROMPT_REASON "prompt-reason"
/**
- * E_CREDENTIALS_KEY_PROMPT_KEY:
- *
- * FIXME: Document me.
- *
- * Since: 3.2
- **/
-#define E_CREDENTIALS_KEY_PROMPT_KEY "prompt-key"
-
-/**
* E_CREDENTIALS_KEY_PROMPT_FLAGS:
*
* FIXME Document me.
@@ -113,27 +72,6 @@ struct _ECredentials {
**/
#define E_CREDENTIALS_KEY_PROMPT_FLAGS "prompt-flags"
-/**
- * ECredentialsPromptFlags:
- *
- * FIXME Document me.
- *
- * Since: 3.2
- **/
-/* this is 1:1 with EPasswordsRememberType */
-typedef enum {
- E_CREDENTIALS_PROMPT_FLAG_REMEMBER_NEVER,
- E_CREDENTIALS_PROMPT_FLAG_REMEMBER_SESSION,
- E_CREDENTIALS_PROMPT_FLAG_REMEMBER_FOREVER,
- E_CREDENTIALS_PROMPT_FLAG_REMEMBER_MASK = 0xf,
-
- E_CREDENTIALS_PROMPT_FLAG_SECRET = 1 << 8, /* whether hide password letters in the UI */
- E_CREDENTIALS_PROMPT_FLAG_REPROMPT = 1 << 9, /* automatically set when username and password is provided */
- E_CREDENTIALS_PROMPT_FLAG_ONLINE = 1 << 10, /* only ask if we're online */
- E_CREDENTIALS_PROMPT_FLAG_DISABLE_REMEMBER = 1 << 11, /* disable the 'remember password' checkbox */
- E_CREDENTIALS_PROMPT_FLAG_PASSPHRASE = 1 << 12 /* We are asking a passphrase */
-} ECredentialsPromptFlags;
-
ECredentials * e_credentials_new (void);
ECredentials * e_credentials_new_strv (const gchar * const *strv);
ECredentials * e_credentials_new_args (const gchar *key, ...) G_GNUC_NULL_TERMINATED;
@@ -152,8 +90,6 @@ void e_credentials_clear ( ECredentials *credentials);
void e_credentials_clear_peek ( ECredentials *credentials);
void e_credentials_util_safe_free_string (gchar *str);
-gchar * e_credentials_util_prompt_flags_to_string (guint prompt_flags); /* bit-or of ECredentialsPromptFlags */
-guint e_credentials_util_string_to_prompt_flags (const gchar *prompt_flags_string); /* bit-or of ECredentialsPromptFlags */
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]