[evolution] Bug 702664 - Settings migration issue from "headers" to "show-headers"



commit f927a9a169f11f34171937172cade82c184fa022
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jun 21 11:03:25 2013 -0400

    Bug 702664 - Settings migration issue from "headers" to "show-headers"
    
    Give the "show-headers" key a proper default value, and watch out for
    an empty "headers" key, which is supposed to imply that default value.

 data/org.gnome.evolution.mail.gschema.xml.in |    2 +-
 modules/mail/em-mailer-prefs.c               |    3 ++-
 modules/settings/e-settings-deprecated.c     |    8 +++++++-
 3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index 249f2d8..f853fe7 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -232,7 +232,7 @@
       <_description>Show all the headers when viewing a messages.</_description>
     </key>
     <key name="show-headers" type="a(sb)">
-      <default>[]</default>
+      <default>[('From', true), ('Reply-To', true), ('To', true), ('Cc', true), ('Bcc' true), ('Subject', 
true), ('Date', true), ('Newsgroups', true), ('Face', true), ('x-evolution-mailer', false)]</default>
       <_summary>List of headers to show when viewing a message.</_summary>
       <_description>Each header is represented as a pair: the header name, and a boolean indicating whether 
the header is enabled.  Disabled headers are not shown when viewing a message, but are still listed in 
Preferences.</_description>
     </key>
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 38e66b0..5652487 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -58,7 +58,8 @@ static GType col_types[] = {
 
 #define EM_FORMAT_HEADER_XMAILER "x-evolution-mailer"
 
-/* temporarily copied from em-format.c */
+/* Keep this synchronized with the "show-headers" key
+ * in the "org.gnome.evolution.mail" GSettings schema. */
 static const gchar *default_headers[] = {
        N_("From"),
        N_("Reply-To"),
diff --git a/modules/settings/e-settings-deprecated.c b/modules/settings/e-settings-deprecated.c
index 058c7fd..d22dbf9 100644
--- a/modules/settings/e-settings-deprecated.c
+++ b/modules/settings/e-settings-deprecated.c
@@ -120,6 +120,10 @@ settings_deprecated_header_strv_to_variant (gchar **strv)
 
        length = g_strv_length (strv);
 
+       /* Disregard an empty list. */
+       if (length == 0)
+               return NULL;
+
        g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sb)"));
 
        for (ii = 0; ii < length; ii++)
@@ -519,7 +523,9 @@ settings_deprecated_constructed (GObject *object)
 
        strv_value = g_settings_get_strv (priv->mail_settings, "headers");
        variant = settings_deprecated_header_strv_to_variant (strv_value);
-       g_settings_set_value (priv->mail_settings, "show-headers", variant);
+       if (variant != NULL)
+               g_settings_set_value (
+                       priv->mail_settings, "show-headers", variant);
        g_strfreev (strv_value);
 
        /* XXX The "reply-style" key uses a completely different


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]