diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-08-15 11:49:46 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-08-15 19:40:45 -0400 |
commit | 44e322aef6a0af4f35c1a5fb88c622634bd8bba9 (patch) | |
tree | c654fafec90bfcd1c5421cc94cecc5023ae447b4 | |
parent | e67d1582b0ddbfd191597032fee41ae9d468f2ec (diff) | |
download | gconf-44e322aef6a0af4f35c1a5fb88c622634bd8bba9.tar.gz |
GSettings migration: add --file argument
Add a --file commandline argument to request running conversions from
an extra file (in addition to the normal conversions).
-rw-r--r-- | gsettings/gsettings-data-convert.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gsettings/gsettings-data-convert.c b/gsettings/gsettings-data-convert.c index 14ef3d05..b529476a 100644 --- a/gsettings/gsettings-data-convert.c +++ b/gsettings/gsettings-data-convert.c @@ -531,9 +531,11 @@ main (int argc, char *argv[]) GError *error; GHashTable *converted; GOptionContext *context; + const gchar *extra_file = NULL; GOptionEntry entries[] = { { "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, "show verbose messages", NULL }, { "dry-run", 0, 0, G_OPTION_ARG_NONE, &dry_run, "do not perform any changes", NULL }, + { "file", 0, 0, G_OPTION_ARG_STRING, &extra_file, "perform conversions from an extra file", NULL }, { NULL } }; @@ -555,6 +557,31 @@ main (int argc, char *argv[]) converted = load_state (&stored_mtime); + if (extra_file) + { + gchar *base; + + base = g_path_get_basename (extra_file); + + if (g_hash_table_lookup (converted, base)) + { + if (verbose) + g_print ("'%s' is already converted. Skipping.\n", base); + } + else + { + if (handle_file (extra_file)) + { + gchar *myname = g_strdup (base); + + g_hash_table_insert (converted, myname, myname); + changed = TRUE; + } + } + + g_free (base); + } + data_dirs = g_get_system_data_dirs (); for (i = 0; data_dirs[i]; i++) { |