Reverted Value interface since the new union was more complicated than necessary.
[platform/upstream/at-spi2-core.git] / test / simple-at.c
index 3fbf9fe..54ca155 100644 (file)
@@ -25,7 +25,6 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <cspi/spi.h>
 #include "../util/mag_client.h"
 #include "../cspi/spi-private.h" /* A hack for now */
 
@@ -58,16 +57,24 @@ main (int argc, char **argv)
   int i, j;
   int n_desktops;
   int n_apps;
+  char *s;
   Accessible *desktop;
   Accessible *application;
-  char *s;
+  const char *modules;
 
   if ((argc > 1) && (!strncmp (argv[1], "-h", 2)))
-  {
-    printf ("Usage: simple-at\n");
-    printf ("\tEnvironment variables used:\n\t\tFESTIVAL\n\t\tMAGNIFIER\n\t\tFESTIVAL_CHATTY\n");
-    exit (0);
-  }
+    {
+      printf ("Usage: simple-at\n");
+      printf ("\tEnvironment variables used:\n\t\tFESTIVAL\n\t\tMAGNIFIER\n\t\tFESTIVAL_CHATTY\n");
+      exit (0);
+    }
+
+  modules = g_getenv ("GTK_MODULES");
+  if (!modules || modules [0] == '\0')
+    {
+      putenv ("GTK_MODULES=gail:at-bridge");
+    }
+  modules = NULL;
 
   SPI_init ();
 
@@ -133,7 +140,7 @@ main (int argc, char **argv)
 
   SPI_event_main ();
 
-  setenv ("AT_BRIDGE_SHUTDOWN", "1", TRUE);
+  putenv ("AT_BRIDGE_SHUTDOWN=1");
 
   return SPI_exit ();
 }
@@ -155,6 +162,15 @@ get_environment_vars (void)
       fprintf (stderr, "Using magnifier\n");
       use_magnifier = TRUE;
     }  
+  else
+    {
+      fprintf (stderr, "Not using magnifier\n");
+    }
+
+  if (!use_festival)
+    {
+      fprintf (stderr, "No speech output\n");
+    }
 }
 
 void
@@ -167,7 +183,9 @@ report_focussed_accessible (Accessible *obj, SPIBoolean shutup_previous_speech)
     {
       if (festival_chatty)         
         {
-          _festival_say (Accessible_getRole (obj), "voice_don_diphone", shutup_previous_speech);
+         s = Accessible_getRoleName (obj);     
+          _festival_say (s, "voice_don_diphone", shutup_previous_speech);
+         SPI_freeString (s);
         }
       fprintf (stderr, "getting Name\n");
       s = Accessible_getName (obj);
@@ -227,7 +245,7 @@ report_focus_event (AccessibleEvent *event, void *user_data)
   g_return_if_fail (event->source != NULL);
 
   s = Accessible_getName (event->source);
-  if (cspi_warn_ev (cspi_ev (), "Report focus event"))
+  if (s)
     {
       fprintf (stderr, "%s event from %s\n", event->type, s);
       SPI_freeString (s);