[gnome-terminal] migration: Fix migration of the colour palette



commit 16d1ee6c656fc775f71f5623eacfc3caea4cecfb
Author: Christian Persch <chpe gnome org>
Date:   Wed Mar 13 14:10:32 2013 +0100

    migration: Fix migration of the colour palette
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695759

 src/migration.c        |   28 ++++++++++++++++++++++++++--
 src/terminal-schemas.h |    2 +-
 2 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/src/migration.c b/src/migration.c
index 063d552..8f238e0 100644
--- a/src/migration.c
+++ b/src/migration.c
@@ -287,6 +287,31 @@ migrate_genum (GConfClient *client,
     gconf_value_free (value);
 }
 
+static void
+migrate_palette (GConfClient *client,
+                 const char *gconf_path,
+                 GSettings *settings)
+{
+  GConfValue *value;
+  char *key;
+  char **strv;
+
+  key = gconf_concat_dir_and_key (gconf_path, KEY_PALETTE);
+  value = gconf_client_get_without_default (client, key, NULL);
+  g_free (key);
+
+  if (value != NULL &&
+      value->type == GCONF_VALUE_STRING) {
+    strv = g_strsplit (gconf_value_get_string (value), ":", -1);
+    g_settings_set_strv (settings, TERMINAL_PROFILE_PALETTE_KEY,
+                         (const char * const *) strv);
+    g_strfreev (strv);
+  }
+
+  if (value)
+    gconf_value_free (value);
+}
+
 static gboolean
 migrate_global_prefs (GSettings *settings,
                       GError **error)
@@ -423,8 +448,7 @@ migrate_profile (TerminalSettingsList *list,
   migrate_genum (client, path, KEY_CURSOR_SHAPE,
                  settings, TERMINAL_PROFILE_CURSOR_SHAPE_KEY,
                  VTE_TYPE_TERMINAL_CURSOR_SHAPE);
-  migrate_string_list (client, path, KEY_PALETTE,
-                       settings, TERMINAL_PROFILE_PALETTE_KEY);
+  migrate_palette (client, path, settings);
   migrate_string (client, path, KEY_FONT,
                   settings, TERMINAL_PROFILE_FONT_KEY);
   migrate_enum (client, path, KEY_BACKSPACE_BINDING, erase_binding_pairs,
diff --git a/src/terminal-schemas.h b/src/terminal-schemas.h
index 45386a1..45051c8 100644
--- a/src/terminal-schemas.h
+++ b/src/terminal-schemas.h
@@ -22,7 +22,7 @@
 
 G_BEGIN_DECLS
 
-#define TERMINAL_SCHEMA_VERSION         (2u)
+#define TERMINAL_SCHEMA_VERSION         (3u)
 
 #define TERMINAL_KEYBINDINGS_SCHEMA     "org.gnome.Terminal.Legacy.Keybindings"
 #define TERMINAL_PROFILE_SCHEMA         "org.gnome.Terminal.Legacy.Profile"


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