[epiphany] profile-migrator: Delete old states.xml file



commit 85a9539fb24d8cd40ff1991e608f27451bea0df3
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Jan 23 18:33:27 2017 -0600

    profile-migrator: Delete old states.xml file

 lib/ephy-profile-utils.h                     |    2 +-
 src/profile-migrator/ephy-profile-migrator.c |   26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index 956e7df..81873f9 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 12
+#define EPHY_PROFILE_MIGRATION_VERSION 13
 
 #define EPHY_BOOKMARKS_FILE     "bookmarks.gvdb"
 #define EPHY_HISTORY_FILE       "ephy-history.db"
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 7078900..b9d65ae 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -687,6 +687,29 @@ migrate_adblock_filters (void)
 }
 
 static void
+migrate_initial_state (void)
+{
+  char *filename;
+  GFile *file;
+  GError *error = NULL;
+
+  /* EphyInitialState no longer exists. It's just window sizes, so "migrate" it
+   * by simply removing the file to avoid cluttering the profile dir. */
+  filename = g_build_filename (ephy_dot_dir (), "states.xml", NULL);
+  file = g_file_new_for_path (filename);
+
+  g_file_delete (file, NULL, &error);
+  if (error != NULL) {
+    if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+      g_warning ("Failed to delete %s: %s", filename, error->message);
+    g_error_free (error);
+  }
+
+  g_free (filename);
+  g_object_unref (file);
+}
+
+static void
 migrate_nothing (void)
 {
   /* Used to replace migrators that have been removed. Only remove migrators
@@ -697,6 +720,8 @@ migrate_nothing (void)
    */
 }
 
+/* If adding anything here, you need to edit EPHY_PROFILE_MIGRATION_VERSION
+ * in ephy-profile-utils.h. */
 const EphyProfileMigrator migrators[] = {
   migrate_nothing,
   migrate_nothing,
@@ -710,6 +735,7 @@ const EphyProfileMigrator migrators[] = {
   migrate_app_desktop_file_categories,
   migrate_bookmarks,
   migrate_adblock_filters,
+  migrate_initial_state,
 };
 
 static gboolean


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