[epiphany] Fix location of icon database



commit f3558975ea5461b90c6f87a53eff50352fe1dda3
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Mon Jul 24 12:34:44 2017 -0500

    Fix location of icon database
    
    It should be saved under ~/.cache/webkitgtk/icondatabase, not
    ~/.cache/icondatabase. Pass NULL in order to let WebKitGTK+ pick the
    right default value, instead of getting it wrong here.
    
    Delete the old location. It's harmless to delete it again and again for
    each profile directory the migrator runs in. It's just a cache.
    
    Thanks to Carlos Garcia for discovering this problem.

 embed/ephy-embed-shell.c                     |    7 ++-----
 lib/ephy-profile-utils.h                     |    2 +-
 src/profile-migrator/ephy-profile-migrator.c |   19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index bb5572d..77173bc 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -863,7 +863,7 @@ ephy_embed_shell_startup (GApplication *application)
 {
   EphyEmbedShell *shell = EPHY_EMBED_SHELL (application);
   EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
-  char *favicon_db_path;
+  const char *favicon_db_path;
   WebKitCookieManager *cookie_manager;
   char *filename;
   char *cookie_policy;
@@ -928,11 +928,8 @@ ephy_embed_shell_startup (GApplication *application)
                     shell);
 
   /* Favicon Database */
-  favicon_db_path = g_build_filename (priv->mode == EPHY_EMBED_SHELL_MODE_PRIVATE ?
-                                      ephy_dot_dir () : g_get_user_cache_dir (),
-                                      "icondatabase", NULL);
+  favicon_db_path = (priv->mode == EPHY_EMBED_SHELL_MODE_PRIVATE ? ephy_dot_dir () : NULL);
   webkit_web_context_set_favicon_database_directory (priv->web_context, favicon_db_path);
-  g_free (favicon_db_path);
 
   /* Do not ignore TLS errors. */
   webkit_web_context_set_tls_errors_policy (priv->web_context, WEBKIT_TLS_ERRORS_POLICY_FAIL);
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index dd8943d..fd78c18 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -24,7 +24,7 @@
 
 G_BEGIN_DECLS
 
-#define EPHY_PROFILE_MIGRATION_VERSION 17
+#define EPHY_PROFILE_MIGRATION_VERSION 18
 #define EPHY_INSECURE_PASSWORDS_MIGRATION_VERSION 11
 #define EPHY_SETTINGS_MIGRATION_VERSION 16
 
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index a3a3242..ee35fea 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -975,6 +975,24 @@ migrate_search_engines (void)
 }
 
 static void
+migrate_icon_database (void)
+{
+  char *path;
+  GError *error = NULL;
+
+  /* Favicons used to be saved here by mistake. Delete them! */
+  path = g_build_filename (g_get_user_cache_dir (), "icondatabase", NULL);
+  ephy_file_delete_dir_recursively (path, &error);
+
+  if (error) {
+    g_warning ("Failed to delete %s: %s", path, error->message);
+    g_error_free (error);
+  }
+
+  g_free (path);
+}
+
+static void
 migrate_nothing (void)
 {
   /* Used to replace migrators that have been removed. Only remove migrators
@@ -1005,6 +1023,7 @@ const EphyProfileMigrator migrators[] = {
   /* 15 */ migrate_permissions,
   /* 16 */ migrate_settings,
   /* 17 */ migrate_search_engines,
+  /* 18 */ migrate_icon_database,
 };
 
 static gboolean


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