[gconf/migration-changes: 7/7] GSettings migration: add --file argument



commit dc004cac68af221b8a098746b1cd0e2a7685ddbd
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Aug 15 11:49:46 2011 -0400

    GSettings migration: add --file argument
    
    Add a --file commandline argument to request running conversions from
    an extra file (in addition to the normal conversions).

 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 14ef3d0..b529476 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++)
     {



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