[gnome-control-center] Use XDG user and system data dirs to load backgrounds



commit d6c117c9ebbf0b1d6df65d17ef07ee128b1fdacf
Author: William Jon McCann <jmccann redhat com>
Date:   Tue Sep 1 19:00:12 2009 -0400

    Use XDG user and system data dirs to load backgrounds

 capplets/appearance/gnome-wp-xml.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/capplets/appearance/gnome-wp-xml.c b/capplets/appearance/gnome-wp-xml.c
index 9d2613d..5ecea04 100644
--- a/capplets/appearance/gnome-wp-xml.c
+++ b/capplets/appearance/gnome-wp-xml.c
@@ -336,9 +336,9 @@ static void gnome_wp_xml_load_from_dir (const gchar *path,
 }
 
 void gnome_wp_xml_load_list (AppearanceData *data) {
-  const gchar * xdgdirslist;
+  const char * const *system_data_dirs;
+  gchar * datadir;
   gchar * wpdbfile;
-  gchar ** xdgdirs;
   gint i;
 
   wpdbfile = g_build_filename (g_get_home_dir (),
@@ -360,20 +360,20 @@ void gnome_wp_xml_load_list (AppearanceData *data) {
   }
   g_free (wpdbfile);
 
-  xdgdirslist = g_getenv ("XDG_DATA_DIRS");
-  if (xdgdirslist == NULL || strcmp (xdgdirslist, "") == 0)
-    xdgdirslist = "/usr/local/share:/usr/share";
+  datadir = g_build_filename (g_get_user_data_dir (),
+                              "gnome-background-properties",
+                              NULL);
+  gnome_wp_xml_load_from_dir (datadir, data);
+  g_free (datadir);
 
-  xdgdirs = g_strsplit (xdgdirslist, ":", -1);
-  for (i = 0; xdgdirs && xdgdirs[i]; i++) {
-    gchar * datadir;
-
-    datadir = g_build_filename (xdgdirs[i], "gnome-background-properties",
+  system_data_dirs = g_get_system_data_dirs ();
+  for (i = 0; system_data_dirs[i]; i++) {
+    datadir = g_build_filename (system_data_dirs[i],
+                                "gnome-background-properties",
 				NULL);
     gnome_wp_xml_load_from_dir (datadir, data);
     g_free (datadir);
   }
-  g_strfreev (xdgdirs);
 
   gnome_wp_xml_load_from_dir (WALLPAPER_DATADIR, data);
 



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