91ffc14
diff --git a/data/gnome-settings-daemon.schemas.in b/data/gnome-settings-daemon.schemas.in
91ffc14
index 3f6a426..9b7d711 100644
91ffc14
--- a/data/gnome-settings-daemon.schemas.in
91ffc14
+++ b/data/gnome-settings-daemon.schemas.in
91ffc14
@@ -41,7 +41,7 @@
91ffc14
       <applyto>/apps/gnome_settings_daemon/plugins/background/priority</applyto>
91ffc14
       <owner>gnome-settings-daemon</owner>
91ffc14
       <type>int</type>
91ffc14
-      <default>5</default>
91ffc14
+      <default>97</default>
91ffc14
       <locale name="C">
91ffc14
         <short></short>
91ffc14
         <long></long>
91ffc14
@@ -64,7 +64,7 @@
91ffc14
       <applyto>/apps/gnome_settings_daemon/plugins/clipboard/priority</applyto>
91ffc14
       <owner>gnome-settings-daemon</owner>
91ffc14
       <type>int</type>
91ffc14
-      <default>100</default>
91ffc14
+      <default>99</default>
91ffc14
       <locale name="C">
91ffc14
         <short></short>
91ffc14
         <long></long>
91ffc14
@@ -179,7 +179,7 @@
91ffc14
       <applyto>/apps/gnome_settings_daemon/plugins/media-keys/priority</applyto>
91ffc14
       <owner>gnome-settings-daemon</owner>
91ffc14
       <type>int</type>
91ffc14
-      <default>20</default>
91ffc14
+      <default>98</default>
91ffc14
       <locale name="C">
91ffc14
         <short></short>
91ffc14
         <long></long>
91ffc14
@@ -306,7 +306,7 @@
91ffc14
       <applyto>/apps/gnome_settings_daemon/plugins/xrdb/active</applyto>
91ffc14
       <owner>gnome-settings-daemon</owner>
91ffc14
       <type>bool</type>
91ffc14
-      <default>TRUE</default>
91ffc14
+      <default>FALSE</default>
91ffc14
       <locale name="C">
91ffc14
         <short>Enable xrdb plugin</short>
91ffc14
         <long>Set to True to enable the plugin to manage xrdb settings.</long>
91ffc14
diff --git a/gnome-settings-daemon/gnome-settings-manager.c b/gnome-settings-daemon/gnome-settings-manager.c
91ffc14
index 0bc3f61..475c883 100644
91ffc14
--- a/gnome-settings-daemon/gnome-settings-manager.c
91ffc14
+++ b/gnome-settings-daemon/gnome-settings-manager.c
91ffc14
@@ -49,6 +49,7 @@
91ffc14
 struct GnomeSettingsManagerPrivate
91ffc14
 {
91ffc14
         DBusGConnection            *connection;
91ffc14
+        GConfClient                *gconf_client;
91ffc14
         char                       *settings_prefix;
91ffc14
         GSList                     *plugins;
91ffc14
 };
