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>
28 #include "accessible.h"
33 main(int argc, char **argv)
39 CORBA_short n_desktops;
42 Accessibility_Desktop desktop;
43 Accessibility_Application app;
45 Accessibility_Registry registry;
48 CORBA_exception_init(&ev);
50 if (!bonobo_init (&argc, argv))
52 g_error ("Could not initialize Bonobo");
55 obj_id = "OAFIID:Accessibility_Registry:proto0.1";
57 oclient = oaf_activate_from_id (obj_id, 0, NULL, &ev);
58 if (ev._major != CORBA_NO_EXCEPTION) {
60 ("Accessibility app error: exception during registry activation from id: %s\n"),
61 CORBA_exception_id(&ev));
62 CORBA_exception_free(&ev);
66 if (CORBA_Object_is_nil (oclient, &ev))
68 g_error ("Could not locate registry");
73 listener = listener_new ();
75 registry = (Accessibility_Registry) oclient;
77 Accessibility_Registry_registerGlobalEventListener
79 (Accessibility_EventListener)
80 bonobo_object_corba_objref (bonobo_object (listener)),
84 fprintf (stderr, "AT callback registered.\n");
87 n_desktops = Accessibility_Registry_getDesktopCount (registry, &ev);
89 for (i=0; i<n_desktops; ++i)
91 desktop = Accessibility_Registry_getDesktop (registry, i, &ev);
92 fprintf (stderr, "desktop %d name: %s\n", i,
93 Accessibility_Desktop__get_name (desktop, &ev));
94 n_apps = Accessibility_Desktop__get_childCount (desktop, &ev);
95 fprintf (stderr, "desktop has %d apps:\n", n_apps);
96 for (j=0; j<n_apps; ++j)
98 app = (Accessibility_Application) Accessibility_Desktop_getChildAtIndex (desktop, j, &ev);
99 fprintf (stderr, "app %d name: %s\n", j,
100 Accessibility_Application__get_name (app, &ev));
104 fprintf (stderr, "finished querying desktop(s).\n");
106 /* needed by at because it is a server ? */