[evolution-activesync] Read Gconf file if exist
- From: dwmw2 <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-activesync] Read Gconf file if exist
- Date: Thu, 11 Jun 2015 16:01:19 +0000 (UTC)
commit 3b2841d549df537d7abef16867375cfd0308bfee
Author: Oliver Luo <lyc pku eecs gmail com>
Date: Sat Jun 6 22:30:49 2015 +0800
Read Gconf file if exist
Read GConf configuration files if a user already have them.
configuration/e-mail-config-eas-backend.c | 34 +++++++++++++++++------------
1 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/configuration/e-mail-config-eas-backend.c b/configuration/e-mail-config-eas-backend.c
index 4ef1609..dc8fa8d 100644
--- a/configuration/e-mail-config-eas-backend.c
+++ b/configuration/e-mail-config-eas-backend.c
@@ -208,7 +208,6 @@ mail_config_eas_backend_setup_defaults (EMailConfigServiceBackend *backend)
CamelSettings *settings;
EMailConfigServicePage *page;
const gchar *email_address;
- gchar **parts = NULL;
gchar *username;
gchar *hosturl;
@@ -228,26 +227,33 @@ mail_config_eas_backend_setup_defaults (EMailConfigServiceBackend *backend)
email_address = e_mail_config_service_page_get_email_address (page);
- if (email_address != NULL)
- parts = g_strsplit (email_address, "@", 2);
-
- if (parts != NULL && g_strv_length (parts) >= 2) {
+ if (email_address != NULL) {
CamelNetworkSettings *network_settings;
gchar *hosturl;
-
- g_strstrip (parts[1]); /* domain name */
-
- hosturl = g_strdup_printf (
- "https://%s/Microsoft-Server-ActiveSync", parts[1]);
+ GConfClient *client = gconf_client_get_default();
+ gchar *key;
+
+ key = g_strdup_printf ("/apps/activesyncd/accounts/%s/username", email_address);
+ username = gconf_client_get_string (client, key, NULL);
+ g_free (key);
+
+ if (username == NULL || *username == '\0') {
+ username = g_strdup (email_address);
+ }
+
+ key = g_strdup_printf ("/apps/activesyncd/accounts/%s/serverUri", email_address);
+ hosturl = gconf_client_get_string (client, key, NULL);
+ g_free (key);
network_settings = CAMEL_NETWORK_SETTINGS (settings);
- camel_network_settings_set_user (network_settings, email_address);
- camel_network_settings_set_host (network_settings, hosturl);
+ camel_network_settings_set_user (network_settings, username);
+ if (hosturl && hosturl[0]) {
+ camel_network_settings_set_host (network_settings, hosturl);
+ }
+ g_free (username);
g_free (hosturl);
}
-
- g_strfreev (parts);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]