2001-12-08 Michael Meeks <michael@ximian.com>
[platform/core/uifw/at-spi2-atk.git] / test / app.c
index b42508e..dc676d3 100644 (file)
@@ -1,13 +1,36 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <libbonobo.h>
+#include <bonobo-activation/bonobo-activation.h>
 #include <atk/atkobject.h>
-#include "Registry.h"
-#include "Event.h"
+#include <libspi/Accessibility.h>
 #include "accessible.h"
-#include "atksimpleobject.h"
 #include "application.h"
 
+#define APP_STATIC_BUFF_SZ 30
+
 int
 main(int argc, char **argv)
 {
@@ -15,12 +38,12 @@ main(int argc, char **argv)
         CORBA_Object oclient;
         AtkObject *atko;
         char *obj_id;
-        char sbuf[30];
+        char sbuf[APP_STATIC_BUFF_SZ];
 
         Accessibility_Registry registry;
         Accessibility_Event e;
-        Accessible *accessible;
-        Application *app;
+        SpiAccessible *accessible;
+        SpiApplication *app;
 
         CORBA_exception_init(&ev);
 
@@ -30,23 +53,23 @@ main(int argc, char **argv)
           }
 
         /* Create the accesssible application server object */
-        /* TODO: get app name and pid */
-        sprintf(sbuf, "application-%s", argv[1]);
-        app = application_new(sbuf, "test application for accessibility SPI", "0001");
-
-        /* Create the Accessible 'source' for the event */
-        atko = atk_simple_object_new ();
-        atk_object_set_name (atko, "dummy");
-        accessible = accessible_new (atko);
+        snprintf(sbuf, APP_STATIC_BUFF_SZ, "application-%s", argv[0]);
+
+        atko = g_object_new (atk_object_get_type(), NULL);
+        atk_object_set_name (atko, sbuf);
+        atk_object_set_description( atko, "test application for accessibility SPI");
+        app = spi_application_new(atko);
+
+        /* Create the SpiAccessible 'source' for the event */
+        accessible = spi_accessible_new (atko);
         fprintf(stderr, "accessible created.\n");
 
-        /* FIXME: this type of event struct will leak, needs to be redefined */
-        e.target = bonobo_object_corba_objref ( bonobo_object (accessible));
-        e.type = CORBA_string_dup ("test");
+        e.source = bonobo_object_corba_objref ( bonobo_object (accessible));
+        e.type = CORBA_string_dup ("focus:");
 
         obj_id = "OAFIID:Accessibility_Registry:proto0.1";
 
-        oclient = oaf_activate_from_id (obj_id, 0, NULL, &ev);
+        oclient = bonobo_activation_activate_from_id (obj_id, 0, NULL, &ev);
         if (ev._major != CORBA_NO_EXCEPTION) {
                 fprintf(stderr,
                 ("Accessibility app error: exception during registry activation from id: %s\n"),