[epiphany] profile-migrator: Fix migrate_sync_settings_path()



commit 7c3c01d5537acfb6b0b20e4021978a075e04e6e0
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 42c8128..deb6cbf 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -910,9 +910,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]