Index: gnome-settings-font.c
===================================================================
--- gnome-settings-font.c	(revision 7414)
+++ gnome-settings-font.c	(working copy)
@@ -54,34 +54,18 @@ load_cursor (GConfClient *client)
   struct dirent *file_dirent;
   gchar *cursor_font;
   gchar **font_path;
-  gchar **new_font_path;
   gint n_fonts;
   gint new_n_fonts;
   gint i;
-  gchar *mkfontdir_cmd;
+  gchar *mkfontdir_argv[4];
 
   /* setting up the dir */
   font_dir_name = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2/share/fonts", NULL);
   if (! g_file_test (font_dir_name, G_FILE_TEST_EXISTS))
     {
-      if (g_mkdir_with_parents (font_dir_name, 0755) != 0)
-        {
-          GtkWidget *dialog;
-
-	  dialog = gtk_message_dialog_new (NULL,
-					   0,
-					   GTK_MESSAGE_ERROR,
-					   GTK_BUTTONS_CLOSE,
-					   _("Cannot create the directory \"%s\".\n"\
-					     "This is needed to allow changing the mouse pointer theme."),
-					   font_dir_name);
-	  g_signal_connect (dialog, "response",
-			    G_CALLBACK (gtk_widget_destroy), NULL);
-	  gnome_settings_delayed_show_dialog (dialog);
-	  g_free (font_dir_name);
-
-	  return;
-	}
+      /* this directory is obsolete, so we don't care if it is not available */
+      g_free (font_dir_name);
+      font_dir_name = NULL;
     }
 
   dir_name = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2/share/cursor-fonts", NULL);
@@ -102,6 +86,7 @@ load_cursor (GConfClient *client)
 			    G_CALLBACK (gtk_widget_destroy), NULL);
 	  gnome_settings_delayed_show_dialog (dialog);
 	  g_free (dir_name);
+	  g_free (font_dir_name);
 
 	  return;
 	}
@@ -148,50 +133,50 @@ load_cursor (GConfClient *client)
 
 
   /* run mkfontdir */
-  mkfontdir_cmd = g_strdup_printf ("mkfontdir %s %s", dir_name, font_dir_name);
-  /* maybe check for error...
-   * also, it's not going to like that if there are spaces in dir_name/font_dir_name.
-   */
-  g_spawn_command_line_sync (mkfontdir_cmd, NULL, NULL, NULL, NULL);
-  g_free (mkfontdir_cmd);
+  mkfontdir_argv[0] = "mkfontdir";
+  mkfontdir_argv[1] = dir_name;
+  mkfontdir_argv[2] = font_dir_name;
+  mkfontdir_argv[3] = NULL;
+  /* maybe check for error... */
+  g_spawn_sync (NULL, mkfontdir_argv, NULL, G_SPAWN_SEARCH_PATH,
+                NULL, NULL, NULL, NULL, NULL, NULL);
 
   /* Set the font path */
   font_path = XGetFontPath (gdk_x11_get_default_xdisplay (), &n_fonts);
   new_n_fonts = n_fonts;
   if (n_fonts == 0 || strcmp (font_path[0], dir_name))
     new_n_fonts++;
-  if (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))
+  if (font_dir_name &&
+      (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name)))
     new_n_fonts++;
 
-  new_font_path = g_new0 (gchar*, new_n_fonts);
-  if (n_fonts == 0 || strcmp (font_path[0], dir_name))
-    {
-      new_font_path[0] = dir_name;
-      for (i = 0; i < n_fonts; i++)
-	new_font_path [i+1] = font_path [i];
-    }
-  else
+  if (n_fonts < new_n_fonts)
     {
+      gchar **new_font_path = g_new (gchar *, new_n_fonts);
+      gint j = 0;
+
+      if (n_fonts == 0 || strcmp (font_path[0], dir_name))
+        new_font_path [j++] = dir_name;
+ 
       for (i = 0; i < n_fonts; i++)
-	new_font_path [i] = font_path [i];
-    }
+        new_font_path [i+j] = font_path [i];
 
-  if (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))
-    {
-      new_font_path[new_n_fonts-1] = font_dir_name;
-    }
+      if (font_dir_name &&
+          (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name)))
+        new_font_path[new_n_fonts-1] = font_dir_name;
+ 
+      gdk_error_trap_push ();
+      XSetFontPath (gdk_display, new_font_path, new_n_fonts);
+      gdk_flush ();
+
+      /* if there was an error setting the new path, revert */
+      if (gdk_error_trap_pop ())
+        XSetFontPath (gdk_display, font_path, n_fonts); 
 
-  gdk_error_trap_push ();
-  XSetFontPath (gdk_display, new_font_path, new_n_fonts);
-  gdk_flush ();
-
-  /* if there was an error setting the new path, revert */
-  if (gdk_error_trap_pop ())
-    XSetFontPath (gdk_display, font_path, n_fonts); 
+      g_free (new_font_path);
+    }
 
   XFreeFontPath (font_path);
-
-  g_free (new_font_path);
   g_free (font_dir_name);
   g_free (dir_name);
 }