91ffc14
@@ -157,24 +158,21 @@ _load_file (GnomeSettingsManager *manager,
91ffc14
 {
91ffc14
         GnomeSettingsPluginInfo *info;
91ffc14
         char                    *key_name;
91ffc14
-        GConfClient             *client;
91ffc14
         int                      priority;
91ffc14
         GError                  *error;
91ffc14
         GSList                  *l;
91ffc14
 
91ffc14
         g_debug ("Loading plugin: %s", filename);
91ffc14
-        gnome_settings_profile_start (NULL);
91ffc14
+        gnome_settings_profile_start ("%s", filename);
91ffc14
 
91ffc14
         info = gnome_settings_plugin_info_new_from_file (filename);
91ffc14
         if (info == NULL) {
91ffc14
                 goto out;
91ffc14
         }
91ffc14
 
91ffc14
-        gnome_settings_profile_start ("seeing if already loaded");
91ffc14
         l = g_slist_find_custom (manager->priv->plugins,
91ffc14
                                  info,
91ffc14
                                  (GCompareFunc) compare_location);
91ffc14
-        gnome_settings_profile_end ("seeing if already loaded");
91ffc14
         if (l != NULL) {
91ffc14
                 goto out;
91ffc14
         }
91ffc14
@@ -187,21 +185,17 @@ _load_file (GnomeSettingsManager *manager,
91ffc14
         g_signal_connect (info, "deactivated",
91ffc14
                           G_CALLBACK (on_plugin_deactivated), manager);
91ffc14
 
91ffc14
-        gnome_settings_profile_start ("setting active property");
91ffc14
         key_name = g_strdup_printf ("%s/%s/active",
91ffc14
                                     manager->priv->settings_prefix,
91ffc14
                                     gnome_settings_plugin_info_get_location (info));
91ffc14
         gnome_settings_plugin_info_set_enabled_key_name (info, key_name);
91ffc14
         g_free (key_name);
91ffc14
-        gnome_settings_profile_end ("setting active property");
91ffc14
 
91ffc14
-        gnome_settings_profile_start ("setting priority property");
91ffc14
         key_name = g_strdup_printf ("%s/%s/priority",
91ffc14
                                     manager->priv->settings_prefix,
91ffc14
                                     gnome_settings_plugin_info_get_location (info));
91ffc14
-        client = gconf_client_get_default ();
91ffc14
         error = NULL;
91ffc14
-        priority = gconf_client_get_int (client, key_name, &error);
91ffc14
+        priority = gconf_client_get_int (manager->priv->gconf_client, key_name, &error);
91ffc14
         if (error == NULL) {
91ffc14
                 if (priority > 0) {
91ffc14
                         gnome_settings_plugin_info_set_priority (info, priority);
91ffc14
@@ -210,15 +204,13 @@ _load_file (GnomeSettingsManager *manager,
91ffc14
                 g_error_free (error);
91ffc14
         }
91ffc14
         g_free (key_name);
91ffc14
-        g_object_unref (client);
91ffc14
-        gnome_settings_profile_end ("setting priority property");
91ffc14
 
91ffc14
  out:
91ffc14
         if (info != NULL) {
91ffc14
                 g_object_unref (info);
91ffc14
         }
91ffc14
 
91ffc14
-        gnome_settings_profile_end (NULL);
91ffc14
+        gnome_settings_profile_end ("%s", filename);
91ffc14
 }
91ffc14
 
91ffc14
 static void
91ffc14
@@ -345,6 +337,15 @@ gnome_settings_manager_start (GnomeSettingsManager *manager,
91ffc14
                 goto out;
91ffc14
         }
91ffc14
 
91ffc14
+        manager->priv->gconf_client = gconf_client_get_default ();
91ffc14
+
91ffc14
+        gnome_settings_profile_start ("preloading gconf keys");
91ffc14
+        gconf_client_add_dir (manager->priv->gconf_client,
91ffc14
+                              manager->priv->settings_prefix,
91ffc14
+                              GCONF_CLIENT_PRELOAD_RECURSIVE,
91ffc14
+                              NULL);
91ffc14
+        gnome_settings_profile_end ("preloading gconf keys");
91ffc14
+
91ffc14
         _load_all (manager);
91ffc14
 
91ffc14
         ret = TRUE;
91ffc14
@@ -379,6 +380,12 @@ gnome_settings_manager_stop (GnomeSettingsManager *manager)
91ffc14
 #endif
91ffc14
 
91ffc14
         _unload_all (manager);
91ffc14
+
91ffc14
+        gconf_client_remove_dir (manager->priv->gconf_client,
91ffc14
+                                 manager->priv->settings_prefix,
91ffc14
+                                 NULL);
91ffc14
+        g_object_unref (manager->priv->gconf_client);
91ffc14
+        manager->priv->gconf_client = NULL;
91ffc14
 }
91ffc14
 
91ffc14
 static void
91ffc14
diff --git a/gnome-settings-daemon/gnome-settings-plugin-info.c b/gnome-settings-daemon/gnome-settings-plugin-info.c
91ffc14
index 983a3e1..a4a10a8 100644
91ffc14
--- a/gnome-settings-daemon/gnome-settings-plugin-info.c
91ffc14
+++ b/gnome-settings-daemon/gnome-settings-plugin-info.c
91ffc14
@@ -185,7 +185,7 @@ gnome_settings_plugin_info_fill_from_file (GnomeSettingsPluginInfo *info,
91ffc14
         int       priority;
91ffc14
         gboolean  ret;
91ffc14
 
91ffc14
-        gnome_settings_profile_start (NULL);
91ffc14
+        gnome_settings_profile_start ("%s", filename);
91ffc14
 
91ffc14
         ret = FALSE;
91ffc14
 
91ffc14
@@ -290,7 +290,7 @@ gnome_settings_plugin_info_fill_from_file (GnomeSettingsPluginInfo *info,
91ffc14
 
91ffc14
         ret = TRUE;
91ffc14
  out:
91ffc14
-        gnome_settings_profile_end (NULL);
91ffc14
+        gnome_settings_profile_end ("%s", filename);
91ffc14
 
91ffc14
         return ret;
91ffc14
 }
91ffc14
@@ -312,15 +312,6 @@ void
91ffc14
 gnome_settings_plugin_info_set_enabled_key_name (GnomeSettingsPluginInfo *info,
91ffc14
                                                  const char              *key_name)
91ffc14
 {
91ffc14
-        char *dirname;
91ffc14
-
91ffc14
-        dirname = g_path_get_dirname (key_name);
91ffc14
-        if (dirname != NULL) {
91ffc14
-                g_debug ("Monitoring dir %s for changes", dirname);
91ffc14
-                gconf_client_add_dir (info->priv->client, dirname, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
-                g_free (dirname);
91ffc14
-        }
91ffc14
-
91ffc14
         info->priv->enabled_notification_id = gconf_client_notify_add (info->priv->client,
91ffc14
                                                                        key_name,
91ffc14
                                                                        (GConfClientNotifyFunc)plugin_enabled_cb,
91ffc14
@@ -388,7 +379,7 @@ load_plugin_module (GnomeSettingsPluginInfo *info)
91ffc14
         g_return_val_if_fail (info->priv->plugin == NULL, FALSE);
91ffc14
         g_return_val_if_fail (info->priv->available, FALSE);
91ffc14
 
91ffc14
-        gnome_settings_profile_start (NULL);
91ffc14
+        gnome_settings_profile_start ("%s", info->priv->location);
91ffc14
 
91ffc14
         switch (info->priv->loader) {
91ffc14
                 case GNOME_SETTINGS_PLUGIN_LOADER_C:
91ffc14
@@ -484,7 +475,7 @@ load_plugin_module (GnomeSettingsPluginInfo *info)
91ffc14
         g_type_module_unuse (info->priv->module);
91ffc14
         ret = TRUE;
91ffc14
  out:
91ffc14
-        gnome_settings_profile_end (NULL);
91ffc14
+        gnome_settings_profile_end ("%s", info->priv->location);
91ffc14
         return ret;
91ffc14
 }
91ffc14
 
91ffc14
diff --git a/gnome-settings-daemon/main.c b/gnome-settings-daemon/main.c
91ffc14
index b4c43d2..c96381b 100644
91ffc14
--- a/gnome-settings-daemon/main.c
91ffc14
+++ b/gnome-settings-daemon/main.c
91ffc14
@@ -24,6 +24,9 @@
91ffc14
 #include <libintl.h>
91ffc14
 #include <errno.h>
91ffc14
 #include <locale.h>
91ffc14
+#include <signal.h>
91ffc14
+#include <fcntl.h>
91ffc14
+#include <sys/wait.h>
91ffc14
 
91ffc14
 #include <glib/gi18n.h>
91ffc14
 #include <glib/gstdio.h>
91ffc14
@@ -44,6 +47,7 @@
91ffc14
 static char      *gconf_prefix = NULL;
91ffc14
 static gboolean   no_daemon    = FALSE;
91ffc14
 static gboolean   debug        = FALSE;
91ffc14
+static int        pipefds[2];
91ffc14
 
91ffc14
 static GOptionEntry entries[] = {
91ffc14
         {"debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
91ffc14
@@ -187,10 +191,10 @@ set_session_over_handler (DBusGConnection *bus, GnomeSettingsManager *manager)
91ffc14
                                             GNOME_SESSION_DBUS_OBJECT,
91ffc14
                                             GNOME_SESSION_DBUS_INTERFACE);
91ffc14
 
91ffc14
-	dbus_g_object_register_marshaller (
91ffc14
-		g_cclosure_marshal_VOID__VOID,
91ffc14
-		G_TYPE_NONE,
91ffc14
-		G_TYPE_INVALID);
91ffc14
+        dbus_g_object_register_marshaller (
91ffc14
+                g_cclosure_marshal_VOID__VOID,
91ffc14
+                G_TYPE_NONE,
91ffc14
+                G_TYPE_INVALID);
91ffc14
 
91ffc14
         dbus_g_proxy_add_signal (session_proxy,
91ffc14
                                  "SessionOver",
91ffc14
@@ -223,6 +227,119 @@ gsd_log_default_handler (const gchar   *log_domain,
91ffc14
                                unused_data);
91ffc14
 }
91ffc14
 
91ffc14
+
91ffc14
+/* We want the parent process to quit after initializing all plugins,
91ffc14
+ * but we have to do all the work in the child process.  We can't
91ffc14
+ * initialize in parent and then fork here: that is not clean with
91ffc14
+ * X display and DBUS where we would make the connection from one
91ffc14
+ * process and continue using it from the other. So, we just make the
91ffc14
+ * parent to fork early and wait. */
91ffc14
+
91ffc14
+static void
91ffc14
+daemon_start (void)
91ffc14
+{
91ffc14
+        int child_pid;
91ffc14
+        char buf[1];
91ffc14
+
91ffc14
+        if (no_daemon)
91ffc14
+                return;
91ffc14
+
91ffc14
+        gnome_settings_profile_msg ("forking daemon");
91ffc14
+
91ffc14
+        signal (SIGPIPE, SIG_IGN);
91ffc14
+        if (-1 == pipe (pipefds)) {
91ffc14
+                g_error ("Could not create pipe: %s", g_strerror (errno));
91ffc14
+                exit (EXIT_FAILURE);
91ffc14
+        }
91ffc14
+
91ffc14
+        child_pid = fork ();
91ffc14
+
91ffc14
+        switch (child_pid) {
91ffc14
+        case -1:
91ffc14
+                g_error ("Could not daemonize: %s", g_strerror (errno));
91ffc14
+                exit (EXIT_FAILURE);
91ffc14
+
91ffc14
+        case 0:
91ffc14
+                /* child */
91ffc14
+
91ffc14
+                close (pipefds[0]);
91ffc14
+
91ffc14
+                return;
91ffc14
+
91ffc14
+         default:
91ffc14
+                /* parent */
91ffc14
+
91ffc14
+                close (pipefds[1]);
91ffc14
+
91ffc14
+                /* Wait for child to signal that we are good to go. */
91ffc14
+                read (pipefds[0], buf, 1);
91ffc14
+
91ffc14
+                exit (EXIT_SUCCESS);
91ffc14
+        }
91ffc14
+}
91ffc14
+
91ffc14
+static void
91ffc14
+daemon_detach (void)
91ffc14
+{
91ffc14
+        if (no_daemon)
91ffc14
+                return;
91ffc14
+
91ffc14
+        gnome_settings_profile_msg ("detaching daemon");
91ffc14
+
91ffc14
+        /* disconnect */
91ffc14
+        setsid ();
91ffc14
+        close (0);
91ffc14
+        close (1);
91ffc14
+        open ("/dev/null", O_RDONLY);
91ffc14
+        open ("/dev/null", O_WRONLY);
91ffc14
+
91ffc14
+        /* get outta the way */
91ffc14
+        chdir ("/");
91ffc14
+        umask (0117);
91ffc14
+}
91ffc14
+
91ffc14
+static void
91ffc14
+daemon_terminate_parent (void)
91ffc14
+{
91ffc14
+        if (no_daemon)
91ffc14
+                return;
91ffc14
+
91ffc14
+        gnome_settings_profile_msg ("terminating parent");
91ffc14
+
91ffc14
+        write (pipefds[1], "1", 1);
91ffc14
+        close (pipefds[1]);
91ffc14
+}
91ffc14
+
91ffc14
+static void
91ffc14
+parse_args (int *argc, char ***argv)
91ffc14
+{
91ffc14
+        GError *error;
91ffc14
+        GOptionContext *context;
91ffc14
+
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+
91ffc14
+        context = g_option_context_new (NULL);
91ffc14
+
91ffc14
+        g_option_context_add_main_entries (context, entries, NULL);
91ffc14
+        g_option_context_add_group (context, gtk_get_option_group (FALSE));
91ffc14
+
91ffc14
+        error = NULL;
91ffc14
+        if (!g_option_context_parse (context, argc, argv, &error)) {
91ffc14
+                if (error != NULL) {
91ffc14
+                        g_warning ("%s", error->message);
91ffc14
+                        g_error_free (error);
91ffc14
+                } else {
91ffc14
+                        g_warning ("Unable to initialize GTK+");
91ffc14
+                }
91ffc14
+                exit (EXIT_FAILURE);
91ffc14
+        }
91ffc14
+
91ffc14
+        g_option_context_free (context);
91ffc14
+
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+}
91ffc14
+
91ffc14
 int
91ffc14
 main (int argc, char *argv[])
91ffc14
 {
91ffc14
@@ -238,29 +355,25 @@ main (int argc, char *argv[])
91ffc14
         bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR);
91ffc14
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
91ffc14
         textdomain (GETTEXT_PACKAGE);
91ffc14
-
91ffc14
         setlocale (LC_ALL, "");
91ffc14
 
91ffc14
+        parse_args (&argc, &argv);
91ffc14
+
91ffc14
+        daemon_start ();
91ffc14
+
91ffc14
         g_type_init ();
91ffc14
 
91ffc14
-        gnome_settings_profile_start ("gtk init");
91ffc14
-        error = NULL;
91ffc14
-        if (! gtk_init_with_args (&argc, &argv, NULL, entries, NULL, &error)) {
91ffc14
-                if (error != NULL) {
91ffc14
-                        g_warning (error->message);
91ffc14
-                        g_error_free (error);
91ffc14
-                } else {
91ffc14
-                        g_warning ("Unable to initialize GTK+");
91ffc14
-                }
91ffc14
-                exit (1);
91ffc14
+        gnome_settings_profile_start ("opening gtk display");
91ffc14
+        if (! gtk_init_check (NULL, NULL)) {
91ffc14
+                g_warning ("Unable to initialize GTK+");
91ffc14
+                daemon_terminate_parent ();
91ffc14
+                exit (EXIT_FAILURE);
91ffc14
         }
91ffc14
-        gnome_settings_profile_end ("gtk init");
91ffc14
+        gnome_settings_profile_end ("opening gtk display");
91ffc14
 
91ffc14
-        g_log_set_default_handler (gsd_log_default_handler, NULL);
91ffc14
+        daemon_detach ();
91ffc14
 
91ffc14
-        if (! no_daemon && daemon (0, 0)) {
91ffc14
-                g_error ("Could not daemonize: %s", g_strerror (errno));
91ffc14
-        }
91ffc14
+        g_log_set_default_handler (gsd_log_default_handler, NULL);
91ffc14
 
91ffc14
         bus = get_session_bus ();
91ffc14
         if (bus == NULL) {
91ffc14
@@ -298,6 +411,8 @@ main (int argc, char *argv[])
91ffc14
                 }
91ffc14
         }
91ffc14
 
91ffc14
+        daemon_terminate_parent ();
91ffc14
+
91ffc14
         gtk_main ();
91ffc14
 
91ffc14
  out:
91ffc14
diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
91ffc14
index eaea1a3..3a990db 100644
91ffc14
--- a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
91ffc14
+++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
91ffc14
@@ -71,15 +71,10 @@ struct GsdA11yKeyboardManagerPrivate
91ffc14
 #endif /* HAVE_LIBNOTIFY */
91ffc14
 };
91ffc14
 
91ffc14
-#define GSD_KBD_A11Y_ERROR gsd_kbd_a11y_error_quark ()
91ffc14
-
91ffc14
-enum {
91ffc14
-        GSD_KBD_A11Y_ERROR_NOT_AVAILABLE
91ffc14
-};
91ffc14
-
91ffc14
 static void     gsd_a11y_keyboard_manager_class_init  (GsdA11yKeyboardManagerClass *klass);
91ffc14
 static void     gsd_a11y_keyboard_manager_init        (GsdA11yKeyboardManager      *a11y_keyboard_manager);
91ffc14
 static void     gsd_a11y_keyboard_manager_finalize    (GObject             *object);
91ffc14
+static void     gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager);
91ffc14
 
91ffc14
 G_DEFINE_TYPE (GsdA11yKeyboardManager, gsd_a11y_keyboard_manager, G_TYPE_OBJECT)
91ffc14
 
91ffc14
@@ -92,19 +87,12 @@ static gpointer manager_object = NULL;
91ffc14
 #define d(str)          do { } while (0)
91ffc14
 #endif
91ffc14
 
91ffc14
-static GQuark
91ffc14
-gsd_kbd_a11y_error_quark (void)
91ffc14
-{
91ffc14
-        return g_quark_from_static_string ("gsd-kbd-a11y-error-quark");
91ffc14
-}
91ffc14
-
91ffc14
 static gboolean
91ffc14
 xkb_enabled (GsdA11yKeyboardManager *manager)
91ffc14
 {
91ffc14
         gboolean have_xkb;
91ffc14
         int opcode, errorBase, major, minor;
91ffc14
 
91ffc14
-        gdk_error_trap_push ();
91ffc14
         have_xkb = XkbQueryExtension (GDK_DISPLAY (),
91ffc14
                                       &opcode,
91ffc14
                                       &manager->priv->xkbEventBase,
91ffc14
@@ -112,8 +100,6 @@ xkb_enabled (GsdA11yKeyboardManager *manager)
91ffc14
                                       &major,
91ffc14
                                       &minor)
91ffc14
                 && XkbUseExtension (GDK_DISPLAY (), &major, &minor);
91ffc14
-        XSync (GDK_DISPLAY (), FALSE);
91ffc14
-        gdk_error_trap_pop ();
91ffc14
 
91ffc14
         return have_xkb;
91ffc14
 }
91ffc14
@@ -130,7 +116,6 @@ get_xkb_desc_rec (GsdA11yKeyboardManager *manager)
91ffc14
                 desc->ctrls = NULL;
91ffc14
                 status = XkbGetControls (GDK_DISPLAY (), XkbAllControlsMask, desc);
91ffc14
         }
91ffc14
-        XSync (GDK_DISPLAY (), FALSE);
91ffc14
         gdk_error_trap_pop ();
91ffc14
 
91ffc14
         g_return_val_if_fail (desc != NULL, NULL);
91ffc14
@@ -449,6 +434,10 @@ maybe_show_status_icon (GsdA11yKeyboardManager *manager)
91ffc14
         show = gconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL);
91ffc14
         g_object_unref (client);
91ffc14
 
91ffc14
+        if (!show && manager->priv->status_icon == NULL)
91ffc14
+                return;
91ffc14
+
91ffc14
+        gsd_a11y_keyboard_manager_ensure_status_icon (manager);
91ffc14
         gtk_status_icon_set_visible (manager->priv->status_icon, show);
91ffc14
 }
91ffc14
 
91ffc14
@@ -538,7 +527,7 @@ ax_slowkeys_warning_post_bubble (GsdA11yKeyboardManager *manager,
91ffc14
         message = _("You just held down the Shift key for 8 seconds.  This is the shortcut "
91ffc14
                     "for the Slow Keys feature, which affects the way your keyboard works.");
91ffc14
 
91ffc14
-        if (! gtk_status_icon_is_embedded (manager->priv->status_icon)) {
91ffc14
+        if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) {
91ffc14
                 return FALSE;
91ffc14
         }
91ffc14
 
91ffc14
@@ -553,6 +542,7 @@ ax_slowkeys_warning_post_bubble (GsdA11yKeyboardManager *manager,
91ffc14
                 manager->priv->notification = NULL;
91ffc14
         }
91ffc14
 
91ffc14
+        gsd_a11y_keyboard_manager_ensure_status_icon (manager);
91ffc14
         manager->priv->notification = notify_notification_new_with_status_icon (title,
91ffc14
                                                                                 message,
91ffc14
                                                                                 "preferences-desktop-accessibility",
91ffc14
@@ -681,7 +671,7 @@ ax_stickykeys_warning_post_bubble (GsdA11yKeyboardManager *manager,
91ffc14
                 _("You just pressed two keys at once, or pressed the Shift key 5 times in a row.  "
91ffc14
                   "This turns off the Sticky Keys feature, which affects the way your keyboard works.");
91ffc14
 
91ffc14
-        if (! gtk_status_icon_is_embedded (manager->priv->status_icon)) {
91ffc14
+        if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) {
91ffc14
                 return FALSE;
91ffc14
         }
91ffc14
 
91ffc14
@@ -696,6 +686,7 @@ ax_stickykeys_warning_post_bubble (GsdA11yKeyboardManager *manager,
91ffc14
                 manager->priv->notification = NULL;
91ffc14
         }
91ffc14
 
91ffc14
+        gsd_a11y_keyboard_manager_ensure_status_icon (manager);
91ffc14
         manager->priv->notification = notify_notification_new_with_status_icon (title,
91ffc14
                                                                                 message,
91ffc14
                                                                                 "preferences-desktop-accessibility",
91ffc14
@@ -997,27 +988,21 @@ register_config_callback (GsdA11yKeyboardManager  *manager,
91ffc14
                           GConfClientNotifyFunc    func,
91ffc14
                           guint                   *notify)
91ffc14
 {
91ffc14
-        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
91ffc14
+        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
         *notify = gconf_client_notify_add (client, path, func, manager, NULL, NULL);
91ffc14
 }
91ffc14
 
91ffc14
-gboolean
91ffc14
-gsd_a11y_keyboard_manager_start (GsdA11yKeyboardManager *manager,
91ffc14
-                                 GError                **error)
91ffc14
+static gboolean
91ffc14
+start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager)
91ffc14
 {
91ffc14
         guint        event_mask;
91ffc14
         GConfClient *client;
91ffc14
-        gboolean     ret = FALSE;
91ffc14
 
91ffc14
         g_debug ("Starting a11y_keyboard manager");
91ffc14
         gnome_settings_profile_start (NULL);
91ffc14
 
91ffc14
-        if (!xkb_enabled (manager)) {
91ffc14
-                g_set_error (error, GSD_KBD_A11Y_ERROR,
91ffc14
-                             GSD_KBD_A11Y_ERROR_NOT_AVAILABLE,
91ffc14
-                             "XKB functionality is disabled.");
91ffc14
+        if (!xkb_enabled (manager))
91ffc14
                 goto out;
91ffc14
-        }
91ffc14
 
91ffc14
         client = gconf_client_get_default ();
91ffc14
 
91ffc14
@@ -1036,26 +1021,35 @@ gsd_a11y_keyboard_manager_start (GsdA11yKeyboardManager *manager,
91ffc14
         set_server_from_gconf (manager, client);
91ffc14
         g_object_unref (client);
91ffc14
 
91ffc14
-        gdk_error_trap_push ();
91ffc14
         XkbSelectEvents (GDK_DISPLAY (),
91ffc14
                          XkbUseCoreKbd,
91ffc14
                          event_mask,
91ffc14
                          event_mask);
91ffc14
 
91ffc14
-        XSync (GDK_DISPLAY (), FALSE);
91ffc14
-        gdk_error_trap_pop ();
91ffc14
-
91ffc14
         gdk_window_add_filter (NULL,
91ffc14
                                (GdkFilterFunc) cb_xkb_event_filter,
91ffc14
                                manager);
91ffc14
 
91ffc14
         maybe_show_status_icon (manager);
91ffc14
 
91ffc14
-        ret = TRUE;
91ffc14
-
91ffc14
  out:
91ffc14
         gnome_settings_profile_end (NULL);
91ffc14
-        return ret;
91ffc14
+
91ffc14
+        return FALSE;
91ffc14
+}
91ffc14
+
91ffc14
+
91ffc14
+gboolean
91ffc14
+gsd_a11y_keyboard_manager_start (GsdA11yKeyboardManager *manager,
91ffc14
+                                 GError                **error)
91ffc14
+{
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+        g_idle_add ((GSourceFunc) start_a11y_keyboard_idle_cb, manager);
91ffc14
+
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+
91ffc14
+        return TRUE;
91ffc14
 }
91ffc14
 
91ffc14
 void
91ffc14
@@ -1065,7 +1059,8 @@ gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager)
91ffc14
 
91ffc14
         g_debug ("Stopping a11y_keyboard manager");
91ffc14
 
91ffc14
-        gtk_status_icon_set_visible (manager->priv->status_icon, FALSE);
91ffc14
+        if (manager->priv->status_icon)
91ffc14
+                gtk_status_icon_set_visible (manager->priv->status_icon, FALSE);
91ffc14
 
91ffc14
         if (p->gconf_notify != 0) {
91ffc14
                 GConfClient *client = gconf_client_get_default ();
91ffc14
@@ -1199,16 +1194,27 @@ on_status_icon_activate (GtkStatusIcon          *status_icon,
91ffc14
 }
91ffc14
 
91ffc14
 static void
91ffc14
+gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager)
91ffc14
+{
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+        if (!manager->priv->status_icon) {
91ffc14
+
91ffc14
+                manager->priv->status_icon = gtk_status_icon_new_from_icon_name ("preferences-desktop-accessibility");
91ffc14
+                g_signal_connect (manager->priv->status_icon,
91ffc14
+                                  "activate",
91ffc14
+                                  G_CALLBACK (on_status_icon_activate),
91ffc14
+                                  manager);
91ffc14
+        }
91ffc14
+
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+}
91ffc14
+
91ffc14
+static void
91ffc14
 gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *manager)
91ffc14
 {
91ffc14
         manager->priv = GSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE (manager);
91ffc14
 
91ffc14
-        manager->priv->status_icon = gtk_status_icon_new_from_icon_name ("preferences-desktop-accessibility");
91ffc14
-        g_signal_connect (manager->priv->status_icon,
91ffc14
-                          "activate",
91ffc14
-                          G_CALLBACK (on_status_icon_activate),
91ffc14
-                          manager);
91ffc14
-
91ffc14
 #ifdef HAVE_LIBNOTIFY
91ffc14
         notify_init ("gnome-settings-daemon");
91ffc14
 #endif /* HAVE_LIBNOTIFY */
91ffc14
diff --git a/plugins/clipboard/gsd-clipboard-manager.c b/plugins/clipboard/gsd-clipboard-manager.c
91ffc14
index 5f407df..f8cb7ec 100644
91ffc14
--- a/plugins/clipboard/gsd-clipboard-manager.c
91ffc14
+++ b/plugins/clipboard/gsd-clipboard-manager.c
91ffc14
@@ -82,13 +82,6 @@ typedef struct
91ffc14
         int         offset;
91ffc14
 } IncrConversion;
91ffc14
 
91ffc14
-#define GSD_CLIPBOARD_ERROR gsd_clipboard_error_quark ()
91ffc14
-
91ffc14
-enum {
91ffc14
-        GSD_CLIPBOARD_ERROR_RUNNING,
91ffc14
-        GSD_CLIPBOARD_ERROR_FAILED
91ffc14
-};
91ffc14
-
91ffc14
 static void     gsd_clipboard_manager_class_init  (GsdClipboardManagerClass *klass);
91ffc14
 static void     gsd_clipboard_manager_init        (GsdClipboardManager      *clipboard_manager);
91ffc14
 static void     gsd_clipboard_manager_finalize    (GObject                  *object);
91ffc14
@@ -103,12 +96,6 @@ G_DEFINE_TYPE (GsdClipboardManager, gsd_clipboard_manager, G_TYPE_OBJECT)
91ffc14
 
91ffc14
 static gpointer manager_object = NULL;
91ffc14
 
91ffc14
-static GQuark
91ffc14
-gsd_clipboard_error_quark (void)
91ffc14
-{
91ffc14
-        return g_quark_from_static_string ("gsd-clipboard-error-quark");
91ffc14
-}
91ffc14
-
91ffc14
 /* We need to use reference counting for the target data, since we may
91ffc14
  * need to keep the data around after loosing the CLIPBOARD ownership
91ffc14
  * to complete incremental transfers.
91ffc14
@@ -858,22 +845,19 @@ clipboard_manager_watch_cb (GsdClipboardManager *manager,
91ffc14
         }
91ffc14
 }
91ffc14
 
91ffc14
-gboolean
91ffc14
-gsd_clipboard_manager_start (GsdClipboardManager *manager,
91ffc14
-                             GError             **error)
91ffc14
+static gboolean
91ffc14
+start_clipboard_idle_cb (GsdClipboardManager *manager)
91ffc14
 {
91ffc14
         XClientMessageEvent xev;
91ffc14
 
91ffc14
-        g_debug ("Starting clipboard manager");
91ffc14
+
91ffc14
         gnome_settings_profile_start (NULL);
91ffc14
 
91ffc14
         init_atoms (manager->priv->display);
91ffc14
 
91ffc14
         /* check if there is a clipboard manager running */
91ffc14
         if (XGetSelectionOwner (manager->priv->display, XA_CLIPBOARD_MANAGER)) {
91ffc14
-                g_set_error (error, GSD_CLIPBOARD_ERROR,
91ffc14
-                             GSD_CLIPBOARD_ERROR_RUNNING,
91ffc14
-                             "Clipboard manager is already running.");
91ffc14
+                g_warning ("Clipboard manager is already running.");
91ffc14
                 return FALSE;
91ffc14
         }
91ffc14
 
91ffc14
@@ -929,15 +913,23 @@ gsd_clipboard_manager_start (GsdClipboardManager *manager,
91ffc14
                                             0,
91ffc14
                                             NULL);
91ffc14
                 /* FIXME: manager->priv->terminate (manager->priv->cb_data); */
91ffc14
-
91ffc14
-                g_set_error (error, GSD_CLIPBOARD_ERROR,
91ffc14
-                             GSD_CLIPBOARD_ERROR_FAILED,
91ffc14
-                             "Failed to claim selection.");
91ffc14
-                return FALSE;
91ffc14
         }
91ffc14
 
91ffc14
         gnome_settings_profile_end (NULL);
91ffc14
 
91ffc14
+        return FALSE;
91ffc14
+}
91ffc14
+
91ffc14
+gboolean
91ffc14
+gsd_clipboard_manager_start (GsdClipboardManager *manager,
91ffc14
+                             GError             **error)
91ffc14
+{
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+        g_idle_add ((GSourceFunc) start_clipboard_idle_cb, manager);
91ffc14
+
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+
91ffc14
         return TRUE;
91ffc14
 }
91ffc14
 
91ffc14
diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c
91ffc14
index 6f47b36..cdb7605 100644
91ffc14
--- a/plugins/common/gsd-keygrab.c
91ffc14
+++ b/plugins/common/gsd-keygrab.c
91ffc14
@@ -42,7 +42,7 @@ static GdkModifierType gsd_ignored_mods = 0;
91ffc14
 static GdkModifierType gsd_used_mods = 0;
91ffc14
 
91ffc14
 static void
91ffc14
-setup_modifiers ()
91ffc14
+setup_modifiers (void)
91ffc14
 {
91ffc14
         if (gsd_used_mods == 0 || gsd_ignored_mods == 0) {
91ffc14
                 GdkModifierType dynmods;
91ffc14
@@ -67,13 +67,12 @@ setup_modifiers ()
91ffc14
 	}
91ffc14
 }
91ffc14
 
91ffc14
-static gboolean
91ffc14
+static void
91ffc14
 grab_key_real (guint      keycode,
91ffc14
                GdkWindow *root,
91ffc14
                gboolean   grab,
91ffc14
                int        mask)
91ffc14
 {
91ffc14
-        gdk_error_trap_push ();
91ffc14
         if (grab) {
91ffc14
                 XGrabKey (GDK_DISPLAY (),
91ffc14
                           keycode,
91ffc14
@@ -88,21 +87,33 @@ grab_key_real (guint      keycode,
91ffc14
                             mask,
91ffc14
                             GDK_WINDOW_XID (root));
91ffc14
         }
91ffc14
-
91ffc14
-        gdk_flush ();
91ffc14
-        return gdk_error_trap_pop () == 0;
91ffc14
 }
91ffc14
 
91ffc14
 /* Grab the key. In order to ignore GSD_IGNORED_MODS we need to grab
91ffc14
  * all combinations of the ignored modifiers and those actually used
91ffc14
  * for the binding (if any).
91ffc14
  *
91ffc14
- * inspired by all_combinations from gnome-panel/gnome-panel/global-keys.c */
91ffc14
+ * inspired by all_combinations from gnome-panel/gnome-panel/global-keys.c
91ffc14
+ *
91ffc14
+ * This may generate X errors.  The correct way to use this is like:
91ffc14
+ *
91ffc14
+ *        gdk_error_trap_push ();
91ffc14
+ *
91ffc14
+ *        grab_key_unsafe (key, grab, screens);
91ffc14
+ *
91ffc14
+ *        gdk_flush ();
91ffc14
+ *        if (gdk_error_trap_pop ())
91ffc14
+ *                g_warning ("Grab failed, another application may already have access to key '%u'",
91ffc14
+ *                           key->keycode);
91ffc14
+ *
91ffc14
+ * This is not done in the function itself, to allow doing multiple grab_key
91ffc14
+ * operations with one flush only.
91ffc14
+ */
91ffc14
 #define N_BITS 32
91ffc14
 void
91ffc14
-grab_key (Key                 *key,
91ffc14
-          gboolean             grab,
91ffc14
-          GSList              *screens)
91ffc14
+grab_key_unsafe (Key                 *key,
91ffc14
+                 gboolean             grab,
91ffc14
+                 GSList              *screens)
91ffc14
 {
91ffc14
         int   indexes[N_BITS]; /* indexes of bits we need to flip */
91ffc14
         int   i;
91ffc14
@@ -141,14 +152,10 @@ grab_key (Key                 *key,
91ffc14
 
91ffc14
                 for (l = screens; l; l = l->next) {
91ffc14
                         GdkScreen *screen = l->data;
91ffc14
-                        if (!grab_key_real (key->keycode,
91ffc14
-                                            gdk_screen_get_root_window (screen),
91ffc14
-                                            grab,
91ffc14
-                                            result | key->state)) {
91ffc14
-                                g_warning ("Grab failed, another application may already have access to key '%u'",
91ffc14
-                                           key->keycode);
91ffc14
-                                return;
91ffc14
-                        }
91ffc14
+                        grab_key_real (key->keycode,
91ffc14
+                                       gdk_screen_get_root_window (screen),
91ffc14
+                                       grab,
91ffc14
+                                       result | key->state);
91ffc14
                 }
91ffc14
         }
91ffc14
 }
91ffc14
@@ -162,7 +169,6 @@ have_xkb (Display *dpy)
91ffc14
 #ifdef HAVE_X11_EXTENSIONS_XKB_H
91ffc14
 		int opcode, error_base, major, minor, xkb_event_base;
91ffc14
 
91ffc14
-		gdk_error_trap_push ();
91ffc14
 		have_xkb = XkbQueryExtension (dpy,
91ffc14
 					      &opcode,
91ffc14
 					      &xkb_event_base,
91ffc14
@@ -170,7 +176,6 @@ have_xkb (Display *dpy)
91ffc14
 					      &major,
91ffc14
 					      &minor)
91ffc14
 			&& XkbUseExtension (dpy, &major, &minor);
91ffc14
-		gdk_error_trap_pop ();
91ffc14
 #else
91ffc14
 		have_xkb = 0;
91ffc14
 #endif
91ffc14
diff --git a/plugins/common/gsd-keygrab.h b/plugins/common/gsd-keygrab.h
91ffc14
index 6dde2a0..035aee8 100644
91ffc14
--- a/plugins/common/gsd-keygrab.h
91ffc14
+++ b/plugins/common/gsd-keygrab.h
91ffc14
@@ -32,7 +32,7 @@ typedef struct {
91ffc14
 } Key;
91ffc14
 
91ffc14
 
91ffc14
-void	        grab_key	(Key     *key,
91ffc14
+void	        grab_key_unsafe	(Key     *key,
91ffc14
 		        	 gboolean grab,
91ffc14
 			         GSList  *screens);
91ffc14
 
91ffc14
diff --git a/plugins/font/gsd-font-manager.c b/plugins/font/gsd-font-manager.c
91ffc14
index bb2fd28..7b6ce89 100644
91ffc14
--- a/plugins/font/gsd-font-manager.c
91ffc14
+++ b/plugins/font/gsd-font-manager.c
91ffc14
@@ -78,6 +78,7 @@ child_watch_cb (GPid     pid,
91ffc14
 {
91ffc14
         char *command = user_data;
91ffc14
 
91ffc14
+        gnome_settings_profile_end ("%s", command);
91ffc14
         if (!WIFEXITED (status) || WEXITSTATUS (status)) {
91ffc14
                 g_warning ("Command %s failed", command);
91ffc14
         }
91ffc14
@@ -100,6 +101,7 @@ spawn_with_input (const char *command,
91ffc14
                 return;
91ffc14
         }
91ffc14
 
91ffc14
+        gnome_settings_profile_start ("%s", command);
91ffc14
         error = NULL;
91ffc14
         res = g_spawn_async_with_pipes (NULL,
91ffc14
                                         argv,
91ffc14
@@ -177,134 +179,185 @@ load_xcursor_theme (GConfClient *client)
91ffc14
         gnome_settings_profile_end (NULL);
91ffc14
 }
91ffc14
 
91ffc14
-static void
91ffc14
-load_cursor (GConfClient *client)
91ffc14
+static char*
91ffc14
+setup_dir (const char *font_dir_name, gboolean create)
91ffc14
 {
91ffc14
-        DIR           *dir;
91ffc14
-        char          *font_dir_name;
91ffc14
-        char          *dir_name;
91ffc14
-        struct dirent *file_dirent;
91ffc14
-        char          *cursor_font;
91ffc14
-        char         **font_path;
91ffc14
-        char         **new_font_path;
91ffc14
-        int            n_fonts;
91ffc14
-        int            new_n_fonts;
91ffc14
-        int            i;
91ffc14
-        char          *mkfontdir_cmd;
91ffc14
+        char *font_dir;
91ffc14
 
91ffc14
-        gnome_settings_profile_start (NULL);
91ffc14
+        font_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2", "share", font_dir_name, NULL);
91ffc14
 
91ffc14
-        /* setting up the dir */
91ffc14
-        font_dir_name = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2/share/fonts", NULL);
91ffc14
-        if (! g_file_test (font_dir_name, G_FILE_TEST_EXISTS)) {
91ffc14
-                if (g_mkdir_with_parents (font_dir_name, 0755) != 0) {
91ffc14
-                        GtkWidget *dialog;
91ffc14
-
91ffc14
-                        dialog = gtk_message_dialog_new (NULL,
91ffc14
-                                                         0,
91ffc14
-                                                         GTK_MESSAGE_ERROR,
91ffc14
-                                                         GTK_BUTTONS_CLOSE,
91ffc14
-                                                         _("Cannot create the directory \"%s\".\n"\
91ffc14
-                                                           "This is needed to allow changing the mouse pointer theme."),
91ffc14
-                                                         font_dir_name);
91ffc14
-                        g_signal_connect (dialog,
91ffc14
-                                          "response",
91ffc14
-                                          G_CALLBACK (gtk_widget_destroy),
91ffc14
-                                          NULL);
91ffc14
-                        gnome_settings_delayed_show_dialog (dialog);
91ffc14
-                        g_free (font_dir_name);
91ffc14
-
91ffc14
-                        return;
91ffc14
+        if (create) {
91ffc14
+                if (g_mkdir_with_parents (font_dir, 0755) != 0) {
91ffc14
+                        g_warning ("Cannot create needed directory \"%s\".", font_dir);
91ffc14
+                        g_free (font_dir);
91ffc14
+                        font_dir = NULL;
91ffc14
                 }
91ffc14
+        } else if (! g_file_test (font_dir, G_FILE_TEST_EXISTS)) {
91ffc14
+                g_free (font_dir);
91ffc14
+                font_dir = NULL;
91ffc14
         }
91ffc14
 
91ffc14
-        dir_name = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2/share/cursor-fonts", NULL);
91ffc14
-        if (! g_file_test (dir_name, G_FILE_TEST_EXISTS)) {
91ffc14
-                if (g_mkdir_with_parents (dir_name, 0755) != 0) {
91ffc14
-                        GtkWidget *dialog;
91ffc14
-
91ffc14
-                        dialog = gtk_message_dialog_new (NULL,
91ffc14
-                                                         0,
91ffc14
-                                                         GTK_MESSAGE_ERROR,
91ffc14
-                                                         GTK_BUTTONS_CLOSE,
91ffc14
-                                                         (_("Cannot create the directory \"%s\".\n"\
91ffc14
-                                                            "This is needed to allow changing cursors.")),
91ffc14
-                                                         dir_name);
91ffc14
-                        g_signal_connect (dialog, "response",
91ffc14
-                                          G_CALLBACK (gtk_widget_destroy), NULL);
91ffc14
-                        gnome_settings_delayed_show_dialog (dialog);
91ffc14
-                        g_free (dir_name);
91ffc14
-
91ffc14
-                        return;
91ffc14
-                }
91ffc14
-        }
91ffc14
+        return font_dir;
91ffc14
+}
91ffc14
 
91ffc14
-        dir = opendir (dir_name);
91ffc14
+static char *
91ffc14
+empty_check_dir (char *font_dir)
91ffc14
+{
91ffc14
+        char *file_name;
91ffc14
 
91ffc14
-        while ((file_dirent = readdir (dir)) != NULL) {
91ffc14
-                struct stat st;
91ffc14
-                char       *link_name;
91ffc14
+        if (!font_dir)
91ffc14
+                return NULL;
91ffc14
 
91ffc14
-                link_name = g_build_filename (dir_name, file_dirent->d_name, NULL);
91ffc14
-                if (lstat (link_name, &st)) {
91ffc14
-                        g_free (link_name);
91ffc14
-                        continue;
91ffc14
-                }
91ffc14
-                g_free (link_name);
91ffc14
+        /* remove the fonts.dir and fonts.scale files that mkfontdir generates. */
91ffc14
 
91ffc14
-                if (S_ISLNK (st.st_mode))
91ffc14
-                        unlink (link_name);
91ffc14
+        file_name = g_build_filename (G_DIR_SEPARATOR_S, font_dir, "fonts.dir", NULL);
91ffc14
+        unlink (file_name);
91ffc14
+        g_free (file_name);
91ffc14
+
91ffc14
+        file_name = g_build_filename (G_DIR_SEPARATOR_S, font_dir, "fonts.scale", NULL);
91ffc14
+        unlink (file_name);
91ffc14
+        g_free (file_name);
91ffc14
+
91ffc14
+        /* if it's empty, get rid of it. */
91ffc14
+        if (0 == rmdir (font_dir)) {
91ffc14
+                g_free (font_dir);
91ffc14
+                font_dir = NULL;
91ffc14
         }
91ffc14
 
91ffc14
-        closedir (dir);
91ffc14
+        return font_dir;
91ffc14
+}
91ffc14
+
91ffc14
+static char*
91ffc14
+setup_font_dir (GConfClient *client)
91ffc14
+{
91ffc14
+        return empty_check_dir (setup_dir ("fonts", FALSE));
91ffc14
+}
91ffc14
+
91ffc14
+static char*
91ffc14
+setup_cursor_dir (GConfClient *client)
91ffc14
+{
91ffc14
+        char          *cursor_dir;
91ffc14
+        char          *cursor_font;
91ffc14
+        DIR           *dir;
91ffc14
+        struct dirent *file_dirent;
91ffc14
 
91ffc14
         cursor_font = gconf_client_get_string (client,
91ffc14
                                                "/desktop/gnome/peripherals/mouse/cursor_font",
91ffc14
                                                NULL);
91ffc14
+        if (cursor_font != NULL) {
91ffc14
+                if (!g_path_is_absolute (cursor_font) ||
91ffc14
+                    !g_file_test (cursor_font, G_FILE_TEST_IS_REGULAR)) {
91ffc14
+                        /* font file is not usable */
91ffc14
+                        g_free (cursor_font);
91ffc14
+                        cursor_font = NULL;
91ffc14
+                }
91ffc14
+        }
91ffc14
+
91ffc14
+        cursor_dir = setup_dir ("cursor-fonts", cursor_font != NULL);
91ffc14
+
91ffc14
+        /* remove previously made symlinks, if any */
91ffc14
+        if (cursor_dir) {
91ffc14
+                dir = opendir (cursor_dir);
91ffc14
+                while ((file_dirent = readdir (dir)) != NULL) {
91ffc14
+                        struct stat st;
91ffc14
+                        char       *link_name;
91ffc14
+
91ffc14
+                        link_name = g_build_filename (cursor_dir, file_dirent->d_name, NULL);
91ffc14
+                        if (lstat (link_name, &st)) {
91ffc14
+                                g_free (link_name);
91ffc14
+                                continue;
91ffc14
+                        }
91ffc14
+                        g_free (link_name);
91ffc14
 
91ffc14
-        if ((cursor_font != NULL) &&
91ffc14
-            (g_file_test (cursor_font, G_FILE_TEST_IS_REGULAR)) &&
91ffc14
-            (g_path_is_absolute (cursor_font))) {
91ffc14
+                        if (S_ISLNK (st.st_mode))
91ffc14
+                                unlink (link_name);
91ffc14
+                }
91ffc14
+                closedir (dir);
91ffc14
+        }
91ffc14
+
91ffc14
+        if (cursor_font && cursor_dir) {
91ffc14
                 char *newpath;
91ffc14
                 char *font_name;
91ffc14
 
91ffc14
                 font_name = strrchr (cursor_font, G_DIR_SEPARATOR);
91ffc14
-                newpath = g_build_filename (dir_name, font_name, NULL);
91ffc14
+                newpath = g_build_filename (cursor_dir, font_name, NULL);
91ffc14
                 symlink (cursor_font, newpath);
91ffc14
                 g_free (newpath);
91ffc14
+                g_free (cursor_font);
91ffc14
+                cursor_font = NULL;
91ffc14
+        } else {
91ffc14
+                cursor_dir = empty_check_dir (cursor_dir);
91ffc14
         }
91ffc14
-        g_free (cursor_font);
91ffc14
+
91ffc14
+        return cursor_dir;
91ffc14
+}
91ffc14
+
91ffc14
+static void
91ffc14
+load_font_paths (GConfClient *client)
91ffc14
+{
91ffc14
+        char          *font_dir_name;
91ffc14
+        char          *cursor_dir_name;
91ffc14
+
91ffc14
+        char         **font_path;
91ffc14
+        char         **new_font_path;
91ffc14
+        int            n_fonts;
91ffc14
+        int            new_n_fonts;
91ffc14
+
91ffc14
+        int            i;
91ffc14
+
91ffc14
+        const char    *argv[4];
91ffc14
+        int            argc = 0;
91ffc14
+
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+        font_dir_name = setup_font_dir (client);
91ffc14
+        cursor_dir_name = setup_cursor_dir (client);
91ffc14
+
91ffc14
+        if (font_dir_name == NULL && cursor_dir_name == NULL)
91ffc14
+                goto done;
91ffc14
 
91ffc14
         /* run mkfontdir */
91ffc14
-        mkfontdir_cmd = g_strdup_printf ("mkfontdir %s %s", dir_name, font_dir_name);
91ffc14
-        /* maybe check for error...
91ffc14
-         * also, it's not going to like that if there are spaces in dir_name/font_dir_name.
91ffc14
-         */
91ffc14
-        g_spawn_command_line_sync (mkfontdir_cmd, NULL, NULL, NULL, NULL);
91ffc14
-        g_free (mkfontdir_cmd);
91ffc14
+        argv[argc++] = "mkfontdir";
91ffc14
+        if (font_dir_name)
91ffc14
+                argv[argc++] = font_dir_name;
91ffc14
+        if (cursor_dir_name)
91ffc14
+                argv[argc++] = cursor_dir_name;
91ffc14
+        argv[argc] = NULL;
91ffc14
+        g_spawn_sync (NULL, /* current dir */
91ffc14
+                      (char **) (void *) argv, NULL /* envp */,
91ffc14
+                      G_SPAWN_SEARCH_PATH,
91ffc14
+                      NULL, NULL, /* child_setup */
91ffc14
+                      NULL, NULL, NULL, NULL);
91ffc14
 
91ffc14
         /* Set the font path */
91ffc14
         font_path = XGetFontPath (gdk_x11_get_default_xdisplay (), &n_fonts);
91ffc14
         new_n_fonts = n_fonts;
91ffc14
-        if (n_fonts == 0 || strcmp (font_path[0], dir_name))
91ffc14
+        if (cursor_dir_name && (n_fonts == 0 || strcmp (font_path[0], cursor_dir_name)))
91ffc14
                 new_n_fonts++;
91ffc14
-        if (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))
91ffc14
+        if (font_dir_name && (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name)))
91ffc14
                 new_n_fonts++;
91ffc14
 
91ffc14
-        new_font_path = g_new0 (char *, new_n_fonts);
91ffc14
-        if (n_fonts == 0 || strcmp (font_path[0], dir_name)) {
91ffc14
-                new_font_path[0] = dir_name;
91ffc14
-                for (i = 0; i < n_fonts; i++)
91ffc14
-                        new_font_path [i+1] = font_path [i];
91ffc14
-        } else {
91ffc14
-                for (i = 0; i < n_fonts; i++)
91ffc14
-                        new_font_path [i] = font_path [i];
91ffc14
-        }
91ffc14
+        if (new_n_fonts == n_fonts)
91ffc14
+                new_font_path = font_path;
91ffc14
+        else {
91ffc14
+                new_font_path = g_new0 (char *, new_n_fonts);
91ffc14
+
91ffc14
+                if (cursor_dir_name && (n_fonts == 0 || strcmp (font_path[0], cursor_dir_name))) {
91ffc14
+                        new_font_path[0] = cursor_dir_name;
91ffc14
+                        for (i = 0; i < n_fonts; i++)
91ffc14
+                                new_font_path [i+1] = font_path [i];
91ffc14
+                } else {
91ffc14
+                        for (i = 0; i < n_fonts; i++)
91ffc14
+                                new_font_path [i] = font_path [i];
91ffc14
+                }
91ffc14
 
91ffc14
-        if (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name)) {
91ffc14
-                new_font_path[new_n_fonts-1] = font_dir_name;
91ffc14
+                if (font_dir_name && (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))) {
91ffc14
+                        new_font_path[new_n_fonts-1] = font_dir_name;
91ffc14
+                }
91ffc14
         }
91ffc14
 
91ffc14
+        /* We set font path even if it was not changed, to enforce dropping
91ffc14
+         * caches in the server */
91ffc14
         gdk_error_trap_push ();
91ffc14
         XSetFontPath (gdk_display, new_font_path, new_n_fonts);
91ffc14
         gdk_flush ();
91ffc14
@@ -314,13 +367,16 @@ load_cursor (GConfClient *client)
91ffc14
                 XSetFontPath (gdk_display, font_path, n_fonts);
91ffc14
         }
91ffc14
 
91ffc14
+        g_free (font_dir_name);
91ffc14
+        g_free (cursor_dir_name);
91ffc14
+
91ffc14
+        if (new_font_path != font_path)
91ffc14
+                g_free (new_font_path);
91ffc14
+
91ffc14
         XFreeFontPath (font_path);
91ffc14
 
91ffc14
+done:
91ffc14
         gnome_settings_profile_end (NULL);
91ffc14
-
91ffc14
-        g_free (new_font_path);
91ffc14
-        g_free (font_dir_name);
91ffc14
-        g_free (dir_name);
91ffc14
 }
91ffc14
 
91ffc14
 gboolean
91ffc14
@@ -335,7 +391,7 @@ gsd_font_manager_start (GsdFontManager *manager,
91ffc14
         client = gconf_client_get_default ();
91ffc14
 
91ffc14
         load_xcursor_theme (client);
91ffc14
-        load_cursor (client);
91ffc14
+        load_font_paths (client);
91ffc14
 
91ffc14
         g_object_unref (client);
91ffc14
 
91ffc14
diff --git a/plugins/keybindings/gsd-keybindings-manager.c b/plugins/keybindings/gsd-keybindings-manager.c
91ffc14
index 509a721..9c75b3b 100644
91ffc14
--- a/plugins/keybindings/gsd-keybindings-manager.c
91ffc14
+++ b/plugins/keybindings/gsd-keybindings-manager.c
91ffc14
@@ -255,6 +255,7 @@ static void
91ffc14
 binding_register_keys (GsdKeybindingsManager *manager)
91ffc14
 {
91ffc14
         GSList *li;
91ffc14
+        gboolean need_flush = FALSE;
91ffc14
 
91ffc14
         gdk_error_trap_push ();
91ffc14
 
91ffc14
@@ -266,10 +267,11 @@ binding_register_keys (GsdKeybindingsManager *manager)
91ffc14
                     binding->previous_key.state != binding->key.state) {
91ffc14
                         /* Ungrab key if it changed and not clashing with previously set binding */
91ffc14
                         if (! key_already_used (manager, binding)) {
91ffc14
+                                need_flush = TRUE;
91ffc14
                                 if (binding->previous_key.keycode) {
91ffc14
-                                        grab_key (&binding->previous_key, FALSE, manager->priv->screens);
91ffc14
+                                        grab_key_unsafe (&binding->previous_key, FALSE, manager->priv->screens);
91ffc14
                                 }
91ffc14
-                                grab_key (&binding->key, TRUE, manager->priv->screens);
91ffc14
+                                grab_key_unsafe (&binding->key, TRUE, manager->priv->screens);
91ffc14
 
91ffc14
                                 binding->previous_key.keysym = binding->key.keysym;
91ffc14
                                 binding->previous_key.state = binding->key.state;
91ffc14
@@ -278,8 +280,11 @@ binding_register_keys (GsdKeybindingsManager *manager)
91ffc14
                                 g_warning ("Key binding (%s) is already in use", binding->binding_str);
91ffc14
                 }
91ffc14
         }
91ffc14
-        gdk_flush ();
91ffc14
-        gdk_error_trap_pop ();
91ffc14
+
91ffc14
+        if (need_flush)
91ffc14
+                gdk_flush ();
91ffc14
+        if (gdk_error_trap_pop ())
91ffc14
+                g_warning ("Grab failed for some keys, another application may already have access the them.");
91ffc14
 }
91ffc14
 
91ffc14
 extern char **environ;
91ffc14
@@ -453,7 +458,7 @@ register_config_callback (GsdKeybindingsManager   *manager,
91ffc14
                           const char              *path,
91ffc14
                           GConfClientNotifyFunc    func)
91ffc14
 {
91ffc14
-        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
91ffc14
+        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
91ffc14
         return gconf_client_notify_add (client, path, func, manager, NULL, NULL);
91ffc14
 }
91ffc14
 
91ffc14
@@ -472,6 +477,13 @@ gsd_keybindings_manager_start (GsdKeybindingsManager *manager,
91ffc14
         g_debug ("Starting keybindings manager");
91ffc14
         gnome_settings_profile_start (NULL);
91ffc14
 
91ffc14
+        client = gconf_client_get_default ();
91ffc14
+
91ffc14
+        manager->priv->notify = register_config_callback (manager,
91ffc14
+                                                          client,
91ffc14
+                                                          GCONF_BINDING_DIR,
91ffc14
+                                                          (GConfClientNotifyFunc) bindings_callback);
91ffc14
+
91ffc14
         dpy = gdk_display_get_default ();
91ffc14
         screen_num = gdk_display_get_n_screens (dpy);
91ffc14
 
91ffc14
@@ -482,13 +494,6 @@ gsd_keybindings_manager_start (GsdKeybindingsManager *manager,
91ffc14
                                        manager);
91ffc14
         }
91ffc14
 
91ffc14
-        client = gconf_client_get_default ();
91ffc14
-
91ffc14
-        manager->priv->notify = register_config_callback (manager,
91ffc14
-                                                          client,
91ffc14
-                                                          GCONF_BINDING_DIR,
91ffc14
-                                                          (GConfClientNotifyFunc) bindings_callback);
91ffc14
-
91ffc14
         list = gconf_client_all_dirs (client, GCONF_BINDING_DIR, NULL);
91ffc14
         manager->priv->screens = get_screens_list ();
91ffc14
 
91ffc14
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
91ffc14
index 2f08ec1..ae01b0b 100644
91ffc14
--- a/plugins/keyboard/gsd-keyboard-manager.c
91ffc14
+++ b/plugins/keyboard/gsd-keyboard-manager.c
91ffc14
@@ -59,16 +59,16 @@
91ffc14
 
91ffc14
 #define GSD_KEYBOARD_KEY "/desktop/gnome/peripherals/keyboard"
91ffc14
 
91ffc14
-#define KEY_REPEAT        "/desktop/gnome/peripherals/keyboard/repeat"
91ffc14
-#define KEY_CLICK         "/desktop/gnome/peripherals/keyboard/click"
91ffc14
-#define KEY_RATE          "/desktop/gnome/peripherals/keyboard/rate"
91ffc14
-#define KEY_DELAY         "/desktop/gnome/peripherals/keyboard/delay"
91ffc14
-#define KEY_CLICK_VOLUME  "/desktop/gnome/peripherals/keyboard/click_volume"
91ffc14
+#define KEY_REPEAT        GSD_KEYBOARD_KEY "/repeat"
91ffc14
+#define KEY_CLICK         GSD_KEYBOARD_KEY "/click"
91ffc14
+#define KEY_RATE          GSD_KEYBOARD_KEY "/rate"
91ffc14
+#define KEY_DELAY         GSD_KEYBOARD_KEY "/delay"
91ffc14
+#define KEY_CLICK_VOLUME  GSD_KEYBOARD_KEY "/click_volume"
91ffc14
 
91ffc14
-#define KEY_BELL_VOLUME   "/desktop/gnome/peripherals/keyboard/bell_volume"
91ffc14
-#define KEY_BELL_PITCH    "/desktop/gnome/peripherals/keyboard/bell_pitch"
91ffc14
-#define KEY_BELL_DURATION "/desktop/gnome/peripherals/keyboard/bell_duration"
91ffc14
-#define KEY_BELL_MODE     "/desktop/gnome/peripherals/keyboard/bell_mode"
91ffc14
+#define KEY_BELL_VOLUME   GSD_KEYBOARD_KEY "/bell_volume"
91ffc14
+#define KEY_BELL_PITCH    GSD_KEYBOARD_KEY "/bell_pitch"
91ffc14
+#define KEY_BELL_DURATION GSD_KEYBOARD_KEY "/bell_duration"
91ffc14
+#define KEY_BELL_MODE     GSD_KEYBOARD_KEY "/bell_mode"
91ffc14
 
91ffc14
 struct GsdKeyboardManagerPrivate
91ffc14
 {
91ffc14
@@ -165,7 +165,6 @@ numlock_xkb_init (GsdKeyboardManager *manager)
91ffc14
         gboolean have_xkb;
91ffc14
         int opcode, error_base, major, minor;
91ffc14
 
91ffc14
-        gdk_error_trap_push ();
91ffc14
         have_xkb = XkbQueryExtension (dpy,
91ffc14
                                       &opcode,
91ffc14
                                       &manager->priv->xkb_event_base,
91ffc14
@@ -184,9 +183,6 @@ numlock_xkb_init (GsdKeyboardManager *manager)
91ffc14
                 g_warning ("XKB extension not available");
91ffc14
         }
91ffc14
 
91ffc14
-        XSync (dpy, FALSE);
91ffc14
-        gdk_error_trap_pop ();
91ffc14
-
91ffc14
         manager->priv->have_xkb = have_xkb;
91ffc14
 }
91ffc14
 
91ffc14
@@ -374,19 +370,8 @@ apply_settings (GConfClient        *client,
91ffc14
         gdk_error_trap_pop ();
91ffc14
 }
91ffc14
 
91ffc14
-static guint
91ffc14
-register_config_callback (GsdKeyboardManager      *manager,
91ffc14
-                          GConfClient             *client,
91ffc14
-                          const char              *path,
91ffc14
-                          GConfClientNotifyFunc    func)
91ffc14
-{
91ffc14
-        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
91ffc14
-        return gconf_client_notify_add (client, path, func, manager, NULL, NULL);
91ffc14
-}
91ffc14
-
91ffc14
-gboolean
91ffc14
-gsd_keyboard_manager_start (GsdKeyboardManager *manager,
91ffc14
-                            GError            **error)
91ffc14
+static gboolean
91ffc14
+start_keyboard_idle_cb (GsdKeyboardManager *manager)
91ffc14
 {
91ffc14
         GConfClient *client;
91ffc14
 
91ffc14
@@ -397,6 +382,8 @@ gsd_keyboard_manager_start (GsdKeyboardManager *manager,
91ffc14
         manager->priv->have_xkb = 0;
91ffc14
         client = gconf_client_get_default ();
91ffc14
 
91ffc14
+        gconf_client_add_dir (client, GSD_KEYBOARD_KEY, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
+
91ffc14
         /* Essential - xkb initialization should happen before */
91ffc14
         gsd_keyboard_xkb_set_post_activation_callback ((PostActivationCallback) gsd_load_modmap_files, NULL);
91ffc14
         gsd_keyboard_xkb_init (client);
91ffc14
@@ -408,10 +395,9 @@ gsd_keyboard_manager_start (GsdKeyboardManager *manager,
91ffc14
         /* apply current settings before we install the callback */
91ffc14
         apply_settings (client, 0, NULL, manager);
91ffc14
 
91ffc14
-        manager->priv->notify = register_config_callback (manager,
91ffc14
-                                                          client,
91ffc14
-                                                          GSD_KEYBOARD_KEY,
91ffc14
-                                                          (GConfClientNotifyFunc) apply_settings);
91ffc14
+        manager->priv->notify = gconf_client_notify_add (client, GSD_KEYBOARD_KEY,
91ffc14
+                                                         (GConfClientNotifyFunc) apply_settings, manager,
91ffc14
+                                                         NULL, NULL);
91ffc14
 
91ffc14
         g_object_unref (client);
91ffc14
 
91ffc14
@@ -421,6 +407,19 @@ gsd_keyboard_manager_start (GsdKeyboardManager *manager,
91ffc14
 
91ffc14
         gnome_settings_profile_end (NULL);
91ffc14
 
91ffc14
+        return FALSE;
91ffc14
+}
91ffc14
+
91ffc14
+gboolean
91ffc14
+gsd_keyboard_manager_start (GsdKeyboardManager *manager,
91ffc14
+                            GError            **error)
91ffc14
+{
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+        g_idle_add ((GSourceFunc) start_keyboard_idle_cb, manager);
91ffc14
+
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+
91ffc14
         return TRUE;
91ffc14
 }
91ffc14
 
91ffc14
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
91ffc14
index 037f606..04608e2 100644
91ffc14
--- a/plugins/keyboard/gsd-keyboard-xkb.c
91ffc14
+++ b/plugins/keyboard/gsd-keyboard-xkb.c
91ffc14
@@ -37,6 +37,7 @@
91ffc14
 #include "gsd-xmodmap.h"
91ffc14
 #include "gsd-keyboard-xkb.h"
91ffc14
 #include "delayed-dialog.h"
91ffc14
+#include "gnome-settings-profile.h"
91ffc14
 
91ffc14
 static XklEngine *xkl_engine;
91ffc14
 
91ffc14
@@ -338,19 +339,22 @@ register_config_callback (GConfClient          *client,
91ffc14
                           const char           *path,
91ffc14
                           GConfClientNotifyFunc func)
91ffc14
 {
91ffc14
-        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
91ffc14
+        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
         return gconf_client_notify_add (client, path, func, NULL, NULL, NULL);
91ffc14
 }
91ffc14
 
91ffc14
 void
91ffc14
 gsd_keyboard_xkb_init (GConfClient *client)
91ffc14
 {
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
 #ifdef GSDKX
91ffc14
         xkl_set_debug_level (200);
91ffc14
         logfile = fopen ("/tmp/gsdkx.log", "a");
91ffc14
         xkl_set_log_appender (gsd_keyboard_log_appender);
91ffc14
 #endif
91ffc14
+        gnome_settings_profile_start ("xkl_engine_get_instance");
91ffc14
         xkl_engine = xkl_engine_get_instance (GDK_DISPLAY ());
91ffc14
+        gnome_settings_profile_end ("xkl_engine_get_instance");
91ffc14
         if (xkl_engine) {
91ffc14
                 inited_ok = TRUE;
91ffc14
 
91ffc14
@@ -364,7 +368,9 @@ gsd_keyboard_xkb_init (GConfClient *client)
91ffc14
                                            xkl_engine);
91ffc14
                 xkl_engine_backup_names_prop (xkl_engine);
91ffc14
                 gsd_keyboard_xkb_analyze_sysconfig ();
91ffc14
+		gnome_settings_profile_start ("gsd_keyboard_xkb_chk_lcl_xmm");
91ffc14
                 gsd_keyboard_xkb_chk_lcl_xmm ();
91ffc14
+		gnome_settings_profile_end ("gsd_keyboard_xkb_chk_lcl_xmm");
91ffc14
 
91ffc14
                 notify_desktop =
91ffc14
                         register_config_callback (client,
91ffc14
@@ -379,13 +385,21 @@ gsd_keyboard_xkb_init (GConfClient *client)
91ffc14
                 gdk_window_add_filter (NULL, (GdkFilterFunc)
91ffc14
                                        gsd_keyboard_xkb_evt_filter,
91ffc14
                                        NULL);
91ffc14
+
91ffc14
+		gnome_settings_profile_start ("xkl_engine_start_listen");
91ffc14
                 xkl_engine_start_listen (xkl_engine,
91ffc14
                                          XKLL_MANAGE_LAYOUTS |
91ffc14
                                          XKLL_MANAGE_WINDOW_STATES);
91ffc14
+		gnome_settings_profile_end ("xkl_engine_start_listen");
91ffc14
 
91ffc14
+		gnome_settings_profile_start ("apply_settings");
91ffc14
                 apply_settings ();
91ffc14
+		gnome_settings_profile_end ("apply_settings");
91ffc14
+		gnome_settings_profile_start ("apply_xkb_settings");
91ffc14
                 apply_xkb_settings ();
91ffc14
+		gnome_settings_profile_end ("apply_xkb_settings");
91ffc14
         }
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
 }
91ffc14
 
91ffc14
 void
91ffc14
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
91ffc14
index a31cc61..964c95f 100644
91ffc14
--- a/plugins/media-keys/gsd-media-keys-manager.c
91ffc14
+++ b/plugins/media-keys/gsd-media-keys-manager.c
91ffc14
@@ -276,9 +276,12 @@ update_kbd_cb (GConfClient         *client,
91ffc14
                GsdMediaKeysManager *manager)
91ffc14
 {
91ffc14
         int      i;
91ffc14
+        gboolean need_flush = TRUE;
91ffc14
 
91ffc14
         g_return_if_fail (entry->key != NULL);
91ffc14
 
91ffc14
+        gdk_error_trap_push ();
91ffc14
+
91ffc14
         /* Find the key that was modified */
91ffc14
         for (i = 0; i < HANDLED_KEYS; i++) {
91ffc14
                 if (strcmp (entry->key, keys[i].gconf_key) == 0) {
91ffc14
@@ -286,7 +289,8 @@ update_kbd_cb (GConfClient         *client,
91ffc14
                         Key  *key;
91ffc14
 
91ffc14
                         if (keys[i].key != NULL) {
91ffc14
-                                grab_key (keys[i].key, FALSE, manager->priv->screens);
91ffc14
+                                need_flush = TRUE;
91ffc14
+                                grab_key_unsafe (keys[i].key, FALSE, manager->priv->screens);
91ffc14
                         }
91ffc14
 
91ffc14
                         g_free (keys[i].key);
91ffc14
@@ -308,7 +312,8 @@ update_kbd_cb (GConfClient         *client,
91ffc14
                                 break;
91ffc14
                         }
91ffc14
 
91ffc14
-                        grab_key (key, TRUE, manager->priv->screens);
91ffc14
+                        need_flush = TRUE;
91ffc14
+                        grab_key_unsafe (key, TRUE, manager->priv->screens);
91ffc14
                         keys[i].key = key;
91ffc14
 
91ffc14
                         g_free (tmp);
91ffc14
@@ -316,15 +321,23 @@ update_kbd_cb (GConfClient         *client,
91ffc14
                         break;
91ffc14
                 }
91ffc14
         }
91ffc14
+
91ffc14
+        if (need_flush)
91ffc14
+                gdk_flush ();
91ffc14
+        if (gdk_error_trap_pop ())
91ffc14
+                g_warning ("Grab failed for some keys, another application may already have access the them.");
91ffc14
 }
91ffc14
 
91ffc14
 static void
91ffc14
 init_kbd (GsdMediaKeysManager *manager)
91ffc14
 {
91ffc14
         int i;
91ffc14
+        gboolean need_flush = FALSE;
91ffc14
 
91ffc14
         gnome_settings_profile_start (NULL);
91ffc14
 
91ffc14
+        gdk_error_trap_push ();
91ffc14
+
91ffc14
         for (i = 0; i < HANDLED_KEYS; i++) {
91ffc14
                 char *tmp;
91ffc14
                 Key  *key;
91ffc14
@@ -340,6 +353,7 @@ init_kbd (GsdMediaKeysManager *manager)
91ffc14
                 tmp = gconf_client_get_string (manager->priv->conf_client,
91ffc14
                                                keys[i].gconf_key,
91ffc14
                                                NULL);
91ffc14
+
91ffc14
                 if (!is_valid_shortcut (tmp)) {
91ffc14
                         g_debug ("Not a valid shortcut: '%s'", tmp);
91ffc14
                         g_free (tmp);
91ffc14
@@ -367,9 +381,15 @@ init_kbd (GsdMediaKeysManager *manager)
91ffc14
 
91ffc14
                 keys[i].key = key;
91ffc14
 
91ffc14
-                grab_key (key, TRUE, manager->priv->screens);
91ffc14
+                need_flush = TRUE;
91ffc14
+                grab_key_unsafe (key, TRUE, manager->priv->screens);
91ffc14
         }
91ffc14
 
91ffc14
+        if (need_flush)
91ffc14
+                gdk_flush ();
91ffc14
+        if (gdk_error_trap_pop ())
91ffc14
+                g_warning ("Grab failed for some keys, another application may already have access the them.");
91ffc14
+
91ffc14
         gnome_settings_profile_end (NULL);
91ffc14
 }
91ffc14
 
91ffc14
@@ -894,9 +914,8 @@ acme_filter_events (GdkXEvent           *xevent,
91ffc14
         return GDK_FILTER_CONTINUE;
91ffc14
 }
91ffc14
 
91ffc14
-gboolean
91ffc14
-gsd_media_keys_manager_start (GsdMediaKeysManager *manager,
91ffc14
-                              GError             **error)
91ffc14
+static gboolean
91ffc14
+start_media_keys_idle_cb (GsdMediaKeysManager *manager)
91ffc14
 {
91ffc14
         GSList *l;
91ffc14
 
91ffc14
@@ -912,11 +931,6 @@ gsd_media_keys_manager_start (GsdMediaKeysManager *manager,
91ffc14
         init_screens (manager);
91ffc14
         init_kbd (manager);
91ffc14
 
91ffc14
-        /* initialise Volume handler */
91ffc14
-        gnome_settings_profile_start ("acme_volume_new");
91ffc14
-        manager->priv->volume = acme_volume_new ();
91ffc14
-        gnome_settings_profile_end ("acme_volume_new");
91ffc14
-
91ffc14
         /* Start filtering the events */
91ffc14
         for (l = manager->priv->screens; l != NULL; l = l->next) {
91ffc14
                 gnome_settings_profile_start ("gdk_window_add_filter");
91ffc14
@@ -932,6 +946,29 @@ gsd_media_keys_manager_start (GsdMediaKeysManager *manager,
91ffc14
 
91ffc14
         gnome_settings_profile_end (NULL);
91ffc14
 
91ffc14
+        return FALSE;
91ffc14
+}
91ffc14
+
91ffc14
+gboolean
91ffc14
+gsd_media_keys_manager_start (GsdMediaKeysManager *manager,
91ffc14
+                              GError             **error)
91ffc14
+{
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+        /* initialise Volume handler
91ffc14
+         * 
91ffc14
+         * We do this one here to force checking gstreamer cache, etc.
91ffc14
+         * The rest (grabbing and setting the keys) can happen in an
91ffc14
+         * idle.
91ffc14
+         */
91ffc14
+        gnome_settings_profile_start ("acme_volume_new");
91ffc14
+        manager->priv->volume = acme_volume_new ();
91ffc14
+        gnome_settings_profile_end ("acme_volume_new");
91ffc14
+
91ffc14
+        g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager);
91ffc14
+
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+
91ffc14
         return TRUE;
91ffc14
 }
91ffc14
 
91ffc14
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
91ffc14
index 8e930eb..3280cfe 100644
91ffc14
--- a/plugins/mouse/gsd-mouse-manager.c
91ffc14
+++ b/plugins/mouse/gsd-mouse-manager.c
91ffc14
@@ -55,17 +55,19 @@
91ffc14
 #define GCONF_MOUSE_DIR         "/desktop/gnome/peripherals/mouse"
91ffc14
 #define GCONF_MOUSE_A11Y_DIR    "/desktop/gnome/accessibility/mouse"
91ffc14
 
91ffc14
-#define KEY_LEFT_HANDED         "/desktop/gnome/peripherals/mouse/left_handed"
91ffc14
-#define KEY_MOTION_ACCELERATION "/desktop/gnome/peripherals/mouse/motion_acceleration"
91ffc14
-#define KEY_MOTION_THRESHOLD    "/desktop/gnome/peripherals/mouse/motion_threshold"
91ffc14
-#define KEY_LOCATE_POINTER      "/desktop/gnome/peripherals/mouse/locate_pointer"
91ffc14
-#define KEY_DWELL_ENABLE        "/desktop/gnome/accessibility/mouse/dwell_enable"
91ffc14
-#define KEY_DELAY_ENABLE        "/desktop/gnome/accessibility/mouse/delay_enable"
91ffc14
+#define KEY_LEFT_HANDED         GCONF_MOUSE_DIR "/left_handed"
91ffc14
+#define KEY_MOTION_ACCELERATION GCONF_MOUSE_DIR "/motion_acceleration"
91ffc14
+#define KEY_MOTION_THRESHOLD    GCONF_MOUSE_DIR "/motion_threshold"
91ffc14
+#define KEY_LOCATE_POINTER      GCONF_MOUSE_DIR "/locate_pointer"
91ffc14
+#define KEY_DWELL_ENABLE        GCONF_MOUSE_A11Y_DIR "/dwell_enable"
91ffc14
+#define KEY_DELAY_ENABLE        GCONF_MOUSE_A11Y_DIR "/delay_enable"
91ffc14
 
91ffc14
 struct GsdMouseManagerPrivate
91ffc14
 {
91ffc14
         guint notify;
91ffc14
         guint notify_a11y;
91ffc14
+
91ffc14
+        gboolean mousetweaks_daemon_running;
91ffc14
 };
91ffc14
 
91ffc14
 static void     gsd_mouse_manager_class_init  (GsdMouseManagerClass *klass);
91ffc14
@@ -583,9 +585,17 @@ set_mousetweaks_daemon (GsdMouseManager *manager,
91ffc14
 {
91ffc14
         GError *error = NULL;
91ffc14
         gchar *comm;
91ffc14
+        gboolean run_daemon = dwell_enable || delay_enable;
91ffc14
+
91ffc14
+        if (run_daemon || manager->priv->mousetweaks_daemon_running)
91ffc14
+                comm = g_strdup_printf ("mousetweaks %s",
91ffc14
+                                        run_daemon ? "" : "-s");
91ffc14
+        else
91ffc14
+                return;
91ffc14
+
91ffc14
+        if (run_daemon)
91ffc14
+                manager->priv->mousetweaks_daemon_running = TRUE;
91ffc14
 
91ffc14
-        comm = g_strdup_printf ("mousetweaks %s",
91ffc14
-                                (dwell_enable || delay_enable) ? "" : "-s");
91ffc14
 
91ffc14
         if (! g_spawn_command_line_async (comm, &error)) {
91ffc14
                 if (error->code == G_SPAWN_ERROR_NOENT &&
91ffc14
@@ -678,7 +688,7 @@ register_config_callback (GsdMouseManager         *manager,
91ffc14
                           const char              *path,
91ffc14
                           GConfClientNotifyFunc    func)
91ffc14
 {
91ffc14
-        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
91ffc14
+        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
         return gconf_client_notify_add (client, path, func, manager, NULL, NULL);
91ffc14
 }
91ffc14
 
91ffc14
@@ -688,13 +698,11 @@ gsd_mouse_manager_init (GsdMouseManager *manager)
91ffc14
         manager->priv = GSD_MOUSE_MANAGER_GET_PRIVATE (manager);
91ffc14
 }
91ffc14
 
91ffc14
-gboolean
91ffc14
-gsd_mouse_manager_start (GsdMouseManager *manager,
91ffc14
-                         GError         **error)
91ffc14
+static gboolean
91ffc14
+gsd_mouse_manager_idle_cb (GsdMouseManager *manager)
91ffc14
 {
91ffc14
         GConfClient *client;
91ffc14
 
91ffc14
-        g_debug ("Starting mouse manager");
91ffc14
         gnome_settings_profile_start (NULL);
91ffc14
 
91ffc14
         client = gconf_client_get_default ();
91ffc14
@@ -723,6 +731,19 @@ gsd_mouse_manager_start (GsdMouseManager *manager,
91ffc14
 
91ffc14
         gnome_settings_profile_end (NULL);
91ffc14
 
91ffc14
+        return FALSE;
91ffc14
+}
91ffc14
+
91ffc14
+gboolean
91ffc14
+gsd_mouse_manager_start (GsdMouseManager *manager,
91ffc14
+                         GError         **error)
91ffc14
+{
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+        g_idle_add ((GSourceFunc) gsd_mouse_manager_idle_cb, manager);
91ffc14
+
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+
91ffc14
         return TRUE;
91ffc14
 }
91ffc14
 
91ffc14
diff --git a/plugins/typing-break/gsd-typing-break-manager.c b/plugins/typing-break/gsd-typing-break-manager.c
91ffc14
index d71d5c3..8d3a111 100644
91ffc14
--- a/plugins/typing-break/gsd-typing-break-manager.c
91ffc14
+++ b/plugins/typing-break/gsd-typing-break-manager.c
91ffc14
@@ -61,16 +61,6 @@ G_DEFINE_TYPE (GsdTypingBreakManager, gsd_typing_break_manager, G_TYPE_OBJECT)
91ffc14
 
91ffc14
 static gpointer manager_object = NULL;
91ffc14
 
91ffc14
-static guint
91ffc14
-register_config_callback (GsdTypingBreakManager   *manager,
91ffc14
-                          GConfClient             *client,
91ffc14
-                          const char              *path,
91ffc14
-                          GConfClientNotifyFunc    func)
91ffc14
-{
91ffc14
-        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
91ffc14
-        return gconf_client_notify_add (client, path, func, manager, NULL, NULL);
91ffc14
-}
91ffc14
-
91ffc14
 static gboolean
91ffc14
 typing_break_timeout (GsdTypingBreakManager *manager)
91ffc14
 {
91ffc14
@@ -178,13 +168,14 @@ gsd_typing_break_manager_start (GsdTypingBreakManager *manager,
91ffc14
 
91ffc14
         client = gconf_client_get_default ();
91ffc14
 
91ffc14
+        gconf_client_add_dir (client, GCONF_BREAK_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
         manager->priv->notify =
91ffc14
-                register_config_callback (manager,
91ffc14
-                                          client,
91ffc14
-                                          GCONF_BREAK_DIR,
91ffc14
-                                          (GConfClientNotifyFunc) typing_break_callback);
91ffc14
+                gconf_client_notify_add (client,
91ffc14
+                                         GCONF_BREAK_DIR,
91ffc14
+                                         (GConfClientNotifyFunc) typing_break_callback, manager,
91ffc14
+                                         NULL, NULL);
91ffc14
 
91ffc14
-        enabled = gconf_client_get_bool (client, "/desktop/gnome/typing_break/enabled", NULL);
91ffc14
+        enabled = gconf_client_get_bool (client, GCONF_BREAK_DIR "/enabled", NULL);
91ffc14
         g_object_unref (client);
91ffc14
         if (enabled) {
91ffc14
                 manager->priv->setup_id =
91ffc14
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
91ffc14
index da7dbbe..1db5106 100644
91ffc14
--- a/plugins/xrandr/gsd-xrandr-manager.c
91ffc14
+++ b/plugins/xrandr/gsd-xrandr-manager.c
91ffc14
@@ -692,6 +692,7 @@ gsd_xrandr_manager_start (GsdXrandrManager *manager,
91ffc14
                           GError          **error)
91ffc14
 {
91ffc14
         g_debug ("Starting xrandr manager");
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
 
91ffc14
         manager->priv->rw_screen = gnome_rr_screen_new (
91ffc14
                 gdk_screen_get_default (), on_randr_event, manager);
91ffc14
@@ -707,7 +708,7 @@ gsd_xrandr_manager_start (GsdXrandrManager *manager,
91ffc14
         g_assert (manager->priv->notify_id == 0);
91ffc14
 
91ffc14
         gconf_client_add_dir (manager->priv->client, CONF_DIR,
91ffc14
-                              GCONF_CLIENT_PRELOAD_NONE,
91ffc14
+                              GCONF_CLIENT_PRELOAD_ONELEVEL,
91ffc14
                               NULL);
91ffc14
 
91ffc14
         manager->priv->notify_id =
91ffc14
@@ -745,6 +746,8 @@ gsd_xrandr_manager_start (GsdXrandrManager *manager,
91ffc14
 
91ffc14
         start_or_stop_icon (manager);
91ffc14
 
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+
91ffc14
         return TRUE;
91ffc14
 }
91ffc14
 
91ffc14
diff --git a/plugins/xsettings/fontconfig-monitor.c b/plugins/xsettings/fontconfig-monitor.c
91ffc14
index 7b6df2b..bfb15ed 100644
91ffc14
--- a/plugins/xsettings/fontconfig-monitor.c
91ffc14
+++ b/plugins/xsettings/fontconfig-monitor.c
91ffc14
@@ -33,6 +33,18 @@ stuff_changed (GFileMonitor *monitor,
91ffc14
                GFileMonitorEvent event_type,
91ffc14
                gpointer handle);
91ffc14
 
91ffc14
+void
91ffc14
+fontconfig_cache_init (void)
91ffc14
+{
91ffc14
+        FcInit ();
91ffc14
+}
91ffc14
+
91ffc14
+gboolean
91ffc14
+fontconfig_cache_update (void)
91ffc14
+{
91ffc14
+        return !FcConfigUptoDate (NULL) && FcInitReinitialize ();
91ffc14
+}
91ffc14
+
91ffc14
 static void
91ffc14
 monitor_files (GPtrArray *monitors,
91ffc14
                FcStrList *list,
91ffc14
@@ -100,7 +112,7 @@ update (gpointer data)
91ffc14
 
91ffc14
         handle->timeout = 0;
91ffc14
 
91ffc14
-        if (!FcConfigUptoDate (NULL) && FcInitReinitialize ()) {
91ffc14
+        if (fontconfig_cache_update ()) {
91ffc14
                 notify = TRUE;
91ffc14
                 monitors_free (handle->monitors);
91ffc14
                 handle->monitors = monitors_create (data);
91ffc14
diff --git a/plugins/xsettings/fontconfig-monitor.h b/plugins/xsettings/fontconfig-monitor.h
91ffc14
index b3df8cd..eeeef7c 100644
91ffc14
--- a/plugins/xsettings/fontconfig-monitor.h
91ffc14
+++ b/plugins/xsettings/fontconfig-monitor.h
91ffc14
@@ -25,6 +25,9 @@
91ffc14
 
91ffc14
 G_BEGIN_DECLS
91ffc14
 
91ffc14
+void fontconfig_cache_init (void);
91ffc14
+gboolean fontconfig_cache_update (void);
91ffc14
+
91ffc14
 typedef struct _fontconfig_monitor_handle fontconfig_monitor_handle_t;
91ffc14
 
91ffc14
 fontconfig_monitor_handle_t *
91ffc14
diff --git a/plugins/xsettings/gsd-xsettings-manager.c b/plugins/xsettings/gsd-xsettings-manager.c
91ffc14
index e847e74..56e3a0d 100644
91ffc14
--- a/plugins/xsettings/gsd-xsettings-manager.c
91ffc14
+++ b/plugins/xsettings/gsd-xsettings-manager.c
91ffc14
@@ -424,6 +424,7 @@ child_watch_cb (GPid     pid,
91ffc14
 {
91ffc14
         char *command = user_data;
91ffc14
 
91ffc14
+        gnome_settings_profile_end ("%s", command);
91ffc14
         if (!WIFEXITED (status) || WEXITSTATUS (status)) {
91ffc14
                 g_warning ("Command %s failed", command);
91ffc14
         }
91ffc14
@@ -446,6 +447,7 @@ spawn_with_input (const char *command,
91ffc14
                 return;
91ffc14
         }
91ffc14
 
91ffc14
+        gnome_settings_profile_start ("%s", command);
91ffc14
         error = NULL;
91ffc14
         res = g_spawn_async_with_pipes (NULL,
91ffc14
                                         argv,
91ffc14
@@ -563,6 +565,38 @@ fontconfig_callback (fontconfig_monitor_handle_t *handle,
91ffc14
         gnome_settings_profile_end (NULL);
91ffc14
 }
91ffc14
 
91ffc14
+static gboolean
91ffc14
+start_fontconfig_monitor_idle_cb (GnomeXSettingsManager *manager)
91ffc14
+{
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+        manager->priv->fontconfig_handle = fontconfig_monitor_start ((GFunc) fontconfig_callback, manager);
91ffc14
+
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+
91ffc14
+        return FALSE;
91ffc14
+}
91ffc14
+
91ffc14
+static void
91ffc14
+start_fontconfig_monitor (GnomeXSettingsManager  *manager)
91ffc14
+{
91ffc14
+        gnome_settings_profile_start (NULL);
91ffc14
+
91ffc14
+        fontconfig_cache_init ();
91ffc14
+
91ffc14
+        g_idle_add ((GSourceFunc) start_fontconfig_monitor_idle_cb, manager);
91ffc14
+
91ffc14
+        gnome_settings_profile_end (NULL);
91ffc14
+}
91ffc14
+
91ffc14
+static void
91ffc14
+stop_fontconfig_monitor (GnomeXSettingsManager  *manager)
91ffc14
+{
91ffc14
+        if (manager->priv->fontconfig_handle) {
91ffc14
+                fontconfig_monitor_stop (manager->priv->fontconfig_handle);
91ffc14
+                manager->priv->fontconfig_handle = NULL;
91ffc14
+        }
91ffc14
+}
91ffc14
 #endif /* HAVE_FONTCONFIG */
91ffc14
 
91ffc14
 static const char *
91ffc14
@@ -747,7 +781,6 @@ register_config_callback (GnomeXSettingsManager  *manager,
91ffc14
                           const char             *path,
91ffc14
                           GConfClientNotifyFunc   func)
91ffc14
 {
91ffc14
-        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
91ffc14
         return gconf_client_notify_add (client, path, func, manager, NULL, NULL);
91ffc14
 }
91ffc14
 
91ffc14
@@ -824,6 +857,13 @@ gnome_xsettings_manager_start (GnomeXSettingsManager *manager,
91ffc14
 
91ffc14
         client = gconf_client_get_default ();
91ffc14
 
91ffc14
+        gconf_client_add_dir (client, MOUSE_SETTINGS_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
+        gconf_client_add_dir (client, GTK_SETTINGS_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
+        gconf_client_add_dir (client, INTERFACE_SETTINGS_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
+        gconf_client_add_dir (client, SOUND_SETTINGS_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
+        gconf_client_add_dir (client, GTK_MODULES_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
+        gconf_client_add_dir (client, FONT_RENDER_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
91ffc14
+
91ffc14
         for (i = 0; i < G_N_ELEMENTS (translations); i++) {
91ffc14
                 GConfValue *val;
91ffc14
                 GError     *err;
91ffc14
@@ -876,7 +916,7 @@ gnome_xsettings_manager_start (GnomeXSettingsManager *manager,
91ffc14
                                           (GConfClientNotifyFunc) xft_callback);
91ffc14
         update_xft_settings (manager, client);
91ffc14
 
91ffc14
-        manager->priv->fontconfig_handle = fontconfig_monitor_start ((GFunc) fontconfig_callback, manager);
91ffc14
+        start_fontconfig_monitor (manager);
91ffc14
 #endif /* HAVE_FONTCONFIG */
91ffc14
 
91ffc14
         g_object_unref (client);
91ffc14
@@ -923,8 +963,7 @@ gnome_xsettings_manager_stop (GnomeXSettingsManager *manager)
91ffc14
 #ifdef HAVE_FONTCONFIG
91ffc14
         gconf_client_remove_dir (client, FONT_RENDER_DIR, NULL);
91ffc14
 
91ffc14
-        fontconfig_monitor_stop (manager->priv->fontconfig_handle);
91ffc14
-        manager->priv->fontconfig_handle = NULL;
91ffc14
+        stop_fontconfig_monitor (manager);
91ffc14
 #endif /* HAVE_FONTCONFIG */
91ffc14
 
91ffc14
         for (i = 0; i < G_N_ELEMENTS (p->notify); ++i) {