2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
26 #include <libbonobo.h>
27 #include <bonobo-activation/bonobo-activation.h>
28 #include <atk/atkobject.h>
29 #include <libspi/Accessibility.h>
30 #include "accessible.h"
31 #include "application.h"
33 #define APP_STATIC_BUFF_SZ 30
36 main(int argc, char **argv)
42 char sbuf[APP_STATIC_BUFF_SZ];
44 Accessibility_Registry registry;
45 Accessibility_Event e;
46 SpiAccessible *accessible;
49 CORBA_exception_init(&ev);
51 if (!bonobo_init (&argc, argv))
53 g_error ("Could not initialize Bonobo");
56 /* Create the accesssible application server object */
57 g_snprintf(sbuf, APP_STATIC_BUFF_SZ, "application-%s", argv[0]);
59 atko = g_object_new (atk_object_get_type(), NULL);
60 atk_object_set_name (atko, sbuf);
61 atk_object_set_description( atko, "test application for accessibility SPI");
62 app = spi_application_new(atko);
64 /* Create the SpiAccessible 'source' for the event */
65 accessible = spi_accessible_new (atko);
66 fprintf(stderr, "accessible created.\n");
68 e.source = bonobo_object_corba_objref ( bonobo_object (accessible));
69 e.type = CORBA_string_dup ("focus:");
71 obj_id = "OAFIID:Accessibility_Registry:1.0";
73 oclient = bonobo_activation_activate_from_id (obj_id, 0, NULL, &ev);
74 if (ev._major != CORBA_NO_EXCEPTION) {
76 ("Accessibility app error: exception during registry activation from id: %s\n"),
77 CORBA_exception_id(&ev));
78 CORBA_exception_free(&ev);
82 if (CORBA_Object_is_nil (oclient, &ev))
84 g_error ("Could not locate registry");
87 registry = (Accessibility_Registry) oclient;
89 Accessibility_Registry_registerApplication (registry,
90 bonobo_object_corba_objref (bonobo_object (app)),
92 fprintf(stderr, "registerApplication has been called.\n");
94 Accessibility_Registry_notifyEvent (registry, &e, &ev);
95 fprintf (stderr, "notify event has been called.\n");
97 bonobo_main (); /* needed when app becomes a server ? */