Commit 8c69aeac authored by Michael Catanzaro's avatar Michael Catanzaro Committed by Gabriel Ivascu

Fix location of sync settings and add a migrator

Unfortunately we have to keep the old schema around indefinitely, to
not break migrations.

https://bugzilla.gnome.org/show_bug.cgi?id=789786
parent cafbe895
...@@ -271,7 +271,7 @@ ...@@ -271,7 +271,7 @@
<default>false</default> <default>false</default>
</key> </key>
</schema> </schema>
<schema path="/org/gnome/Epiphany/sync/" id="org.gnome.Epiphany.sync"> <schema path="/org/gnome/epiphany/sync/" id="org.gnome.Epiphany.sync">
<key type="s" name="sync-user"> <key type="s" name="sync-user">
<default>''</default> <default>''</default>
<summary>Currently signed in sync user</summary> <summary>Currently signed in sync user</summary>
...@@ -358,6 +358,93 @@ ...@@ -358,6 +358,93 @@
<description>The timestamp at which last open tabs sync was made.</description> <description>The timestamp at which last open tabs sync was made.</description>
</key> </key>
</schema> </schema>
<schema path="/org/gnome/Epiphany/sync/" id="org.gnome.Epiphany.sync.DEPRECATED">
<key type="s" name="sync-user">
<default>''</default>
<summary>Currently signed in sync user</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="x" name="sync-time">
<default>0</default>
<summary>Last sync timestamp</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="s" name="sync-device-id">
<default>''</default>
<summary>Sync device ID</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="s" name="sync-device-name">
<default>''</default>
<summary>Sync device name</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="u" name="sync-frequency">
<default>30</default>
<summary>The sync frequency in minutes</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="b" name="sync-with-firefox">
<default>true</default>
<summary>Sync data with Firefox</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="b" name="sync-bookmarks-enabled">
<default>false</default>
<summary>Enable bookmarks sync</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="d" name="sync-bookmarks-time">
<default>0</default>
<summary>Bookmarks sync timestamp</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="b" name="sync-bookmarks-initial">
<default>true</default>
<summary>Initial sync or normal sync</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="b" name="sync-passwords-enabled">
<default>false</default>
<summary>Enable passwords sync</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="d" name="sync-passwords-time">
<default>0</default>
<summary>Passwords sync timestamp</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="b" name="sync-passwords-initial">
<default>true</default>
<summary>Initial sync or normal sync</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="b" name="sync-history-enabled">
<default>false</default>
<summary>Enable history sync</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="d" name="sync-history-time">
<default>0</default>
<summary>History sync timestamp</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="b" name="sync-history-initial">
<default>true</default>
<summary>Initial sync or normal sync</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="b" name="sync-open-tabs-enabled">
<default>false</default>
<summary>Enable open tabs sync</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
<key type="d" name="sync-open-tabs-time">
<default>0</default>
<summary>Open tabs sync timestamp</summary>
<description>DEPRECATED: This key is deprecated and ignored. Use /org/gnome/epiphany/sync/ instead.</description>
</key>
</schema>
<enum id="org.gnome.Epiphany.Permission"> <enum id="org.gnome.Epiphany.Permission">
<value nick="undecided" value="-1"/> <value nick="undecided" value="-1"/>
<value nick="deny" value="0"/> <value nick="deny" value="0"/>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define EPHY_PROFILE_MIGRATION_VERSION 21 #define EPHY_PROFILE_MIGRATION_VERSION 22
#define EPHY_INSECURE_PASSWORDS_MIGRATION_VERSION 11 #define EPHY_INSECURE_PASSWORDS_MIGRATION_VERSION 11
#define EPHY_SETTINGS_MIGRATION_VERSION 16 #define EPHY_SETTINGS_MIGRATION_VERSION 16
#define EPHY_FIREFOX_SYNC_PASSWORDS_MIGRATION_VERSION 19 #define EPHY_FIREFOX_SYNC_PASSWORDS_MIGRATION_VERSION 19
......
...@@ -1197,6 +1197,60 @@ out: ...@@ -1197,6 +1197,60 @@ out:
g_list_free_full (passwords, g_object_unref); g_list_free_full (passwords, g_object_unref);
} }
static const char * const old_sync_settings[] = {
EPHY_PREFS_SYNC_USER,
EPHY_PREFS_SYNC_TIME,
EPHY_PREFS_SYNC_DEVICE_ID,
EPHY_PREFS_SYNC_DEVICE_NAME,
EPHY_PREFS_SYNC_FREQUENCY,
EPHY_PREFS_SYNC_WITH_FIREFOX,
EPHY_PREFS_SYNC_BOOKMARKS_ENABLED,
EPHY_PREFS_SYNC_BOOKMARKS_TIME,
EPHY_PREFS_SYNC_BOOKMARKS_INITIAL,
EPHY_PREFS_SYNC_PASSWORDS_ENABLED,
EPHY_PREFS_SYNC_PASSWORDS_TIME,
EPHY_PREFS_SYNC_PASSWORDS_INITIAL,
EPHY_PREFS_SYNC_HISTORY_ENABLED,
EPHY_PREFS_SYNC_HISTORY_TIME,
EPHY_PREFS_SYNC_HISTORY_INITIAL,
EPHY_PREFS_SYNC_OPEN_TABS_ENABLED,
EPHY_PREFS_SYNC_OPEN_TABS_TIME
};
static void
migrate_sync_settings_path (void)
{
GSettings *deprecated_settings = ephy_settings_get ("org.gnome.Epiphany.sync.DEPRECATED");
/* Sync settings are only used in browser mode, so no need to migrate if we
* are not in browser mode. */
if (!ephy_dot_dir_is_default ())
return;
for (guint i = 0; i < G_N_ELEMENTS (old_sync_settings); i++) {
GVariant *user_value;
/* Has the setting been changed from its default? */
user_value = g_settings_get_user_value (deprecated_settings, old_sync_settings[i]);
if (user_value != NULL) {
GVariant *value;
value = g_settings_get_value (deprecated_settings, old_sync_settings[i]);
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. */
g_settings_reset (deprecated_settings, old_sync_settings[i]);
g_variant_unref (value);
g_variant_unref (user_value);
}
}
g_settings_sync ();
}
static void static void
migrate_nothing (void) migrate_nothing (void)
{ {
...@@ -1232,6 +1286,7 @@ const EphyProfileMigrator migrators[] = { ...@@ -1232,6 +1286,7 @@ const EphyProfileMigrator migrators[] = {
/* 19 */ migrate_passwords_to_firefox_sync_passwords, /* 19 */ migrate_passwords_to_firefox_sync_passwords,
/* 20 */ migrate_history_to_firefox_sync_history, /* 20 */ migrate_history_to_firefox_sync_history,
/* 21 */ migrate_passwords_add_target_origin, /* 21 */ migrate_passwords_add_target_origin,
/* 22 */ migrate_sync_settings_path
}; };
static gboolean static gboolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment