diff -r -u -N mhwaveedit-1.4.20/src/inifile.c mhwaveedit-1.4.20-xdgdirs/src/inifile.c
--- mhwaveedit-1.4.20/src/inifile.c	2010-07-31 09:41:33.000000000 +0200
+++ mhwaveedit-1.4.20-xdgdirs/src/inifile.c	2010-10-03 18:41:38.526220282 +0200
@@ -51,14 +51,35 @@
 void inifile_init(void)
 {
      EFILE *f;
-     gchar *c,*d,*namestart,*valuestart;
+     gchar *c,*d,*namestart,*valuestart, *oldcfgfile, *cfgfile, *cfgdir;
      size_t s = 0;
      int x;
      settings = g_hash_table_new(g_str_hash,g_str_equal);
-     c = g_strjoin(NULL,get_home_directory(),"/.mhwaveedit",NULL);
-     mkdir(c,CONFDIR_PERMISSION);
-     g_free(c);
-     ininame = g_strjoin(NULL,get_home_directory(),"/.mhwaveedit/config",NULL);
+
+     /*
+      * Migrate the config file to the appropriate XDG compliant location. This
+      * can be removed in a little while.
+      */
+
+     cfgdir = g_build_filename (g_get_user_config_dir (),
+       G_DIR_SEPARATOR_S, "mhwaveedit", NULL);
+
+     cfgfile = g_build_filename (cfgdir,
+       G_DIR_SEPARATOR_S, "config", NULL);
+
+     oldcfgfile = g_build_filename (g_get_home_dir (),
+       G_DIR_SEPARATOR_S, ".mhwaveedit",
+       G_DIR_SEPARATOR_S, "config", NULL);
+
+     if (!g_file_test (cfgdir, G_FILE_TEST_IS_DIR))		 
+       g_mkdir (cfgdir, CONFDIR_PERMISSION);
+
+     if (g_file_test (oldcfgfile, G_FILE_TEST_EXISTS) &&
+         !g_file_test (cfgfile, G_FILE_TEST_EXISTS))
+       ininame = oldcfgfile;
+     else
+       ininame = cfgfile;
+		      
      if (!file_exists(ininame)) return;
      f = e_fopen(ininame,EFILE_READ);
      if (!f) return;
@@ -103,6 +124,12 @@
      }
      e_fclose(f);
      g_free(c);
+
+		 ininame = g_strdup(cfgfile);
+
+		 g_free (oldcfgfile);
+		 g_free (cfgfile);
+		 g_free (cfgdir);
 }
 
 gchar *inifile_get(gchar *setting, gchar *defaultValue)
diff -r -u -N mhwaveedit-1.4.20/src/main.h mhwaveedit-1.4.20-xdgdirs/src/main.h
--- mhwaveedit-1.4.20/src/main.h	2010-07-31 09:41:33.000000000 +0200
+++ mhwaveedit-1.4.20-xdgdirs/src/main.h	2010-10-03 18:41:01.634223704 +0200
@@ -58,8 +58,8 @@
 /* Global stuff */
 #define PROGRAM_VERSION_STRING PACKAGE " " VERSION
 
-/* Permissions for creating ~/.mhwaveedit directory */
-#define CONFDIR_PERMISSION 0755
+/* Permissions for creating the config directory */
+#define CONFDIR_PERMISSION 0700
 
 /* Various portability stuff */
 #ifndef HAVE_CEILL
diff -r -u -N mhwaveedit-1.4.20/src/session.c mhwaveedit-1.4.20-xdgdirs/src/session.c
--- mhwaveedit-1.4.20/src/session.c	2010-07-31 09:41:33.000000000 +0200
+++ mhwaveedit-1.4.20-xdgdirs/src/session.c	2010-10-03 18:41:57.610222866 +0200
@@ -80,12 +80,18 @@
      struct stat st;
      GList *list,*list2;
      gboolean b;
+
      /* Check for session files on the system */
-     session_dir = g_strjoin(NULL,get_home_directory(),"/.mhwaveedit",NULL);
+     session_dir = g_build_filename (g_get_user_data_dir(),
+                   G_DIR_SEPARATOR_S, "mhwaveedit", NULL);     
+
+     if(!g_file_test (session_dir, G_FILE_TEST_IS_DIR))
+       g_mkdir (session_dir, CONFDIR_PERMISSION);
+
      d = opendir(session_dir);
      if (d == NULL) {
-	  user_perror(_("Error opening session directory"));
-	  return;
+       user_perror(_("Error opening session directory"));
+       return;
      }
      while (1) {
 	  de = readdir(d);
diff -r -u -N mhwaveedit-1.4.20/src/tempfile.c mhwaveedit-1.4.20-xdgdirs/src/tempfile.c
--- mhwaveedit-1.4.20/src/tempfile.c	2010-07-31 09:41:33.000000000 +0200
+++ mhwaveedit-1.4.20-xdgdirs/src/tempfile.c	2010-10-03 18:44:22.396229501 +0200
@@ -238,8 +238,10 @@
 	       if (c==NULL) c=getenv("TMP");
 	       if (try_tempdir(c)) 
 		    tempdirs = g_list_append(tempdirs,g_strdup(c));
-	       c = g_strjoin("/",get_home_directory(),".mhwaveedit",NULL);
-	       mkdir(c,CONFDIR_PERMISSION);
+        c = g_build_filename (g_get_user_data_dir(),
+            G_DIR_SEPARATOR_S, "mhwaveedit", NULL);
+        if (!g_file_test (c, G_FILE_TEST_IS_DIR))
+          g_mkdir(c,CONFDIR_PERMISSION);
 	       if (try_tempdir(c))
 		    tempdirs = g_list_append(tempdirs,g_strdup(c));
 	  } else {
