[evolution] Add migration code for global-view-setting default change (bug 792076)



commit 185712a1280d8a2c7c1205dc928336ef9fcb700f
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 8 18:06:15 2018 +0100

    Add migration code for global-view-setting default change (bug 792076)

 src/mail/e-mail-migrate.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/mail/e-mail-migrate.c b/src/mail/e-mail-migrate.c
index 50fdf2b..8a06952 100644
--- a/src/mail/e-mail-migrate.c
+++ b/src/mail/e-mail-migrate.c
@@ -484,6 +484,26 @@ em_unset_initial_setup_for_accounts (EShellBackend *shell_backend)
        g_list_free_full (sources, g_object_unref);
 }
 
+/* The default value for this key changed from 'false' to 'true' in 3.27.90,
+   but existing users can be affected by the change when they never changed
+   the option, thus make sure their value will remain 'false' here. */
+static void
+em_ensure_global_view_setting_key (EShellBackend *shell_backend)
+{
+       GSettings *settings;
+       GVariant *value;
+
+       settings = e_util_ref_settings ("org.gnome.evolution.mail");
+
+       value = g_settings_get_user_value (settings, "global-view-setting");
+       if (value)
+               g_variant_unref (value);
+       else
+               g_settings_set_boolean (settings, "global-view-setting", FALSE);
+
+       g_clear_object (&settings);
+}
+
 gboolean
 e_mail_migrate (EShellBackend *shell_backend,
                 gint major,
@@ -507,5 +527,8 @@ e_mail_migrate (EShellBackend *shell_backend,
        if (major <= 2 || (major == 3 && minor < 19) || (major == 3 && minor == 19 && micro < 90))
                em_unset_initial_setup_for_accounts (shell_backend);
 
+       if (major <= 2 || (major == 3 && minor < 27) || (major == 3 && minor == 27 && micro < 90))
+               em_ensure_global_view_setting_key (shell_backend);
+
        return TRUE;
 }


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