[evolution-data-server/gnome-3-8] ESource: Move "remember-password" to Authentication extension.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-8] ESource: Move "remember-password" to Authentication extension.
- Date: Wed, 17 Apr 2013 10:57:43 +0000 (UTC)
commit 5fcc12af16998dbc7f9a889f9bbe03bdd8e28b66
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Apr 17 06:48:06 2013 -0400
ESource: Move "remember-password" to Authentication extension.
It's a more suitable place since the option is only relevant to
EAuthenticationSession.
(cherry picked from commit 0342aecbfda8bea93726c63873dd61011deaab50)
.../libedataserver/libedataserver-sections.txt | 2 +
libebackend/e-authentication-session.c | 21 +++++-
libedataserver/e-source-authentication.c | 74 ++++++++++++++++++++++
libedataserver/e-source-authentication.h | 5 ++
libedataserver/e-source.c | 70 --------------------
libedataserver/e-source.h | 3 -
6 files changed, 100 insertions(+), 75 deletions(-)
---
diff --git a/docs/reference/libedataserver/libedataserver-sections.txt
b/docs/reference/libedataserver/libedataserver-sections.txt
index 821ebcd..fb3d60d 100644
--- a/docs/reference/libedataserver/libedataserver-sections.txt
+++ b/docs/reference/libedataserver/libedataserver-sections.txt
@@ -368,6 +368,8 @@ e_source_authentication_dup_method
e_source_authentication_set_method
e_source_authentication_get_port
e_source_authentication_set_port
+e_source_authentication_get_remember_password
+e_source_authentication_set_remember_password
e_source_authentication_get_user
e_source_authentication_dup_user
e_source_authentication_set_user
diff --git a/libebackend/e-authentication-session.c b/libebackend/e-authentication-session.c
index 23a125e..bd4eb66 100644
--- a/libebackend/e-authentication-session.c
+++ b/libebackend/e-authentication-session.c
@@ -489,10 +489,19 @@ authentication_session_execute_sync (EAuthenticationSession *session,
* has not yet been submitted to the D-Bus registry service. */
source = e_source_registry_server_ref_source (server, source_uid);
if (source != NULL) {
+ ESourceExtension *extension;
+ const gchar *extension_name;
+
allow_auth_prompt =
e_server_side_source_get_allow_auth_prompt (
E_SERVER_SIDE_SOURCE (source));
- remember_password = e_source_get_remember_password (source);
+
+ extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
+ extension = e_source_get_extension (source, extension_name);
+ remember_password =
+ e_source_authentication_get_remember_password (
+ E_SOURCE_AUTHENTICATION (extension));
+
g_object_unref (source);
} else {
allow_auth_prompt = TRUE;
@@ -557,8 +566,16 @@ try_again:
source = e_source_registry_server_ref_source (server, source_uid);
if (source != NULL) {
- e_source_set_remember_password (source,
+ ESourceExtension *extension;
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
+ extension = e_source_get_extension (source, extension_name);
+
+ e_source_authentication_set_remember_password (
+ E_SOURCE_AUTHENTICATION (extension),
gcr_prompt_get_choice_chosen (prompt));
+
g_object_unref (source);
}
diff --git a/libedataserver/e-source-authentication.c b/libedataserver/e-source-authentication.c
index 131475c..161c1d0 100644
--- a/libedataserver/e-source-authentication.c
+++ b/libedataserver/e-source-authentication.c
@@ -48,6 +48,7 @@ struct _ESourceAuthenticationPrivate {
gchar *host;
gchar *method;
guint16 port;
+ gboolean remember_password;
gchar *user;
/* GNetworkAddress caches data internally, so we maintain the
@@ -62,6 +63,7 @@ enum {
PROP_HOST,
PROP_METHOD,
PROP_PORT,
+ PROP_REMEMBER_PASSWORD,
PROP_USER
};
@@ -115,6 +117,12 @@ source_authentication_set_property (GObject *object,
g_value_get_uint (value));
return;
+ case PROP_REMEMBER_PASSWORD:
+ e_source_authentication_set_remember_password (
+ E_SOURCE_AUTHENTICATION (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_USER:
e_source_authentication_set_user (
E_SOURCE_AUTHENTICATION (object),
@@ -160,6 +168,13 @@ source_authentication_get_property (GObject *object,
E_SOURCE_AUTHENTICATION (object)));
return;
+ case PROP_REMEMBER_PASSWORD:
+ g_value_set_boolean (
+ value,
+ e_source_authentication_get_remember_password (
+ E_SOURCE_AUTHENTICATION (object)));
+ return;
+
case PROP_USER:
g_value_take_string (
value,
@@ -271,6 +286,20 @@ e_source_authentication_class_init (ESourceAuthenticationClass *class)
g_object_class_install_property (
object_class,
+ PROP_REMEMBER_PASSWORD,
+ g_param_spec_boolean (
+ "remember-password",
+ "Remember Password",
+ "Whether to offer to remember the "
+ "password by default when prompted",
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS |
+ E_SOURCE_PARAM_SETTING));
+
+ g_object_class_install_property (
+ object_class,
PROP_USER,
g_param_spec_string (
"user",
@@ -579,6 +608,51 @@ e_source_authentication_set_port (ESourceAuthentication *extension,
}
/**
+ * e_source_authentication_get_remember_password:
+ * @extension: an #ESourceAuthentication
+ *
+ * Returns whether to offer to remember the provided password by default
+ * in password prompts. This way, if the user unchecks the option it will
+ * be unchecked by default in future password prompts.
+ *
+ * Returns: whether to offer to remember the password by default
+ *
+ * Since: 3.10
+ **/
+gboolean
+e_source_authentication_get_remember_password (ESourceAuthentication *extension)
+{
+ g_return_val_if_fail (E_IS_SOURCE_AUTHENTICATION (extension), FALSE);
+
+ return extension->priv->remember_password;
+}
+
+/**
+ * e_source_authentication_set_remember_password:
+ * @extension: an #ESourceAuthentication
+ * @remember_password: whether to offer to remember the password by default
+ *
+ * Sets whether to offer to remember the provided password by default in
+ * password prompts. This way, if the user unchecks the option it will be
+ * unchecked by default in future password prompts.
+ *
+ * Since: 3.10
+ **/
+void
+e_source_authentication_set_remember_password (ESourceAuthentication *extension,
+ gboolean remember_password)
+{
+ g_return_if_fail (E_IS_SOURCE_AUTHENTICATION (extension));
+
+ if (extension->priv->remember_password == remember_password)
+ return;
+
+ extension->priv->remember_password = remember_password;
+
+ g_object_notify (G_OBJECT (extension), "remember-password");
+}
+
+/**
* e_source_authentication_get_user:
* @extension: an #ESourceAuthentication
*
diff --git a/libedataserver/e-source-authentication.h b/libedataserver/e-source-authentication.h
index 6a9a193..85e61d4 100644
--- a/libedataserver/e-source-authentication.h
+++ b/libedataserver/e-source-authentication.h
@@ -103,6 +103,11 @@ guint16 e_source_authentication_get_port
void e_source_authentication_set_port
(ESourceAuthentication *extension,
guint16 port);
+gboolean e_source_authentication_get_remember_password
+ (ESourceAuthentication *extension);
+void e_source_authentication_set_remember_password
+ (ESourceAuthentication *extension,
+ gboolean remember_password);
const gchar * e_source_authentication_get_user
(ESourceAuthentication *extension);
gchar * e_source_authentication_dup_user
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index cb50cb9..251c3a1 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -130,7 +130,6 @@ struct _ESourcePrivate {
gboolean enabled;
gboolean initialized;
- gboolean remember_password;
};
struct _AsyncContext {
@@ -146,7 +145,6 @@ enum {
PROP_ENABLED,
PROP_MAIN_CONTEXT,
PROP_PARENT,
- PROP_REMEMBER_PASSWORD,
PROP_REMOTE_CREATABLE,
PROP_REMOTE_DELETABLE,
PROP_REMOVABLE,
@@ -765,12 +763,6 @@ source_set_property (GObject *object,
g_value_get_string (value));
return;
- case PROP_REMEMBER_PASSWORD:
- e_source_set_remember_password (
- E_SOURCE (object),
- g_value_get_boolean (value));
- return;
-
case PROP_UID:
source_set_uid (
E_SOURCE (object),
@@ -818,12 +810,6 @@ source_get_property (GObject *object,
E_SOURCE (object)));
return;
- case PROP_REMEMBER_PASSWORD:
- g_value_set_boolean (
- value, e_source_get_remember_password (
- E_SOURCE (object)));
- return;
-
case PROP_REMOTE_CREATABLE:
g_value_set_boolean (
value, e_source_get_remote_creatable (
@@ -1611,19 +1597,6 @@ e_source_class_init (ESourceClass *class)
g_object_class_install_property (
object_class,
- PROP_REMEMBER_PASSWORD,
- g_param_spec_boolean (
- "remember-password",
- "Remember Password",
- "Whether to remember password - used in a password prompt",
- TRUE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS |
- E_SOURCE_PARAM_SETTING));
-
- g_object_class_install_property (
- object_class,
PROP_REMOTE_CREATABLE,
g_param_spec_boolean (
"remote-creatable",
@@ -2103,49 +2076,6 @@ e_source_set_enabled (ESource *source,
}
/**
- * e_source_get_remember_password:
- * @source: an #ESource
- *
- * Returns whether @source should remember password. This influences
- * "Add this password to your keyring" option in a password prompt.
- *
- * Returns: whether @source should remember password
- *
- * Since: 3.8.2
- **/
-gboolean
-e_source_get_remember_password (ESource *source)
-{
- g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
-
- return source->priv->remember_password;
-}
-
-/**
- * e_source_set_remember_password:
- * @source: an #ESource
- * @remember_password: whether to remember password
- *
- * The password prompt will have checked "Add this password to your keyring" option
- * based on this value.
- *
- * Since: 3.8.2
- **/
-void
-e_source_set_remember_password (ESource *source,
- gboolean remember_password)
-{
- g_return_if_fail (E_IS_SOURCE (source));
-
- if ((source->priv->remember_password ? 1 : 0) == (remember_password ? 1 : 0))
- return;
-
- source->priv->remember_password = remember_password;
-
- g_object_notify (G_OBJECT (source), "remember-password");
-}
-
-/**
* e_source_get_writable:
* @source: an #ESource
*
diff --git a/libedataserver/e-source.h b/libedataserver/e-source.h
index c8b2e58..a473e99 100644
--- a/libedataserver/e-source.h
+++ b/libedataserver/e-source.h
@@ -165,9 +165,6 @@ void e_source_set_parent (ESource *source,
gboolean e_source_get_enabled (ESource *source);
void e_source_set_enabled (ESource *source,
gboolean enabled);
-gboolean e_source_get_remember_password (ESource *source);
-void e_source_set_remember_password (ESource *source,
- gboolean remember_password);
gboolean e_source_get_writable (ESource *source);
gboolean e_source_get_removable (ESource *source);
gboolean e_source_get_remote_creatable (ESource *source);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]