Index: ChangeLog
===================================================================
--- ChangeLog	(révision 4243)
+++ ChangeLog	(copie de travail)
@@ -1,3 +1,12 @@
+2007-02-05  Vincent Untz  <vuntz@gnome.org>
+
+	* gsm-at-startup.[ch]: (gsm_assistive_tech_exec)
+	(gsm_assistive_registry_start)
+	(gsm_assistive_technologies_start)
+	* main.c: (main)
+	Revert patch committed on 2007-01-06 since the gnome-control-center
+	changes won't happen before 2.18.0. This reopens bug #386411.
+	
 ==================== 2.17.90.1 ====================
 
 ==================== 2.17.90 ====================
Index: gsm-at-startup.c
===================================================================
--- gsm-at-startup.c	(révision 4243)
+++ gsm-at-startup.c	(copie de travail)
@@ -10,8 +10,30 @@
 #include <gdk/gdkx.h>
 #include <gconf/gconf-client.h>
 
+#define AT_STARTUP_KEY    "/desktop/gnome/accessibility/startup/exec_ats"
+
 static Atom AT_SPI_IOR;
 
+static void
+gsm_assistive_tech_exec (gchar *exec_string)
+{
+  gchar    *s;
+  gboolean  success;
+  
+  success = FALSE;
+  s = g_find_program_in_path (exec_string);
+
+  if (s) {
+    success = gsm_exec_command_line_async (exec_string, NULL);
+    g_free (s);
+  }
+  
+  if (!success && !strcmp (exec_string, "gnopernicus")) {
+    /* backwards compatibility for 2.14 */
+    gsm_assistive_tech_exec ("orca");
+  }
+}
+
 static GdkFilterReturn 
 gsm_assistive_filter_watch (GdkXEvent *xevent, GdkEvent *event, gpointer data){
      XEvent *xev = (XEvent *)xevent;
@@ -64,7 +86,7 @@ gsm_assistive_registry_start (void)
      command = g_strdup (AT_SPI_REGISTRYD_DIR "/at-spi-registryd");
 
      gdk_window_set_events (w, GDK_PROPERTY_CHANGE_MASK);
-     gsm_exec_command_line_async (command, NULL);
+     gsm_assistive_tech_exec (command);
      gdk_window_add_filter (w, gsm_assistive_filter_watch, &tid);
      tid = g_timeout_add (2e3, gsm_assistive_filter_timeout, NULL);    
 
@@ -74,6 +96,33 @@ gsm_assistive_registry_start (void)
 
      g_free (command);
 }
+ 
+void 
+gsm_assistive_technologies_start (void)
+{
+  GError *error = NULL;
+  GConfClient *client;
+  GSList *list;
+
+  client  = gsm_get_conf_client ();
+  list = gconf_client_get_list (client, AT_STARTUP_KEY, GCONF_VALUE_STRING, &error);
+  if (error)
+    {
+      g_warning ("Error getting value of " AT_STARTUP_KEY ": %s", error->message);
+      g_error_free (error);
+    }
+  else
+    {
+      GSList *l;
+
+      for (l = list; l; l = l->next)
+	{
+	  gsm_assistive_tech_exec ((char *) l->data);
+	  g_free (l->data);
+	}
+      g_slist_free (list);
+    }
+}
 
 void
 gsm_at_set_gtk_modules (void)
Index: gsm-at-startup.h
===================================================================
--- gsm-at-startup.h	(révision 4243)
+++ gsm-at-startup.h	(copie de travail)
@@ -2,6 +2,7 @@
 #define GSM_AT_STARTUP_H
 
 void gsm_assistive_registry_start (void);
+void gsm_assistive_technologies_start (void);
 void gsm_at_set_gtk_modules (void);
 
 #endif /* GSM_AT_STARTUP_H */
Index: main.c
===================================================================
--- main.c	(révision 4243)
+++ main.c	(copie de travail)
@@ -489,6 +489,9 @@ main (int argc, char *argv[])
 
   start_session (the_session);
 
+  if (a_t_support) /* the ATs are happier if the session has started */
+    gsm_assistive_technologies_start ();
+
   gtk_main ();
 
   gsm_remote_desktop_cleanup ();
