[gconf] GSettings migration: consult XDG_DATA_DIRS



commit e67d1582b0ddbfd191597032fee41ae9d468f2ec
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Aug 15 11:41:58 2011 -0400

    GSettings migration: consult XDG_DATA_DIRS
    
    Instead of using the hardcoded compile-time DATADIR, consult
    XDG_DATA_DIRS.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656262

 gsettings/gsettings-data-convert.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gsettings/gsettings-data-convert.c b/gsettings/gsettings-data-convert.c
index 21dcf6f..14ef3d0 100644
--- a/gsettings/gsettings-data-convert.c
+++ b/gsettings/gsettings-data-convert.c
@@ -29,8 +29,6 @@
 #include <gio/gio.h>
 #include <gconf/gconf-client.h>
 
-static const gchar convert_dir[] = DATADIR "/GConf/gsettings";
-
 static gboolean changed = FALSE;
 static gboolean verbose = FALSE;
 static gboolean dry_run = FALSE;
@@ -528,6 +526,8 @@ int
 main (int argc, char *argv[])
 {
   time_t stored_mtime;
+  const gchar * const *data_dirs;
+  gint i;
   GError *error;
   GHashTable *converted;
   GOptionContext *context;
@@ -555,8 +555,18 @@ main (int argc, char *argv[])
 
   converted = load_state (&stored_mtime);
 
-  if (!handle_dir (convert_dir, stored_mtime, converted))
-    return 1;
+  data_dirs = g_get_system_data_dirs ();
+  for (i = 0; data_dirs[i]; i++)
+    {
+      gchar *convert_dir;
+
+      convert_dir = g_build_filename (data_dirs[i], "GConf", "gsettings", NULL);
+
+      if (!handle_dir (convert_dir, stored_mtime, converted))
+        return 1;
+
+      g_free (convert_dir);
+    }
 
   if (changed && !dry_run)
     {



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