From dfda76b995cedfee0588e3f9a9b7e22574dd0c58 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 1 Jun 2001 22:40:17 +0000 Subject: Save the pgp and smime settings. (mail_account_gui_new): Setup the pgp and 2001-06-01 Jeffrey Stedfast * mail-account-gui.c (mail_account_gui_save): Save the pgp and smime settings. (mail_account_gui_new): Setup the pgp and s/mime page (but disable the s/mime frame if we are not compiled with s/mime support). * mail-config.c (account_copy): Updated to save extra pgp and smime options. (account_destroy): Free draft/sent folder info and also the new pgp/smime keys. (config_read): Read in the pgp and s/mime config options. (mail_config_write): Save the account pgp and smime options. svn path=/trunk/; revision=10084 --- mail/mail-config.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 3 deletions(-) (limited to 'mail/mail-config.c') diff --git a/mail/mail-config.c b/mail/mail-config.c index 2819abaffa..4465ac27db 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -167,7 +167,13 @@ account_copy (const MailConfigAccount *account) new->drafts_folder_uri = g_strdup (account->drafts_folder_uri); new->sent_folder_name = g_strdup (account->sent_folder_name); new->sent_folder_uri = g_strdup (account->sent_folder_uri); - + + new->pgp_key = g_strdup (account->pgp_key); + new->pgp_encrypt_to_self = account->pgp_encrypt_to_self; + + new->smime_key = g_strdup (account->smime_key); + new->smime_encrypt_to_self = account->smime_encrypt_to_self; + return new; } @@ -183,6 +189,14 @@ account_destroy (MailConfigAccount *account) service_destroy (account->source); service_destroy (account->transport); + g_free (account->drafts_folder_name); + g_free (account->drafts_folder_uri); + g_free (account->sent_folder_name); + g_free (account->sent_folder_uri); + + g_free (account->pgp_key); + g_free (account->smime_key); + g_free (account); } @@ -220,7 +234,7 @@ mail_config_clear (void) g_slist_free (config->news); config->news = NULL; } - + /* overkill? */ memset (config, 0, sizeof (MailConfig)); } @@ -290,6 +304,36 @@ config_read (void) else g_free (val); + /* get the pgp info */ + path = g_strdup_printf ("account_pgp_key_%d", i); + val = gnome_config_get_string (path); + g_free (path); + if (val && *val) + account->pgp_key = val; + else + g_free (val); + + path = g_strdup_printf ("account_pgp_encrypt_to_self_%d", i); + account->pgp_encrypt_to_self = gnome_config_get_bool_with_default (path, &def); + if (def) + account->pgp_encrypt_to_self = TRUE; + g_free (path); + + /* get the s/mime info */ + path = g_strdup_printf ("account_smime_key_%d", i); + val = gnome_config_get_string (path); + g_free (path); + if (val && *val) + account->smime_key = val; + else + g_free (val); + + path = g_strdup_printf ("account_smime_encrypt_to_self_%d", i); + account->smime_encrypt_to_self = gnome_config_get_bool_with_default (path, &def); + if (def) + account->smime_encrypt_to_self = TRUE; + g_free (path); + /* get the identity info */ id = g_new0 (MailConfigIdentity, 1); path = g_strdup_printf ("identity_name_%d", i); @@ -491,7 +535,7 @@ config_read (void) else config->default_charset = g_strdup (config->default_charset); } - + gnome_config_sync (); } @@ -536,6 +580,22 @@ mail_config_write (void) gnome_config_set_string (path, account->sent_folder_uri); g_free (path); + /* account pgp options */ + path = g_strdup_printf ("account_pgp_key_%d", i); + gnome_config_set_string (path, account->pgp_key); + g_free (path); + path = g_strdup_printf ("account_pgp_encrypt_to_self_%d", i); + gnome_config_set_bool (path, account->pgp_encrypt_to_self); + g_free (path); + + /* account s/mime options */ + path = g_strdup_printf ("account_smime_key_%d", i); + gnome_config_set_string (path, account->smime_key); + g_free (path); + path = g_strdup_printf ("account_smime_encrypt_to_self_%d", i); + gnome_config_set_bool (path, account->smime_encrypt_to_self); + g_free (path); + /* identity info */ path = g_strdup_printf ("identity_name_%d", i); gnome_config_set_string (path, account->id->name); -- cgit v1.2.3