[evolution-data-server/account-mgmt: 20/26] Adapt e-passwords.c to utilize the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/account-mgmt: 20/26] Adapt e-passwords.c to utilize the new ESource API.
- Date: Tue, 18 Jan 2011 18:48:28 +0000 (UTC)
commit 9a53e7e31fb3e68a2aeeda0025733ed79f9563e0
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun Dec 5 16:12:22 2010 -0600
Adapt e-passwords.c to utilize the new ESource API.
.../libedataserverui/libedataserverui-sections.txt | 1 -
.../libedataserverui/tmpl/e-passwords.sgml | 22 +-
.../tmpl/libedataserverui-unused.sgml | 7 +
libedataserverui/e-passwords.c | 335 +++++---------------
libedataserverui/e-passwords.h | 40 ++--
5 files changed, 111 insertions(+), 294 deletions(-)
---
diff --git a/docs/reference/libedataserverui/libedataserverui-sections.txt b/docs/reference/libedataserverui/libedataserverui-sections.txt
index 577a2fb..ddddd17 100644
--- a/docs/reference/libedataserverui/libedataserverui-sections.txt
+++ b/docs/reference/libedataserverui/libedataserverui-sections.txt
@@ -245,7 +245,6 @@ e_passwords_add_password
e_passwords_get_password
e_passwords_forget_password
e_passwords_forget_passwords
-e_passwords_clear_passwords
EPasswordsRememberType
e_passwords_ask_password
</SECTION>
diff --git a/docs/reference/libedataserverui/tmpl/e-passwords.sgml b/docs/reference/libedataserverui/tmpl/e-passwords.sgml
index 1e94e02..eb28f76 100644
--- a/docs/reference/libedataserverui/tmpl/e-passwords.sgml
+++ b/docs/reference/libedataserverui/tmpl/e-passwords.sgml
@@ -57,8 +57,7 @@ e-passwords
</para>
- component:
- key:
+ source:
<!-- ##### FUNCTION e_passwords_add_password ##### -->
@@ -66,7 +65,7 @@ e-passwords
</para>
- key:
+ source:
@passwd:
@@ -75,8 +74,7 @@ e-passwords
</para>
- component:
- key:
+ source:
@Returns:
@@ -85,8 +83,7 @@ e-passwords
</para>
- component:
- key:
+ source:
<!-- ##### FUNCTION e_passwords_forget_passwords ##### -->
@@ -97,14 +94,6 @@ e-passwords
@void:
-<!-- ##### FUNCTION e_passwords_clear_passwords ##### -->
-<para>
-
-</para>
-
- component:
-
-
<!-- ##### ENUM EPasswordsRememberType ##### -->
<para>
@@ -125,9 +114,8 @@ e-passwords
</para>
+ source:
@title:
- component_name:
- key:
@prompt:
@remember_type:
@remember:
diff --git a/docs/reference/libedataserverui/tmpl/libedataserverui-unused.sgml b/docs/reference/libedataserverui/tmpl/libedataserverui-unused.sgml
index f6617e0..897f545 100644
--- a/docs/reference/libedataserverui/tmpl/libedataserverui-unused.sgml
+++ b/docs/reference/libedataserverui/tmpl/libedataserverui-unused.sgml
@@ -152,6 +152,13 @@ ESourceOptionMenu
@user_data:
@Returns:
+<!-- ##### FUNCTION e_passwords_clear_passwords ##### -->
+<para>
+
+</para>
+
+ component:
+
<!-- ##### FUNCTION e_source_option_menu_new ##### -->
<para>
diff --git a/libedataserverui/e-passwords.c b/libedataserverui/e-passwords.c
index 1bafc73..4e3b8da 100644
--- a/libedataserverui/e-passwords.c
+++ b/libedataserverui/e-passwords.c
@@ -62,8 +62,7 @@ struct _EPassMsg {
/* input */
GtkWindow *parent;
- const gchar *component;
- const gchar *key;
+ const gchar *uid;
const gchar *title;
const gchar *prompt;
const gchar *oldpass;
@@ -105,96 +104,37 @@ ep_keyring_error_domain (void)
return quark;
}
-static EUri *
-ep_keyring_uri_new (const gchar *string,
- GError **error)
-{
- EUri *uri;
-
- uri = e_uri_new (string);
- g_return_val_if_fail (uri != NULL, NULL);
-
- /* LDAP URIs do not have usernames, so use the URI as the username. */
- if (uri->user == NULL && uri->protocol != NULL &&
- (strcmp (uri->protocol, "ldap") == 0|| strcmp (uri->protocol, "google") == 0))
- uri->user = g_strdelimit (g_strdup (string), "/=", '_');
-
- /* Make sure the URI has the required components. */
- if (uri->user == NULL && uri->host == NULL) {
- g_set_error (
- error, EP_KEYRING_ERROR,
- GNOME_KEYRING_RESULT_BAD_ARGUMENTS,
- _("Keyring key is unusable: no user or host name"));
- e_uri_free (uri);
- uri = NULL;
- }
-
- return uri;
-}
-
static gboolean
-ep_keyring_validate (const gchar *user,
- const gchar *server,
- const gchar *protocol,
+ep_keyring_validate (const gchar *source_uid,
GnomeKeyringAttributeList *attributes)
{
- const gchar *user_value = NULL;
- const gchar *server_value = NULL;
- const gchar *protocol_value = NULL;
+ const gchar *attr_value = NULL;
gint ii;
g_return_val_if_fail (attributes != NULL, FALSE);
/* Is there anything to validate? */
- if (user == NULL && server == NULL && protocol == NULL)
+ if (source_uid == NULL)
return TRUE;
- /* Look for "user", "server", and "protocol" attributes. */
+ /* Look for a "source" attribute. */
for (ii = 0; ii < attributes->len; ii++) {
GnomeKeyringAttribute *attr;
attr = &g_array_index (attributes, GnomeKeyringAttribute, ii);
/* Just assume the attribute values are strings. */
- if (strcmp (attr->name, "user") == 0)
- user_value = attr->value.string;
- else if (strcmp (attr->name, "server") == 0)
- server_value = attr->value.string;
- else if (strcmp (attr->name, "protocol") == 0)
- protocol_value = attr->value.string;
+ if (strcmp (attr->name, "source") == 0) {
+ attr_value = attr->value.string;
+ break;
+ }
}
- /* Is there a "user" attribute? */
- if (user != NULL && user_value == NULL)
- return FALSE;
-
- /* Does it match what we're looking for? */
- if (user != NULL && strcmp (user, user_value) != 0)
- return FALSE;
-
- /* Is there a "server" attribute? */
- if (server != NULL && server_value == NULL)
- return FALSE;
-
- /* Does it match what we're looking for? */
- if (server != NULL && strcmp (server, server_value) != 0)
- return FALSE;
-
- /* Is there a "protocol" attribute? */
- if (protocol != NULL && protocol_value == NULL)
- return FALSE;
-
- /* Does it match what we're looking for? */
- if (protocol != NULL && strcmp (protocol, protocol_value) != 0)
- return FALSE;
-
- return TRUE;
+ return (g_strcmp0 (source_uid, attr_value) == 0);
}
static gboolean
-ep_keyring_delete_passwords (const gchar *user,
- const gchar *server,
- const gchar *protocol,
+ep_keyring_delete_passwords (const gchar *source_uid,
GList *passwords,
GError **error)
{
@@ -203,14 +143,9 @@ ep_keyring_delete_passwords (const gchar *user,
GnomeKeyringResult result;
/* Validate the item before deleting it. */
- if (!ep_keyring_validate (user, server, protocol, found->attributes)) {
- /* XXX We didn't always store protocols in the
- * keyring, so for backward-compatibility
- * try validating by user and server only. */
- if (!ep_keyring_validate (user, server, NULL, found->attributes)) {
- passwords = g_list_next (passwords);
- continue;
- }
+ if (!ep_keyring_validate (source_uid, found->attributes)) {
+ passwords = g_list_next (passwords);
+ continue;
}
result = gnome_keyring_item_delete_sync (NULL, found->item_id);
@@ -230,32 +165,23 @@ ep_keyring_delete_passwords (const gchar *user,
}
static gboolean
-ep_keyring_insert_password (const gchar *user,
- const gchar *server,
- const gchar *protocol,
- const gchar *display_name,
+ep_keyring_insert_password (const gchar *source_uid,
const gchar *password,
GError **error)
{
GnomeKeyringAttributeList *attributes;
GnomeKeyringResult result;
+ gchar *display_name;
guint32 item_id;
- g_return_val_if_fail (user != NULL, FALSE);
- g_return_val_if_fail (server != NULL, FALSE);
- g_return_val_if_fail (protocol != NULL, FALSE);
- g_return_val_if_fail (display_name != NULL, FALSE);
- g_return_val_if_fail (password != NULL, FALSE);
-
attributes = gnome_keyring_attribute_list_new ();
gnome_keyring_attribute_list_append_string (
attributes, "application", "Evolution");
gnome_keyring_attribute_list_append_string (
- attributes, "user", user);
- gnome_keyring_attribute_list_append_string (
- attributes, "server", server);
- gnome_keyring_attribute_list_append_string (
- attributes, "protocol", protocol);
+ attributes, "source", source_uid);
+
+ display_name = g_strdup_printf (
+ "Evolution Data Source \"%s\"", source_uid);
/* XXX We don't use item_id but gnome-keyring doesn't allow
* for a NULL pointer. In fact it doesn't even check! */
@@ -270,15 +196,15 @@ ep_keyring_insert_password (const gchar *user,
gnome_keyring_result_to_message (result));
}
+ g_free (display_name);
+
gnome_keyring_attribute_list_free (attributes);
return (result == GNOME_KEYRING_RESULT_OK);
}
static GList *
-ep_keyring_lookup_passwords (const gchar *user,
- const gchar *server,
- const gchar *protocol,
+ep_keyring_lookup_passwords (const gchar *source_uid,
GError **error)
{
GnomeKeyringAttributeList *attributes;
@@ -288,15 +214,9 @@ ep_keyring_lookup_passwords (const gchar *user,
attributes = gnome_keyring_attribute_list_new ();
gnome_keyring_attribute_list_append_string (
attributes, "application", "Evolution");
- if (user != NULL)
- gnome_keyring_attribute_list_append_string (
- attributes, "user", user);
- if (server != NULL)
- gnome_keyring_attribute_list_append_string (
- attributes, "server", server);
- if (protocol != NULL)
+ if (source_uid != NULL)
gnome_keyring_attribute_list_append_string (
- attributes, "protocol", protocol);
+ attributes, "source", source_uid);
result = gnome_keyring_find_items_sync (
GNOME_KEYRING_ITEM_NETWORK_PASSWORD, attributes, &passwords);
@@ -392,32 +312,6 @@ ep_msg_send (EPassMsg *msg)
/* the functions that actually do the work */
static void
-ep_clear_passwords (EPassMsg *msg)
-{
- GList *passwords;
- GError *error = NULL;
-
- /* Find all Evolution passwords and delete them. */
- passwords = ep_keyring_lookup_passwords (NULL, NULL, NULL, &error);
- if (passwords != NULL) {
- ep_keyring_delete_passwords (NULL, NULL, NULL, passwords, &error);
- gnome_keyring_found_list_free (passwords);
- }
-
- /* Not finding the requested key is acceptable, but we still
- * want to leave an informational message on the terminal. */
- if (g_error_matches (error, EP_KEYRING_ERROR, GNOME_KEYRING_RESULT_NO_MATCH)) {
- g_message ("%s", error->message);
- g_error_free (error);
-
- } else if (error != NULL)
- g_propagate_error (&msg->error, error);
-
- if (!msg->noreply)
- e_flag_set (msg->done);
-}
-
-static void
ep_forget_passwords (EPassMsg *msg)
{
GList *passwords;
@@ -426,9 +320,9 @@ ep_forget_passwords (EPassMsg *msg)
g_hash_table_remove_all (password_cache);
/* Find all Evolution passwords and delete them. */
- passwords = ep_keyring_lookup_passwords (NULL, NULL, NULL, &error);
+ passwords = ep_keyring_lookup_passwords (NULL, &error);
if (passwords != NULL) {
- ep_keyring_delete_passwords (NULL, NULL, NULL, passwords, &error);
+ ep_keyring_delete_passwords (NULL, passwords, &error);
gnome_keyring_found_list_free (passwords);
}
@@ -443,29 +337,22 @@ static void
ep_remember_password (EPassMsg *msg)
{
gchar *password;
- EUri *uri;
GError *error = NULL;
- password = g_hash_table_lookup (password_cache, msg->key);
+ password = g_hash_table_lookup (password_cache, msg->uid);
if (password == NULL) {
- g_warning ("Password for key \"%s\" not found", msg->key);
+ g_warning ("Password for key \"%s\" not found", msg->uid);
goto exit;
}
- uri = ep_keyring_uri_new (msg->key, &msg->error);
- if (uri == NULL)
- goto exit;
-
/* Only remove the password from the session hash
* if the keyring insertion was successful. */
- if (ep_keyring_insert_password (uri->user, uri->host, uri->protocol, msg->key, password, &error))
- g_hash_table_remove (password_cache, msg->key);
+ if (ep_keyring_insert_password (msg->uid, password, &error))
+ g_hash_table_remove (password_cache, msg->uid);
if (error != NULL)
g_propagate_error (&msg->error, error);
- e_uri_free (uri);
-
exit:
if (!msg->noreply)
e_flag_set (msg->done);
@@ -475,35 +362,20 @@ static void
ep_forget_password (EPassMsg *msg)
{
GList *passwords;
- EUri *uri;
GError *error = NULL;
- g_hash_table_remove (password_cache, msg->key);
+ g_hash_table_remove (password_cache, msg->uid);
- uri = ep_keyring_uri_new (msg->key, &msg->error);
- if (uri == NULL)
- goto exit;
-
- /* Find all Evolution passwords matching the URI and delete them.
- *
- * XXX We didn't always store protocols in the keyring, so for
- * backward-compatibility we need to lookup passwords by user
- * and host only (no protocol). But we do send the protocol
- * to ep_keyring_delete_passwords(), which also knows about
- * the backward-compatibility issue and will filter the list
- * appropriately. */
- passwords = ep_keyring_lookup_passwords (uri->user, uri->host, NULL, &error);
+ /* Find all Evolution passwords matching the UID and delete them. */
+ passwords = ep_keyring_lookup_passwords (msg->uid, &error);
if (passwords != NULL) {
- ep_keyring_delete_passwords (uri->user, uri->host, uri->protocol, passwords, &error);
+ ep_keyring_delete_passwords (msg->uid, passwords, &error);
gnome_keyring_found_list_free (passwords);
}
if (error != NULL)
g_propagate_error (&msg->error, error);
- e_uri_free (uri);
-
-exit:
if (!msg->noreply)
e_flag_set (msg->done);
}
@@ -511,24 +383,19 @@ exit:
static void
ep_get_password (EPassMsg *msg)
{
- EUri *uri;
GList *passwords;
gchar *password;
GError *error = NULL;
/* Check the in-memory cache first. */
- password = g_hash_table_lookup (password_cache, msg->key);
+ password = g_hash_table_lookup (password_cache, msg->uid);
if (password != NULL) {
msg->password = g_strdup (password);
goto exit;
}
- uri = ep_keyring_uri_new (msg->key, &msg->error);
- if (uri == NULL)
- goto exit;
-
- /* Find the first Evolution password that matches the URI. */
- passwords = ep_keyring_lookup_passwords (uri->user, uri->host, uri->protocol, &error);
+ /* Find the first Evolution password that matches the UID. */
+ passwords = ep_keyring_lookup_passwords (msg->uid, &error);
if (passwords != NULL) {
GList *iter = passwords;
@@ -541,7 +408,7 @@ ep_get_password (EPassMsg *msg)
continue;
}
- if (ep_keyring_validate (uri->user, uri->host, uri->protocol, found->attributes)) {
+ if (ep_keyring_validate (msg->uid, found->attributes)) {
msg->password = g_strdup (found->secret);
break;
}
@@ -560,32 +427,6 @@ ep_get_password (EPassMsg *msg)
if (error != NULL)
g_clear_error (&error);
- /* XXX We didn't always store protocols in the keyring, so for
- * backward-compatibility we also need to lookup passwords
- * by user and host only (no protocol). */
- passwords = ep_keyring_lookup_passwords (uri->user, uri->host, NULL, &error);
- if (passwords != NULL) {
- GList *iter = passwords;
-
- while (iter != NULL) {
- GnomeKeyringFound *found = iter->data;
-
- if (default_keyring && strcmp (default_keyring, found->keyring) != 0) {
- g_message ("Received a password from keyring '%s'. But looking for the password from '%s' keyring\n", found->keyring, default_keyring);
- iter = g_list_next (iter);
- continue;
- }
- if (ep_keyring_validate (uri->user, uri->host, NULL, found->attributes)) {
- msg->password = g_strdup (found->secret);
- break;
- }
-
- iter = g_list_next (iter);
- }
-
- gnome_keyring_found_list_free (passwords);
- }
-
done:
/* Not finding the requested key is acceptable, but we still
* want to leave an informational message on the terminal. */
@@ -596,8 +437,6 @@ done:
} else if (error != NULL)
g_propagate_error (&msg->error, error);
- e_uri_free (uri);
-
exit:
if (!msg->noreply)
e_flag_set (msg->done);
@@ -607,7 +446,7 @@ static void
ep_add_password (EPassMsg *msg)
{
g_hash_table_insert (
- password_cache, g_strdup (msg->key),
+ password_cache, g_strdup (msg->uid),
g_strdup (msg->oldpass));
if (!msg->noreply)
@@ -658,8 +497,7 @@ pass_response (GtkDialog *dialog, gint response, gpointer data)
if ((pending->dispatch == ep_forget_password
|| pending->dispatch == ep_get_password
|| pending->dispatch == ep_ask_password)
- && (strcmp (pending->component, msg->component) == 0
- && strcmp (pending->key, msg->key) == 0)) {
+ && strcmp (pending->uid, msg->uid) == 0) {
/* Satisfy the pending operation. */
pending->password = g_strdup (msg->password);
@@ -963,37 +801,20 @@ e_passwords_forget_passwords (void)
}
/**
- * e_passwords_clear_passwords:
- *
- * Forgets all disk cached passwords for the component.
- **/
-void
-e_passwords_clear_passwords (const gchar *component_name)
-{
- EPassMsg *msg = ep_msg_new (ep_clear_passwords);
-
- msg->component = component_name;
- ep_msg_send (msg);
- ep_msg_free (msg);
-}
-
-/**
* e_passwords_remember_password:
- * @key: the key
+ * @source: an #ESource
*
- * Saves the password associated with @key to disk.
+ * Saves the password associated with @source to the default keyring.
**/
void
-e_passwords_remember_password (const gchar *component_name, const gchar *key)
+e_passwords_remember_password (ESource *source)
{
EPassMsg *msg;
- g_return_if_fail (component_name != NULL);
- g_return_if_fail (key != NULL);
+ g_return_if_fail (E_IS_SOURCE (source));
msg = ep_msg_new (ep_remember_password);
- msg->component = component_name;
- msg->key = key;
+ msg->uid = g_strdup (e_source_get_uid (source));
ep_msg_send (msg);
ep_msg_free (msg);
@@ -1001,21 +822,20 @@ e_passwords_remember_password (const gchar *component_name, const gchar *key)
/**
* e_passwords_forget_password:
- * @key: the key
+ * @source: an #ESource
*
- * Forgets the password associated with @key, in memory and on disk.
+ * Forgets the password associated with @source, in memory and on the
+ * default keyring.
**/
void
-e_passwords_forget_password (const gchar *component_name, const gchar *key)
+e_passwords_forget_password (ESource *source)
{
EPassMsg *msg;
- g_return_if_fail (component_name != NULL);
- g_return_if_fail (key != NULL);
+ g_return_if_fail (E_IS_SOURCE (source));
msg = ep_msg_new (ep_forget_password);
- msg->component = component_name;
- msg->key = key;
+ msg->uid = g_strdup (e_source_get_uid (source));
ep_msg_send (msg);
ep_msg_free (msg);
@@ -1023,23 +843,21 @@ e_passwords_forget_password (const gchar *component_name, const gchar *key)
/**
* e_passwords_get_password:
- * @key: the key
+ * @source: an #ESource
*
- * Returns: the password associated with @key, or %NULL. Caller
+ * Returns: the password associated with @source, or %NULL. Caller
* must free the returned password.
**/
gchar *
-e_passwords_get_password (const gchar *component_name, const gchar *key)
+e_passwords_get_password (ESource *source)
{
EPassMsg *msg;
gchar *passwd;
- g_return_val_if_fail (component_name != NULL, NULL);
- g_return_val_if_fail (key != NULL, NULL);
+ g_return_val_if_fail (E_IS_SOURCE (source), NULL);
msg = ep_msg_new (ep_get_password);
- msg->component = component_name;
- msg->key = key;
+ msg->uid = g_strdup (e_source_get_uid (source));
ep_msg_send (msg);
@@ -1052,22 +870,22 @@ e_passwords_get_password (const gchar *component_name, const gchar *key)
/**
* e_passwords_add_password:
- * @key: a key
- * @passwd: the password for @key
+ * @source: an #ESource
+ * @passwd: the password for @source
*
- * This stores the @key/@passwd pair in the current session's password
- * hash.
+ * This stores @passwd in the current session's password hash.
**/
void
-e_passwords_add_password (const gchar *key, const gchar *passwd)
+e_passwords_add_password (ESource *source,
+ const gchar *passwd)
{
EPassMsg *msg;
- g_return_if_fail (key != NULL);
+ g_return_if_fail (E_IS_SOURCE (source));
g_return_if_fail (passwd != NULL);
msg = ep_msg_new (ep_add_password);
- msg->key = key;
+ msg->uid = g_strdup (e_source_get_uid (source));
msg->oldpass = passwd;
ep_msg_send (msg);
@@ -1076,10 +894,8 @@ e_passwords_add_password (const gchar *key, const gchar *passwd)
/**
* e_passwords_ask_password:
+ * @source: an #ESource, or %NULL
* @title: title for the password dialog
- * @component_name: the name of the component for which we're storing
- * the password (e.g. Mail, Addressbook, etc.)
- * @key: key to store the password under
* @prompt: prompt string
* @type: whether or not to offer to remember the password,
* and for how long.
@@ -1087,7 +903,12 @@ e_passwords_add_password (const gchar *key, const gchar *passwd)
* on output, the state of the checkbox when the dialog was closed.
* @parent: parent window of the dialog, or %NULL
*
- * Asks the user for a password.
+ * Asks the user for a password. If @source is %NULL, there will be
+ * no option to remember the password.
+ *
+ * Passing a %NULL #ESource is a temporary hack to accomodate prompting
+ * for certificate passwords, which have no corresponding #ESource. We
+ * will eventually use libgcr for this.
*
* Returns: the password, which the caller must free, or %NULL if
* the user cancelled the operation. * remember will be set if the
@@ -1095,8 +916,8 @@ e_passwords_add_password (const gchar *key, const gchar *passwd)
* E_PASSWORDS_DO_NOT_REMEMBER.
**/
gchar *
-e_passwords_ask_password (const gchar *title, const gchar *component_name,
- const gchar *key,
+e_passwords_ask_password (ESource *source,
+ const gchar *title,
const gchar *prompt,
EPasswordsRememberType type,
gboolean *remember,
@@ -1105,21 +926,23 @@ e_passwords_ask_password (const gchar *title, const gchar *component_name,
gchar *passwd;
EPassMsg *msg;
- g_return_val_if_fail (component_name != NULL, NULL);
- g_return_val_if_fail (key != NULL, NULL);
+ g_return_val_if_fail (source == NULL || E_IS_SOURCE (source), NULL);
if ((type & E_PASSWORDS_ONLINE) && !ep_online_state)
return NULL;
msg = ep_msg_new (ep_ask_password);
msg->title = title;
- msg->component = component_name;
- msg->key = key;
msg->prompt = prompt;
msg->flags = type;
msg->remember = remember;
msg->parent = parent;
+ if (source != NULL)
+ msg->uid = g_strdup (e_source_get_uid (source));
+ else
+ msg->flags |= E_PASSWORDS_REMEMBER_NEVER;
+
ep_msg_send (msg);
passwd = msg->password;
msg->password = NULL;
diff --git a/libedataserverui/e-passwords.h b/libedataserverui/e-passwords.h
index 9f29e72..a356388 100644
--- a/libedataserverui/e-passwords.h
+++ b/libedataserverui/e-passwords.h
@@ -20,11 +20,11 @@
* USA.
*/
-#ifndef _E_PASSWORD_H_
-#define _E_PASSWORD_H_
+#ifndef E_PASSWORDS_H
+#define E_PASSWORDS_H
-#include <glib.h>
#include <gtk/gtk.h>
+#include <libedataserver/e-source.h>
G_BEGIN_DECLS
@@ -35,17 +35,17 @@ G_BEGIN_DECLS
e_passwords_shutdown should be called at exit time to synch the
password on-disk storage, and to free up in-memory storage. */
-void e_passwords_init (void);
+void e_passwords_init (void);
-void e_passwords_shutdown (void);
-void e_passwords_cancel (void);
-void e_passwords_set_online (gint state);
-void e_passwords_remember_password (const gchar *component, const gchar *key);
-void e_passwords_add_password (const gchar *key, const gchar *passwd);
-gchar *e_passwords_get_password (const gchar *component, const gchar *key);
-void e_passwords_forget_password (const gchar *component, const gchar *key);
-void e_passwords_forget_passwords (void);
-void e_passwords_clear_passwords (const gchar *component);
+void e_passwords_shutdown (void);
+void e_passwords_cancel (void);
+void e_passwords_set_online (gint state);
+void e_passwords_remember_password (ESource *source);
+void e_passwords_add_password (ESource *source,
+ const gchar *passwd);
+gchar * e_passwords_get_password (ESource *source);
+void e_passwords_forget_password (ESource *source);
+void e_passwords_forget_passwords (void);
typedef enum {
E_PASSWORDS_REMEMBER_NEVER,
@@ -61,13 +61,13 @@ typedef enum {
E_PASSWORDS_PASSPHRASE = 1<<12 /* We are asking a passphrase */
} EPasswordsRememberType;
-gchar * e_passwords_ask_password (const gchar *title,
- const gchar *component_name, const gchar *key,
- const gchar *prompt,
- EPasswordsRememberType remember_type,
- gboolean *remember,
- GtkWindow *parent);
+gchar * e_passwords_ask_password (ESource *source,
+ const gchar *title,
+ const gchar *prompt,
+ EPasswordsRememberType remember_type,
+ gboolean *remember,
+ GtkWindow *parent);
G_END_DECLS
-#endif /* _E_PASSWORD_H_ */
+#endif /* E_PASSWORDS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]