2001-08-18 Bill Haneman <bill.haneman@sun.com>
+ * Makefile.am : changed build order to build test last.
+ * cspi/spi.h :
+ * cspi/spi_main.c :
+ Changed "createEventListener" to "CreateEventListener".
+ * libspi/accessibleeventlistener.c :
+ Bugfix for addition of callbacks.
+ * test/Makefile.am :
+ * test/simple-at.c :
+ Added new test that uses the C bindings API.
+
+2001-08-18 Bill Haneman <bill.haneman@sun.com>
+
* Makefile.am:
* configure.in :
* cspi/Makefile.am :
-SUBDIRS=po docs idl libspi registryd test at-bridge cspi
+SUBDIRS=po docs idl libspi registryd at-bridge cspi test
EXTRA_DIST= xml-i18n-extract.in xml-i18n-merge.in xml-i18n-update.in
*/
AccessibleEventListener *
-createEventListener (AccessibleEventListenerCB callback);
+CreateEventListener (AccessibleEventListenerCB callback);
boolean
EventListener_addCallback (AccessibleEventListener *listener,
{
accessible_event_listener_add_callback (listener, callback);
}
+ return listener;
}
boolean
long
Accessible_getChildCount (Accessible *obj)
{
- return Accessibility_Accessible_getChildCount (*obj, &ev);
+ return Accessibility_Accessible__get_childCount (*obj, &ev);
}
Accessible *
long
AccessibleApplication_getID (AccessibleApplication *obj)
{
- return Accessibility_Application__getID (*obj, &ev);
+ return Accessibility_Application__get_id (*obj, &ev);
}
/* Not Yet Implemented */
for (n=0; n<len; ++n)
{
cb = (VoidEventListenerCB) g_list_nth_data (listener->callbacks, n);
- (*cb) (NULL);
+ if (cb)
+ {
+ (*cb) (NULL);
+ }
}
bonobo_object_release_unref (e->target, ev);
}
void accessible_event_listener_add_callback (AccessibleEventListener *listener,
VoidEventListenerCB callback)
{
- listener->callbacks = g_list_append (listener->callbacks, listener);
+ listener->callbacks = g_list_append (listener->callbacks, callback);
}
void accessible_event_listener_remove_callback (AccessibleEventListener *listener,
VoidEventListenerCB callback)
{
- listener->callbacks = g_list_remove (listener->callbacks, listener);
+ listener->callbacks = g_list_remove (listener->callbacks, callback);
}
for (n=0; n<len; ++n)
{
cb = (VoidEventListenerCB) g_list_nth_data (listener->callbacks, n);
- (*cb) (NULL);
+ if (cb)
+ {
+ (*cb) (NULL);
+ }
}
bonobo_object_release_unref (e->target, ev);
}
void accessible_event_listener_add_callback (AccessibleEventListener *listener,
VoidEventListenerCB callback)
{
- listener->callbacks = g_list_append (listener->callbacks, listener);
+ listener->callbacks = g_list_append (listener->callbacks, callback);
}
void accessible_event_listener_remove_callback (AccessibleEventListener *listener,
VoidEventListenerCB callback)
{
- listener->callbacks = g_list_remove (listener->callbacks, listener);
+ listener->callbacks = g_list_remove (listener->callbacks, callback);
}
NULL=
-noinst_PROGRAMS = at app
+noinst_PROGRAMS = at app simple-at
at_SOURCES = at.c
app_SOURCES = app.c
+simple_at_SOURCES = simple-at.c
+
INCLUDES = -I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/libspi \
-I$(top_builddir)/libspi \
+ -I$(top_srcdir)/cspi \
+ -I$(top_builddir)/cspi \
$(TESTS_CFLAGS)
DEBUG_CFLAGS=-DSPI_DEBUG
CFLAGS += $(TESTS_CFLAGS) $(DEBUG_CFLAGS)
-LDADD = ../libspi/libspi.la $(TESTS_LIBS)
+LDADD = ../libspi/libspi.la ../cspi/libcspi.la $(TESTS_LIBS)
--- /dev/null
+/*
+ * 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 <stdlib.h>
+#include "spi.h"
+
+void report_focus_event (void *fp);
+
+void report_button_press (void *fp);
+
+int
+main(int argc, char **argv)
+{
+ int i, j;
+ int n_desktops;
+ int n_apps;
+ Accessible *desktop;
+ Accessible *application;
+ AccessibleEventListener *focus_listener;
+ AccessibleEventListener *button_listener;
+
+ SPI_init();
+
+ focus_listener = CreateEventListener (report_focus_event);
+ button_listener = CreateEventListener (report_button_press);
+
+ RegisterGlobalEventListener (focus_listener, "focus:");
+ RegisterGlobalEventListener (button_listener, "Gtk:GtkWidget:button-press-event");
+
+ n_desktops = GetDesktopCount ();
+
+ for (i=0; i<n_desktops; ++i)
+ {
+ desktop = getDesktop (i);
+ fprintf (stderr, "desktop %d name: %s\n", i, Accessible_getName (desktop));
+ n_apps = Accessible_getChildCount (desktop);
+ for (j=0; j<n_apps; ++j)
+ {
+ application = Accessible_getChildAtIndex (desktop, j);
+ fprintf (stderr, "app %d name: %s\n", j, Accessible_getName (application));
+ }
+ }
+ SPI_event_main(FALSE);
+}
+
+void
+report_focus_event (void *fp)
+{
+ fprintf (stderr, "focus\n");
+}
+
+void
+report_button_press (void *fp)
+{
+ fprintf (stderr, "button press\n");
+}