From 80940eeebd7318d62e8c690a7f7bf70f7cfe3eab Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 16 Jan 2003 19:41:56 +0000 Subject: Add a UID field (to match EAccount), which never changes and can be used * mail-config.h (MailConfigAccount): Add a UID field (to match EAccount), which never changes and can be used by gconf watchers to distinguish an account rename from a deletion and creation. * mail-config.c (account_copy): Create a new UID on the new account. (account_new_from_xml): Read the UID. (If it doesn't have one, make one.) (account_to_xml): Write the UID. * mail-config-druid.c (make_account): add a UID to each account svn path=/trunk/; revision=19496 --- mail/ChangeLog | 14 ++++++++++++++ mail/mail-config-druid.c | 2 ++ mail/mail-config.c | 13 +++++++++++-- mail/mail-config.h | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 0c8c4f931d..6b481c4874 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +2003-01-16 Dan Winship + + * mail-config.h (MailConfigAccount): Add a UID field (to match + EAccount), which never changes and can be used by gconf watchers + to distinguish an account rename from a deletion and creation. + + * mail-config.c (account_copy): Create a new UID on the new + account. + (account_new_from_xml): Read the UID. (If it doesn't have one, + make one.) + (account_to_xml): Write the UID. + + * mail-config-druid.c (make_account): add a UID to each account + 2003-01-15 Not Zed * mail-accounts.c (account_able_clicked): Change the diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index b28580cc61..ffbc387ed2 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -48,6 +48,7 @@ #include "mail-session.h" #include +#include static void mail_config_druid_class_init (MailConfigDruidClass *class); static void mail_config_druid_destroy (GtkObject *obj); @@ -467,6 +468,7 @@ make_account (void) account = g_new0 (MailConfigAccount, 1); account->enabled = TRUE; + account->uid = e_account_gen_uid (); account->id = g_new0 (MailConfigIdentity, 1); name = g_get_real_name (); diff --git a/mail/mail-config.c b/mail/mail-config.c index f9b3a56ca5..ae02d57616 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -54,6 +54,7 @@ #include #include +#include #include #include #include "mail.h" @@ -207,6 +208,7 @@ account_copy (const MailConfigAccount *account) new = g_new0 (MailConfigAccount, 1); new->name = g_strdup (account->name); + new->uid = e_account_gen_uid (); new->enabled = account->enabled; @@ -242,6 +244,7 @@ account_destroy (MailConfigAccount *account) return; g_free (account->name); + g_free (account->uid); identity_destroy (account->id); service_destroy (account->source); @@ -355,8 +358,13 @@ account_new_from_xml (char *in) account = g_new0 (MailConfigAccount, 1); account->name = xml_get_prop (node, "name"); + account->uid = xml_get_prop (node, "uid"); account->enabled = xml_get_bool (node, "enabled"); + /* temporary pre-1.4 back compat */ + if (!account->uid) + account->uid = e_account_gen_uid (); + node = node->children; while (node != NULL) { if (!strcmp (node->name, "identity")) { @@ -428,7 +436,7 @@ account_new_from_xml (char *in) account->pgp_encrypt_to_self = xml_get_bool (node, "encrypt-to-self"); account->pgp_always_trust = xml_get_bool (node, "always-trust"); account->pgp_always_sign = xml_get_bool (node, "always-sign"); - account->pgp_no_imip_sign = !xml_get_bool (node, "sign-imip"); + account->pgp_no_imip_sign = xml_get_bool (node, "no-imip-sign"); if (node->children) { cur = node->children; @@ -480,6 +488,7 @@ account_to_xml (MailConfigAccount *account) xmlDocSetRootElement (doc, root); xmlSetProp (root, "name", account->name); + xmlSetProp (root, "uid", account->uid); xmlSetProp (root, "enabled", account->enabled ? "true" : "false"); id = xmlNewChild (root, NULL, "identity", NULL); @@ -528,7 +537,7 @@ account_to_xml (MailConfigAccount *account) xmlSetProp (node, "encrypt-to-self", account->pgp_encrypt_to_self ? "true" : "false"); xmlSetProp (node, "always-trust", account->pgp_always_trust ? "true" : "false"); xmlSetProp (node, "always-sign", account->pgp_always_sign ? "true" : "false"); - xmlSetProp (node, "sign-imip", !account->pgp_no_imip_sign ? "true" : "false"); + xmlSetProp (node, "no-imip-sign", account->pgp_no_imip_sign ? "true" : "false"); if (account->pgp_key) xmlNewTextChild (node, NULL, "key-id", account->pgp_key); diff --git a/mail/mail-config.h b/mail/mail-config.h index 79a6414f91..970c718777 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -59,6 +59,7 @@ typedef struct { typedef struct { char *name; + char *uid; gboolean enabled; -- cgit v1.2.3