X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-account-mgr.c;h=a129e51aaf7db4d805795f3ad87ebdac27781a25;hb=62f7397e7b5b8b70f67b67800527916aa4016f4b;hp=ea8afe4cf0f5c62e4f8f194c6bce22686c5aa03c;hpb=47b9de7a73030206f0f366ec60164e8f1e549916;p=modest diff --git a/src/modest-account-mgr.c b/src/modest-account-mgr.c index ea8afe4..a129e51 100644 --- a/src/modest-account-mgr.c +++ b/src/modest-account-mgr.c @@ -288,6 +288,14 @@ modest_account_mgr_add_account (ModestAccountMgr *self, return FALSE; } } + + /* Make sure that leave-messages-on-server is enabled by default, + * as per the UI spec, though it is only meaningful for accounts using POP. + * (possibly this gconf key should be under the server account): */ + modest_account_mgr_set_bool (self, name, + MODEST_ACCOUNT_LEAVE_ON_SERVER, TRUE, FALSE /* not server account */); + + modest_account_mgr_set_enabled (self, name, enabled); /* if no default account has been defined yet, do so now */ @@ -409,10 +417,8 @@ modest_account_mgr_add_server_account (ModestAccountMgr * self, if (!ok) goto cleanup; - if (modest_protocol_info_protocol_is_store(proto)) { - /* Add the security settings: */ - modest_server_account_set_security (self, name, security); - } + /* Add the security settings: */ + modest_server_account_set_security (self, name, security); cleanup: if (!ok) { @@ -629,27 +635,40 @@ modest_account_mgr_account_names (ModestAccountMgr * self, gboolean only_enabled GSList *result = NULL; - /* Filter-out the disabled accounts if requested: */ - if (only_enabled) { - GSList *iter = accounts; - while (iter) { - if (!(iter->data)) - continue; - - const gchar* account_name = (const gchar*)iter->data; - if (account_name && modest_account_mgr_get_enabled (self, account_name)) - result = g_slist_append (result, g_strdup (account_name)); - - iter = g_slist_next (iter); + /* Unescape the keys to get the account names: */ + GSList *iter = accounts; + while (iter) { + if (!(iter->data)) + continue; + + const gchar* account_name_key = (const gchar*)iter->data; + /* printf ("DEBUG: %s: account_name_key=%s\n", __FUNCTION__, account_name_key); */ + gchar* unescaped_name = account_name_key ? + modest_conf_key_unescape (account_name_key) + : NULL; + /* printf (" DEBUG: %s: unescaped name=%s\n", __FUNCTION__, unescaped_name); */ + + gboolean add = TRUE; + if (only_enabled) { + if (unescaped_name && + !modest_account_mgr_get_enabled (self, unescaped_name)) { + add = FALSE; + } } - /* TODO: Free the strings too? */ - g_slist_free (accounts); - accounts = NULL; + if (add) { + result = g_slist_append (result, unescaped_name); + } + else { + g_free (unescaped_name); + } + + iter = g_slist_next (iter); } - else - result = accounts; + /* TODO: Free the strings too? */ + g_slist_free (accounts); + accounts = NULL; return result; }