2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
25 #include <libbonobo.h>
26 #include <bonobo-activation/bonobo-activation.h>
27 #include <atk/atkobject.h>
28 #include <libspi/Accessibility.h>
29 #include "accessible.h"
30 #include "application.h"
32 #define APP_STATIC_BUFF_SZ 30
35 main(int argc, char **argv)
41 char sbuf[APP_STATIC_BUFF_SZ];
43 Accessibility_SpiRegistry registry;
44 Accessibility_Event e;
45 SpiAccessible *accessible;
48 CORBA_exception_init(&ev);
50 if (!bonobo_init (&argc, argv))
52 g_error ("Could not initialize Bonobo");
55 /* Create the accesssible application server object */
56 snprintf(sbuf, APP_STATIC_BUFF_SZ, "application-%s", argv[0]);
58 atko = g_object_new (atk_object_get_type(), NULL);
59 atk_object_set_name (atko, sbuf);
60 atk_object_set_description( atko, "test application for accessibility SPI");
61 app = spi_application_new(atko);
63 /* Create the SpiAccessible 'source' for the event */
64 accessible = spi_accessible_new (atko);
65 fprintf(stderr, "accessible created.\n");
67 e.source = bonobo_object_corba_objref ( bonobo_object (accessible));
68 e.type = CORBA_string_dup ("focus:");
70 obj_id = "OAFIID:Accessibility_SpiRegistry:proto0.1";
72 oclient = bonobo_activation_activate_from_id (obj_id, 0, NULL, &ev);
73 if (ev._major != CORBA_NO_EXCEPTION) {
75 ("Accessibility app error: exception during registry activation from id: %s\n"),
76 CORBA_exception_id(&ev));
77 CORBA_exception_free(&ev);
81 if (CORBA_Object_is_nil (oclient, &ev))
83 g_error ("Could not locate registry");
86 registry = (Accessibility_SpiRegistry) oclient;
88 Accessibility_SpiRegistry_registerSpiApplication (registry,
89 bonobo_object_corba_objref (bonobo_object (app)),
91 fprintf(stderr, "registerSpiApplication has been called.\n");
93 Accessibility_SpiRegistry_notifyEvent (registry, &e, &ev);
94 fprintf (stderr, "notify event has been called.\n");
96 bonobo_main (); /* needed when app becomes a server ? */