[epiphany] e-profile-migrator: update web-apps .desktop files Category



commit 9fddd07ae21abf7bcb295fe8c14e5632d7985b37
Author: Diego Escalante Urrelo <diegoe igalia com>
Date:   Wed Jan 8 10:39:15 2014 -0500

    e-profile-migrator: update web-apps .desktop files Category
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672574

 lib/ephy-profile-migrator.c |   36 ++++++++++++++++++++++++++++++++++++
 lib/ephy-profile-utils.h    |    2 +-
 2 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c
index 5ca9f9a..718eb5f 100644
--- a/lib/ephy-profile-migrator.c
+++ b/lib/ephy-profile-migrator.c
@@ -954,6 +954,41 @@ migrate_form_passwords_to_libsecret (void)
   g_object_unref (service);
 }
 
+static void
+migrate_app_desktop_file_categories (void)
+{
+  GList *web_apps, *l;
+
+  web_apps = ephy_web_application_get_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->name);
+    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);
+}
+
 const EphyProfileMigrator migrators[] = {
   migrate_cookies,
   migrate_passwords,
@@ -968,6 +1003,7 @@ const EphyProfileMigrator migrators[] = {
   migrate_web_app_links,
   migrate_new_urls_table,
   migrate_form_passwords_to_libsecret,
+  migrate_app_desktop_file_categories,
 };
 
 static gboolean
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index 72d32e4..1648e49 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -22,7 +22,7 @@
 
 #include <glib.h>
 
-#define EPHY_PROFILE_MIGRATION_VERSION 9
+#define EPHY_PROFILE_MIGRATION_VERSION 10
 
 #define EPHY_HISTORY_FILE       "ephy-history.db"
 #define EPHY_BOOKMARKS_FILE     "ephy-bookmarks.xml"


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