-/* #include <libbonobo.h> */
-#include <stdio.h>
-#include "spi.h"
-
-static CORBA_Environment ev;
-static Accessibility_Registry registry;
-
-Accessible *
-Obj_Add (Accessible object)
-{
- /* TODO: keep list of live object refs */
- Accessible *oref = g_malloc (sizeof (Accessible));
- *oref = object;
- return oref;
-}
/*
*
*
*/
+/**
+ * SPI_init:
+ *
+ * Connects to the accessibility registry and initializes the SPI.
+ *
+ * Returns: 0 on success, otherwise an integer error code.
+ **/
int
SPI_init (void)
{
int argc = 0;
- CORBA_exception_init(&ev);
CORBA_Object oclient;
char *obj_id;
+ CORBA_exception_init(&ev);
+
if (!bonobo_init (&argc, NULL))
{
g_error ("Could not initialize Bonobo");
return 0;
}
+/**
+ * SPI_event_main:
+ * @isGNOMEApp: a #boolean indicating whether the client of the SPI
+ * will use the Gnome event loop or not. Clients that have
+ * their own GUIS will usually specify #TRUE here, and must
+ * do so if they use Gnome GUI components.
+ *
+ * Starts/enters the main event loop for the SPI services.
+ *
+ * (NOTE: This method does not return control, it is exited via a call to exit()
+ * from within an event handler).
+ *
+ **/
void
SPI_event_main (boolean isGNOMEApp)
{
- if (isGNOMEApp) bonobo_main();
- else CORBA_ORB_run (bonobo_orb(), &ev);
+ if (isGNOMEApp) {
+ g_atexit(SPI_exit);
+ bonobo_main();
+ }
+ else {
+ /* TODO: install signal handlers to do cleanup */
+ CORBA_ORB_run (bonobo_orb(), &ev);
+ fprintf (stderr, "orb loop exited...\n");
+ }
}
-/* Not Yet Implemented */
+/**
+ * SPI_eventIsReady:
+ *
+ * Checks to see if an SPI event is waiting in the event queue.
+ * Used by clients that don't wish to use SPI_event_main().
+ *
+ * Not Yet Implemented.
+ *
+ * Returns: #TRUE if an event is waiting, otherwise #FALSE.
+ *
+ **/
boolean
SPI_eventIsReady ()
{
return FALSE;
}
-/* Not Yet Implemented */
-AccessibleEvent *
-SPI_nextEvent (boolean waitForEvent)
-{
- return NULL;
-}
-
-void
-SPI_exit (void)
-{
- exit(0);
-}
-
-/*
+/**
+ * SPI_nextEvent:
+ * @waitForEvent: a #boolean indicating whether to block or not.
*
- * Global functions serviced by the registry
+ * Gets the next event in the SPI event queue; blocks if no event
+ * is pending and @waitForEvent is #TRUE.
+ * Used by clients that don't wish to use SPI_event_main().
*
- */
-
-boolean
-RegisterGlobalEventListener (AccessibleEventListener *listener,
- char *eventType)
-{
- Accessibility_Registry_registerGlobalEventListener (
- registry,
- *listener,
- eventType,
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- {
- return FALSE;
- }
- else
- {
- return TRUE;
- }
-}
-
-int
-GetDesktopCount ()
-{
- return Accessibility_Registry_getDesktopCount (registry, &ev);
-}
-
-Accessible
-*getDesktop (int n)
-{
- return Obj_Add (Accessibility_Registry_getDesktop (registry, n, &ev));
-}
-
-int
-getDesktopList (Accessible **list)
-{
- *list = NULL;
- return 0;
-}
-
-/* Not Yet Implemented */
-void
-registerKeystrokeListener (KeystrokeListener *listener)
-{
- ;
-}
-
-/* Not Yet Implemented */
-void
-generateKeyEvent (long keyCode, long meta)
-{
- ;
-}
-
-/* Not Yet Implemented */
-void
-generateMouseEvent (long x, long y, char *name)
-{
- ;
-}
-
-/*
+ * Not Yet Implemented.
*
- * Accessible function prototypes
+ * Returns: the next #AccessibleEvent in the SPI event queue.
*
- */
-
-int
-Accessible_ref (Accessible *obj)
-{
- return Accessibility_Accessible_ref (*obj, &ev);
-}
-
-
-int
-Accessible_unref (Accessible *obj)
-{
- return Accessibility_Accessible_unref (*obj, &ev);
-}
-
-char *
-Accessible_getName (Accessible *obj)
-{
- return Accessibility_Accessible__get_name (*obj, &ev);
-}
-
-char *
-Accessible_getDescription (Accessible *obj)
-{
- return Accessibility_Accessible__get_description (*obj, &ev);
-}
-
-Accessible *
-Accessible_getParent (Accessible *obj)
-{
- return Obj_Add (Accessibility_Accessible__get_parent (*obj, &ev));
-}
-
-long
-Accessible_getChildCount (Accessible *obj)
-{
- return Accessibility_Accessible_getChildCount (*obj, &ev);
-}
-
-Accessible *
-Accessible_getChildAtIndex (Accessible *obj,
- long childIndex)
-{
- return Obj_Add (Accessibility_Accessible_getChildAtIndex (*obj, childIndex, &ev));
-}
-
-long
-Accessible_getIndexInParent (Accessible *obj)
-{
- return Accessibility_Accessible_getIndexInParent (*obj, &ev);
-}
-
-/* Not Yet Implemented */
-AccessibleRelation **
-Accessible_getRelationSet (Accessible *obj)
-{
- return NULL;
-}
-
-/* Not Yet Implemented */
-char *
-Accessible_getRole (Accessible *obj)
-{
- return "";
-}
-
-/* Not Yet Implemented */
-AccessibleStateSet *
-Accessible_getStateSet (Accessible *obj)
+ **/
+AccessibleEvent *
+SPI_nextEvent (boolean waitForEvent)
{
return NULL;
}
-
-/*
+/**
+ * SPI_exit:
*
- * AccessibleApplication function prototypes
+ * Disconnects from the Accessibility Registry and releases resources.
*
- */
-
-int
-AccessibleApplication_ref (AccessibleApplication *obj)
-{
- return Accessibility_Application_ref (*obj, &ev);
-}
-
-int
-AccessibleApplication_unref (AccessibleApplication *obj)
-{
- return Accessibility_Application_unref (*obj, &ev);
-}
-
-char *
-AccessibleApplication_getToolkitName (AccessibleApplication *obj)
-{
- return Accessibility_Application__getToolkitName (*obj, &ev);
-}
-
-char *
-AccessibleApplication_getVersion (AccessibleApplication *obj)
-{
- return Accessibility_Application__getVersion (*obj, &ev);
-}
-
-long
-AccessibleApplication_getID (AccessibleApplication *obj)
-{
- return Accessibility_Application__getID (*obj, &ev);
-}
-
-/* Not Yet Implemented */
-boolean
-AccessibleApplication_pause (AccessibleApplication *obj)
-{
- return FALSE;
-}
-
-/* Not Yet Implemented */
-boolean
-AccessibleApplication_resume (AccessibleApplication *obj)
+ **/
+void
+SPI_exit (void)
{
- return FALSE;
+ fprintf (stderr, "bye-bye!\n");
+ exit(0);
}