[epiphany/mcatanzaro/settings-cleanup: 13/13] Remove deprecated settings



commit 90cc526d5b0ea2a109caae8f761c111cb744bebe
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Wed Jan 23 19:06:50 2019 -0600

    Remove deprecated settings
    
    Carrying settings that don't do anything is confusing to users. These
    have been around for several years, and everyone should probably have
    migrated by now.

 data/org.gnome.epiphany.gschema.xml          | 117 ---------------
 lib/ephy-profile-utils.h                     |   1 -
 src/profile-migrator/ephy-profile-migrator.c | 212 +--------------------------
 3 files changed, 3 insertions(+), 327 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index ab5a4aa5e..2654b4940 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -17,11 +17,6 @@
                        <summary>Home page</summary>
                        <description>Address of the user’s home page.</description>
                </key>
-               <key type="s" name="keyword-search-url">
-                       <default>'https://duckduckgo.com/?q=%s&amp;t=epiphany'</default>
-                       <summary>URL Search</summary>
-                       <description>DEPRECATED: This key is deprecated and ignored. Use 
/org/gnome/epiphany/search-engines instead.</description>
-               </key>
                <key type="s" name="default-search-engine">
                        <default>'DuckDuckGo'</default>
                        <summary>Default search engine.</summary>
@@ -38,39 +33,14 @@
                        <summary>Default search engines.</summary>
                        <description>List of the default search engines. It is an array in which each search 
engine is described by a name, an address, and a bang (shortcut).</description>
                </key>
-               <key type="s" name="user-agent">
-                       <default>''</default>
-                       <summary>User agent</summary>
-                       <description>
-                          String that will be used as user agent, to identify the browser to the web servers.
-
-                          DEPRECATED: This key is deprecated and ignored. Use 
/org/gnome/epiphany/web/user-agent instead.
-                        </description>
-               </key>
                <key type="b" name="new-windows-in-tabs">
                        <default>true</default>
                        <summary>Force new windows to be opened in tabs</summary>
                        <description>Force new window requests to be opened in tabs instead of using a new 
window.</description>
                </key>
-               <key type="b" name="remember-passwords">
-                       <default>true</default>
-                       <summary>Remember passwords</summary>
-                       <description>
-                          Whether to store and prefill passwords in websites.
-
-                          DEPRECATED: This key is deprecated and ignored. Use 
/org/gnome/epiphany/web/remember-passwords instead.
-                        </description>
-               </key>
                <key type="b" name="warn-on-close-unsubmitted-data">
                        <default>true</default>
                </key>
-               <key type="b" name="enable-smooth-scrolling">
-                       <default>false</default>
-                       <summary>Enable smooth scrolling</summary>
-                        <description>
-                          DEPRECATED: This key is deprecated and ignored. Use 
/org/gnome/epiphany/web/enable-smooth-scrolling instead.
-                        </description>
-               </key>
                <key type="b" name="internal-view-source">
                        <default>true</default>
                        <summary>Don’t use an external application to view page source.</summary>
@@ -403,93 +373,6 @@
                        <description>The timestamp at which last open tabs sync was made.</description>
                </key>
        </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">
                <value nick="undecided" value="-1"/>
                <value nick="deny" value="0"/>
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index 0ed11f65e..41503962a 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -26,7 +26,6 @@ G_BEGIN_DECLS
 
 #define EPHY_PROFILE_MIGRATION_VERSION 29
 #define EPHY_INSECURE_PASSWORDS_MIGRATION_VERSION 11
-#define EPHY_SETTINGS_MIGRATION_VERSION 16
 #define EPHY_FIREFOX_SYNC_PASSWORDS_MIGRATION_VERSION 19
 #define EPHY_TARGET_ORIGIN_MIGRATION_VERSION 21
 #define EPHY_SYNC_DEVICE_ID_MIGRATION_VERSION 23
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 08c9485cd..c7866dfbc 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -516,149 +516,6 @@ migrate_permissions (void)
   g_object_unref (file);
 }
 
