[epiphany/gnome-3-26] profile-migrator: Fix migrate_sync_settings_path()



commit ef443373d853bee68e692cc4728dd5f77d2ec23c
Author: Gabriel Ivascu <gabrielivascu gnome org>
Date:   Sun Dec 17 18:05:35 2017 +0200

    profile-migrator: Fix migrate_sync_settings_path()
    
    Account for the recent migration of sync timestamps from double to
    gint64.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791668

 src/profile-migrator/ephy-profile-migrator.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 27a7ec2..7fda9a9 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -1240,9 +1240,18 @@ migrate_sync_settings_path (void)
 
     if (user_value != NULL) {
       GVariant *value;
+      const GVariantType *type;
 
       value = g_settings_get_value (deprecated_settings, old_sync_settings[i]);
-      g_settings_set_value (EPHY_SETTINGS_SYNC, old_sync_settings[i], value);
+      type = g_variant_get_type (value);
+
+      /* All double values in the old sync schema have been converted to gint64 in the new schema. */
+      if (g_variant_type_equal (type, G_VARIANT_TYPE_DOUBLE)) {
+        g_settings_set_value (EPHY_SETTINGS_SYNC, old_sync_settings[i],
+                              g_variant_new_int64 (ceil (g_variant_get_double (value))));
+      } else {
+        g_settings_set_value (EPHY_SETTINGS_SYNC, old_sync_settings[i], value);
+      }
 
       /* We do not want to ever run this migration again, to avoid writing old
        * values over new ones. So be cautious and reset the old settings. */


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