[epiphany/mcatanzaro/webapp-profile: 1/19] web-app-utils: Fix app profile dir



commit 1cd0fc7fafcd185118482bee94f5f92f2d8b7260
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Fri Mar 15 11:21:16 2019 -0500

    web-app-utils: Fix app profile dir
    
    We migrate all existing web apps to separate profile dirs, but continue
    to create new web apps in existing profile dirs... pretty big oversight,
    not good. Fix it.
    
    This also removes an old migrator that depends on this code, since it
    won't work anymore. This is our oldest migrator and it's not worth
    updating.

 lib/ephy-web-app-utils.c                     | 11 +++------
 src/profile-migrator/ephy-profile-migrator.c | 37 +---------------------------
 2 files changed, 5 insertions(+), 43 deletions(-)
---
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index 01b38a2f9..fbb7554cd 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -167,18 +167,15 @@ get_app_id_from_profile_directory (const char *profile_dir)
 char *
 ephy_web_application_get_profile_directory (const char *id)
 {
-  char *dot_dir, *app_dir, *profile_dir;
+  g_autofree char *app_dir = NULL;
+  g_autofree char *profile_dir = NULL;
 
   app_dir = get_app_profile_directory_name (id);
   if (!app_dir)
     return NULL;
 
-  dot_dir = !ephy_profile_dir_is_default () ? ephy_default_profile_dir () : NULL;
-  profile_dir = g_build_filename (dot_dir ? dot_dir : g_get_user_data_dir (), app_dir, NULL);
-  g_free (app_dir);
-  g_free (dot_dir);
-
-  return profile_dir;
+  profile_dir = g_build_filename (g_get_user_data_dir (), app_dir, NULL);
+  return g_steal_pointer (&profile_dir);
 }
 
 /**
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index ece69055d..2eca302c1 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -109,41 +109,6 @@ profile_dir_exists (void)
   return FALSE;
 }
 
-static void
-migrate_app_desktop_file_categories (void)
-{
-  GList *web_apps, *l;
-
-  web_apps = ephy_web_application_get_legacy_application_list ();
-
-  for (l = web_apps; l; l = l->next) {
-    EphyWebApplication *app = (EphyWebApplication *)l->data;
-    GKeyFile *file;
-    char *data = NULL;
-    char *app_path;
-    char *desktop_file_path;
-
-    file = g_key_file_new ();
-
-    app_path = ephy_web_application_get_profile_directory (app->id);
-    desktop_file_path = g_build_filename (app_path, app->desktop_file, NULL);
-    g_key_file_load_from_file (file, desktop_file_path, G_KEY_FILE_NONE, NULL);
-
-    LOG ("migrate_app_desktop_file_categories: adding Categories to %s", app->name);
-    g_key_file_set_value (file, "Desktop Entry", "Categories", "Network;GNOME;GTK;");
-
-    data = g_key_file_to_data (file, NULL, NULL);
-    g_file_set_contents (desktop_file_path, data, -1, NULL);
-
-    g_free (app_path);
-    g_free (desktop_file_path);
-    g_free (data);
-    g_key_file_free (file);
-  }
-
-  ephy_web_application_free_application_list (web_apps);
-}
-
 /* https://bugzilla.gnome.org/show_bug.cgi?id=752738 */
 static void
 migrate_insecure_password (SecretItem *item)
@@ -1281,7 +1246,7 @@ const EphyProfileMigrator migrators[] = {
   /*  7 */ migrate_nothing,
   /*  8 */ migrate_nothing,
   /*  9 */ migrate_nothing,
-  /* 10 */ migrate_app_desktop_file_categories,
+  /* 10 */ migrate_nothing,
   /* 11 */ migrate_insecure_passwords,
   /* 12 */ migrate_bookmarks,
   /* 13 */ migrate_adblock_filters,


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