-static const char * const deprecated_settings[] = {
-  EPHY_PREFS_DEPRECATED_USER_AGENT,
-  EPHY_PREFS_DEPRECATED_REMEMBER_PASSWORDS,
-  EPHY_PREFS_DEPRECATED_ENABLE_SMOOTH_SCROLLING,
-};
-
-static void
-migrate_deprecated_settings (void)
-{
-  for (guint i = 0; i < G_N_ELEMENTS (deprecated_settings); i++) {
-    GVariant *value;
-
-    value = g_settings_get_value (EPHY_SETTINGS_MAIN, deprecated_settings[i]);
-    g_settings_set_value (EPHY_SETTINGS_WEB, deprecated_settings[i], value);
-    g_variant_unref (value);
-  }
-
-  g_settings_sync ();
-}
-
-static gboolean
-is_deprecated_setting (const char *setting)
-{
-  for (guint i = 0; i < G_N_ELEMENTS (deprecated_settings); i++) {
-    if (!strcmp (setting, deprecated_settings[i]))
-      return TRUE;
-  }
-
-  return FALSE;
-}
-
-static void
-migrate_settings (void)
-{
-  int default_profile_migration_version;
-
-  /* The migrator is only run for the main profile and web apps,
-   * so if the profile dir is not the default one, it's a web app.
-   * If not a web app, migrate deprecated settings.
-   */
-  if (ephy_dot_dir_is_default ()) {
-    migrate_deprecated_settings ();
-    return;
-  }
-
-  /* If it's a web app, inherit settings from the default profile. */
-  /* If the default profile hasn't been migrated yet, use the deprecated settings. */
-  default_profile_migration_version = ephy_profile_utils_get_migration_version_for_profile_dir 
(ephy_default_dot_dir ());
-  if (default_profile_migration_version < EPHY_SETTINGS_MIGRATION_VERSION) {
-    GSettings *settings;
-
-    settings = g_settings_new_with_path (EPHY_PREFS_WEB_SCHEMA, "/org/gnome/epiphany/web/");
-
-    for (guint i = 0; i < G_N_ELEMENTS (ephy_prefs_web_schema); i++) {
-      GVariant *value;
-
-      if (is_deprecated_setting (ephy_prefs_web_schema[i]))
-        continue;
-
-      value = g_settings_get_value (settings, ephy_prefs_web_schema[i]);
-      g_settings_set_value (EPHY_SETTINGS_WEB, ephy_prefs_web_schema[i], value);
-      g_variant_unref (value);
-    }
-
-    g_object_unref (settings);
-
-    for (guint i = 0; i < G_N_ELEMENTS (deprecated_settings); i++) {
-      GVariant *value;
-
-      value = g_settings_get_value (EPHY_SETTINGS_MAIN, deprecated_settings[i]);
-      g_settings_set_value (EPHY_SETTINGS_WEB, deprecated_settings[i], value);
-      g_variant_unref (value);
-    }
-  } else
-    ephy_web_application_initialize_settings (ephy_dot_dir ());
-
-  g_settings_sync ();
-}
-
-/* Originally migrator #17, but moved to spot #27 because it uses the
- * bookmarks manager, which requires that we have already run #24.
- */
-static void
-migrate_search_engines (void)
-{
-  EphyBookmarksManager *bookmarks_manager;
-  EphySearchEngineManager *search_engine_manager;
-  GSequence *bookmarks;
-  GSequenceIter *iter;
-  GList *smart_bookmarks = NULL;
-  const char *address;
-  const char *title;
-  char *default_search_engine_address;
-  const char *default_search_engine_name = _("Search the Web");
-
-  /* Search engine 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;
-
-  bookmarks_manager = ephy_bookmarks_manager_new ();
-  search_engine_manager = ephy_search_engine_manager_new ();
-
-  default_search_engine_address = g_settings_get_string (EPHY_SETTINGS_MAIN,
-                                                         EPHY_PREFS_KEYWORD_SEARCH_URL);
-  if (default_search_engine_address != NULL) {
-      ephy_search_engine_manager_add_engine (search_engine_manager,
-                                             default_search_engine_name,
-                                             default_search_engine_address,
-                                             "");
-      ephy_search_engine_manager_set_default_engine (search_engine_manager,
-                                                     default_search_engine_name);
-      g_free (default_search_engine_address);
-  }
-
-  bookmarks = ephy_bookmarks_manager_get_bookmarks (bookmarks_manager);
-  for (iter = g_sequence_get_begin_iter (bookmarks);
-       !g_sequence_iter_is_end (iter);
-       iter = g_sequence_iter_next (iter)) {
-    EphyBookmark *bookmark;
-
-    bookmark = g_sequence_get (iter);
-    address = ephy_bookmark_get_url (bookmark);
-
-    if (strstr (address, "%s") != NULL) {
-      title = ephy_bookmark_get_title (bookmark);
-      ephy_search_engine_manager_add_engine (search_engine_manager,
-                                             title,
-                                             address,
-                                             "");
-      smart_bookmarks = g_list_append (smart_bookmarks, bookmark);
-   }
-  }
-
-  for (GList *l = smart_bookmarks; l != NULL; l = l->next)
-    ephy_bookmarks_manager_remove_bookmark (bookmarks_manager,
-                                            (EphyBookmark *)(l->data));
-
-  g_list_free (smart_bookmarks);
-  g_object_unref (bookmarks_manager);
-  g_object_unref (search_engine_manager);
-}
-
 static void
 migrate_icon_database (void)
 {
@@ -881,69 +738,6 @@ out:
   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;
-      const GVariantType *type;
-
-      value = g_settings_get_value (deprecated_settings, old_sync_settings[i]);
-      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. */
-      g_settings_reset (deprecated_settings, old_sync_settings[i]);
-
-      g_variant_unref (value);
-      g_variant_unref (user_value);
-    }
-  }
-
-  g_settings_sync ();
-}
-
 static void
 migrate_sync_device_info (void)
 {
@@ -1322,18 +1116,18 @@ const EphyProfileMigrator migrators[] = {
   /* 13 */ migrate_adblock_filters,
   /* 14 */ migrate_initial_state,
   /* 15 */ migrate_permissions,
-  /* 16 */ migrate_settings,
+  /* 16 */ migrate_nothing,
   /* 17 */ migrate_nothing,
   /* 18 */ migrate_icon_database,
   /* 19 */ migrate_passwords_to_firefox_sync_passwords,
   /* 20 */ migrate_history_to_firefox_sync_history,
   /* 21 */ migrate_passwords_add_target_origin,
-  /* 22 */ migrate_sync_settings_path,
+  /* 22 */ migrate_nothing,
   /* 23 */ migrate_sync_device_info,
   /* 24 */ migrate_bookmarks_timestamp,
   /* 25 */ migrate_passwords_timestamp,
   /* 26 */ migrate_nothing,
-  /* 27 */ migrate_search_engines,
+  /* 27 */ migrate_nothing,
   /* 28 */ migrate_annoyance_list,
   /* 29 */ migrate_zoom_level
 };


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