readonly attribute string version;
/**
- * Get the application's process ID in the operating system's
- * process table.
+ * Get the application instance's unique ID as assigned by the registry.
*
**/
- readonly attribute string id;
+ attribute string id;
/**
* pause:
* Register a new application with the accessibility broker.
*
**/
- void registerApplication (in Application application);
+ oneway void registerApplication (in Application application);
/**
* deregisterApplication:
readonly attribute string version;
/**
- * Get the application's process ID in the operating system's
- * process table.
+ * Get the application instance's unique ID as assigned by the registry.
*
**/
- readonly attribute string id;
+ attribute string id;
/**
* pause:
* Register a new application with the accessibility broker.
*
**/
- void registerApplication (in Application application);
+ oneway void registerApplication (in Application application);
/**
* deregisterApplication:
libspiinclude_HEADERS = accessible.h \
application.h \
- atksimpleobject.h \
desktop.h \
listener.h \
registry.h \
accessible.h \
application.c \
application.h \
- atksimpleobject.c \
- atksimpleobject.h \
desktop.c \
desktop.h \
listener.c \
{
CORBA_char * retval;
Accessible *accessible = ACCESSIBLE (bonobo_object_from_servant (servant));
- retval = CORBA_string_dup (atk_object_get_name (accessible->atko));
+ retval = atk_object_get_name (accessible->atko);
+ if (retval )
+ retval = CORBA_string_dup (retval);
+ else
+ retval = CORBA_string_dup ("");
fprintf (stderr, "Accessible get_name called: %s\n", retval);
return retval;
}
*/
#include <config.h>
#include <bonobo/Bonobo.h>
-#include "atksimpleobject.h"
+#include <atk/atkutil.h>
/*
* This pulls the CORBA definitions for the "Accessibility::Accessible" server
*/
#define PARENT_TYPE ACCESSIBLE_TYPE
+/*
+ * A pointer to our parent object class
+ */
+static AccessibleClass *application_parent_class;
+
+/*
+ * Implemented GObject::finalize
+ */
+static void
+accessible_application_finalize (GObject *object)
+{
+ /* TODO: any necessary cleanup */
+ Accessible *accessible = ACCESSIBLE (object);
+
+ g_object_unref (accessible->atko);
+ accessible->atko = NULL;
+
+ /* TODO: chain to parent class instead */
+}
+
+static CORBA_string
+impl_accessibility_application_get_toolkit_name (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ CORBA_char *retval;
+ Application *application = APPLICATION (bonobo_object_from_servant (servant));
+ retval = CORBA_string_dup (atk_get_toolkit_name ());
+ return retval;
+}
+
+static CORBA_string
+impl_accessibility_application_get_version (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ CORBA_char *retval;
+ Application *application = APPLICATION (bonobo_object_from_servant (servant));
+ retval = CORBA_string_dup (atk_get_toolkit_version ());
+ return retval;
+}
+
+static CORBA_string
+impl_accessibility_application_get_id (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ CORBA_char *retval;
+ Application *application = APPLICATION (bonobo_object_from_servant (servant));
+ retval = CORBA_string_dup (application->id);
+ return retval;
+}
+
+static void
+impl_accessibility_application_set_id (PortableServer_Servant servant,
+ const CORBA_char *id,
+ CORBA_Environment *ev)
+{
+ Application *application = APPLICATION (bonobo_object_from_servant (servant));
+ application->id = id;
+}
+
static void
application_class_init (ApplicationClass *klass)
{
- ;
+ GObjectClass * object_class = (GObjectClass *) klass;
+ POA_Accessibility_Application__epv *epv = &klass->epv;
+
+ application_parent_class = g_type_class_ref (ACCESSIBLE_TYPE);
+
+ object_class->finalize = accessible_application_finalize;
+
+ epv->_get_toolkitName = impl_accessibility_application_get_toolkit_name;
+ epv->_get_version = impl_accessibility_application_get_version;
+ epv->_get_id = impl_accessibility_application_get_id;
+ epv->_set_id = impl_accessibility_application_set_id;
}
static void
application_init (Application *application)
{
- ACCESSIBLE (application)->atko = atk_simple_object_new();
+ ACCESSIBLE (application)->atko = g_object_new (atk_object_get_type(), NULL);
}
GType
}
Application *
-application_new (char *name, char *desc, char *id)
+application_new (AtkObject *app_root)
{
Application *retval =
APPLICATION (g_object_new (application_get_type (), NULL));
- atk_object_set_name (ACCESSIBLE (retval)->atko, CORBA_string_dup (name));
- atk_object_set_description (ACCESSIBLE (retval)->atko, CORBA_string_dup (desc));
- retval->id = CORBA_string_dup (id);
+ ACCESSIBLE (retval)->atko = app_root;
return retval;
}
} ApplicationClass;
GType application_get_type (void);
-Application *application_new (char *name, char *desc, char *id);
+gboolean *application_set_id (AtkObject *app, char *id);
+Application *application_new (AtkObject *app_root);
+
#ifdef __cplusplus
}
+++ /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 <stdio.h>
-#include "atksimpleobject.h"
-
-static void atk_simple_object_class_init (AtkSimpleObjectClass *klass);
-
-static gpointer parent_class = NULL;
-
-GType
-atk_simple_object_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- static const GTypeInfo tinfo =
- {
- sizeof (AtkSimpleObjectClass),
- (GBaseInitFunc) NULL, /* base init */
- (GBaseFinalizeFunc) NULL, /* base finalize */
- (GClassInitFunc) atk_simple_object_class_init, /* class init */
- (GClassFinalizeFunc) NULL, /* class finalize */
- NULL, /* class data */
- sizeof (AtkSimpleObject), /* instance size */
- 0, /* nb preallocs */
- (GInstanceInitFunc) NULL, /* instance init */
- NULL /* value table */
- };
-
- type = g_type_register_static (ATK_TYPE_OBJECT,
- "AtkSimpleObject", &tinfo, 0);
- }
- return type;
-}
-
-static void
-atk_simple_object_set_name (AtkObject *o, const gchar *name)
-{
- printf("set name to %s\n", name);
- o->name = name;
-}
-
-static G_CONST_RETURN gchar *
-atk_simple_object_get_name (AtkObject *o)
-{
- printf("get name: %s\n", o->name);
- return (o->name);
-}
-
-
-static void
-atk_simple_object_set_description (AtkObject *o, const gchar *desc)
-{
- printf("set description to %s\n", desc);
- o->description = desc;
-}
-
-static G_CONST_RETURN gchar *
-atk_simple_object_get_description (AtkObject *o)
-{
- printf("get description: %s\n", o->description);
- return (o->description);
-}
-
-static void
-atk_simple_object_class_init (AtkSimpleObjectClass *klass)
-{
- AtkObjectClass *oc = ATK_OBJECT_CLASS (klass);
- parent_class = g_type_class_ref (ATK_TYPE_OBJECT);
- oc->set_name = atk_simple_object_set_name;
- oc->get_name = atk_simple_object_get_name;
- oc->set_description = atk_simple_object_set_description;
- oc->get_description = atk_simple_object_get_description;
-}
-
-AtkObject*
-atk_simple_object_new ()
-{
- GObject *object;
- AtkObject* accessible;
-
- object = g_object_new (ATK_TYPE_SIMPLE_OBJECT, NULL);
- accessible = ATK_OBJECT (object);
-
- return accessible;
-}
-
+++ /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.
- */
-
-#ifndef __ATK_SIMPLE_OBJECT_H__
-#define __ATK_SIMPLE_OBJECT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <glib-object.h>
-#include <atk/atkobject.h>
-
-#define ATK_TYPE_SIMPLE_OBJECT (atk_simple_object_get_type ())
-#define ATK_SIMPLE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_SIMPLE_OBJECT, AtkSimpleObject))
-#define ATK_SIMPLE_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_SIMPLE_OBJECT, AtkSimpleObjectClass))
-#define ATK_IS_SIMPLE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_SIMPLE_OBJECT))
-#define ATK_IS_SIMPLE_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_SIMPLE_OBJECT))
-#define ATK_SIMPLE_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_SIMPLE_OBJECT, AtkSimpleObjectClass))
-
-typedef struct _AtkSimpleObject AtkSimpleObject;
-typedef struct _AtkSimpleObjectClass AtkSimpleObjectClass;
-
-struct _AtkSimpleObject
-{
- AtkObject parent;
-};
-
-GType atk_simple_object_get_type (void);
-
-struct _AtkSimpleObjectClass
-{
- AtkObjectClass parent_class;
-};
-
-AtkObject *atk_simple_object_new ();
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __ATK_SIMPLE_OBJECT_H__ */
-
static void
desktop_init (Desktop *desktop)
{
- ACCESSIBLE (desktop)->atko = atk_simple_object_new();
+ ACCESSIBLE (desktop)->atko = g_object_new (atk_object_get_type(), NULL);
atk_object_set_name (ATK_OBJECT (ACCESSIBLE (desktop)->atko), "main");
}
#include <bonobo/bonobo-xobject.h>
#include <atk/atkobject.h>
-#include <atksimpleobject.h>
#include <accessible.h>
#include <application.h>
#include <libspi/Accessibility.h>
*/
static ListenerClass *registry_parent_class;
+typedef enum {
+ ETYPE_FOCUS,
+ ETYPE_WINDOW,
+ ETYPE_TOOLKIT,
+ ETYPE_LAST_DEFINED
+} EventTypeMajor;
+
+typedef struct {
+ EventTypeMajor major;
+ char * minor;
+ char * detail;
+} EventTypeStruct;
+
+
/*
* Implemented GObject::finalize
*/
#ifdef SPI_DEBUG
fprintf (stderr, "registering app %p\n", application);
#endif
+ ORBit_register_objref (application);
+ registry->desktop->applications = g_list_append (registry->desktop->applications,
+ CORBA_Object_duplicate (application, ev));
+
+ /* TODO: create unique string here (with libuuid call ?) */
+ Accessibility_Application__set_id (application, "test-some-unique-string", ev);
- registry->desktop->applications = g_list_append (registry->desktop->applications, CORBA_Object_duplicate (application, ev));
/*
* TODO: change the implementation below to a WM-aware one;
* e.g. don't add all apps to the Desktop
*/
- /* registry->desktop->applications = registry->applications;*/
+}
+
+static gint
+compare_object_hash (gconstpointer p1, gconstpointer p2)
+{
+ CORBA_Environment ev;
+ long long diff = ((CORBA_Object_hash ((CORBA_Object) p2, (CORBA_unsigned_long) 0, &ev)) -
+ (CORBA_Object_hash ((CORBA_Object) p1, (CORBA_unsigned_long) 0, &ev)));
+ return ((diff < 0) ? -1 : ((diff > 0) ? 1 : 0));
+}
+
+static void
+parse_event_type (EventTypeStruct *etype, char *event_name)
+{
+ etype->major = ETYPE_FOCUS;
}
/**
CORBA_Environment * ev)
{
Registry *registry = REGISTRY (bonobo_object_from_servant (servant));
- registry->applications = g_list_remove (registry->applications, application);
+ GList *list = g_list_find_custom (registry->applications, application, compare_object_hash);
+ if (list)
+ {
+ fprintf (stderr, "deregistering application\n");
+ registry->applications = g_list_delete_link (registry->applications, list);
+ }
}
/*
Registry *registry = REGISTRY (bonobo_object_from_servant (servant));
/* fprintf(stderr, "registering %x/%x\n", listener, *listener); */
+ EventTypeStruct etype;
+ parse_event_type (&etype, event_name);
+
+ /* parse, check major event type */
+ switch (etype.major)
+ {
+ case (ETYPE_FOCUS) :
+ break;
+ case (ETYPE_WINDOW) :
+ break;
+ case (ETYPE_TOOLKIT) :
+ break;
+ default:
+ break;
+ }
+
registry->listeners = g_list_append (registry->listeners, CORBA_Object_duplicate(listener, ev));
/* fprintf(stderr, "there are now %d listeners registered.\n", g_list_length(registry->listeners)); */
/* should use hashtable and CORBA_Object_hash (...) */
static void
desktop_init (Desktop *desktop)
{
- ACCESSIBLE (desktop)->atko = atk_simple_object_new();
+ ACCESSIBLE (desktop)->atko = g_object_new (atk_object_get_type(), NULL);
atk_object_set_name (ATK_OBJECT (ACCESSIBLE (desktop)->atko), "main");
}
#include <bonobo/bonobo-xobject.h>
#include <atk/atkobject.h>
-#include <atksimpleobject.h>
#include <accessible.h>
#include <application.h>
#include <libspi/Accessibility.h>
registry = registry_new ();
- oaf_active_server_register (
+ bonobo_activation_active_server_register (
obj_id,
bonobo_object_corba_objref (bonobo_object (registry)));
*/
static ListenerClass *registry_parent_class;
+typedef enum {
+ ETYPE_FOCUS,
+ ETYPE_WINDOW,
+ ETYPE_TOOLKIT,
+ ETYPE_LAST_DEFINED
+} EventTypeMajor;
+
+typedef struct {
+ EventTypeMajor major;
+ char * minor;
+ char * detail;
+} EventTypeStruct;
+
+
/*
* Implemented GObject::finalize
*/
#ifdef SPI_DEBUG
fprintf (stderr, "registering app %p\n", application);
#endif
+ ORBit_register_objref (application);
+ registry->desktop->applications = g_list_append (registry->desktop->applications,
+ CORBA_Object_duplicate (application, ev));
+
+ /* TODO: create unique string here (with libuuid call ?) */
+ Accessibility_Application__set_id (application, "test-some-unique-string", ev);
- registry->desktop->applications = g_list_append (registry->desktop->applications, CORBA_Object_duplicate (application, ev));
/*
* TODO: change the implementation below to a WM-aware one;
* e.g. don't add all apps to the Desktop
*/
- /* registry->desktop->applications = registry->applications;*/
+}
+
+static gint
+compare_object_hash (gconstpointer p1, gconstpointer p2)
+{
+ CORBA_Environment ev;
+ long long diff = ((CORBA_Object_hash ((CORBA_Object) p2, (CORBA_unsigned_long) 0, &ev)) -
+ (CORBA_Object_hash ((CORBA_Object) p1, (CORBA_unsigned_long) 0, &ev)));
+ return ((diff < 0) ? -1 : ((diff > 0) ? 1 : 0));
+}
+
+static void
+parse_event_type (EventTypeStruct *etype, char *event_name)
+{
+ etype->major = ETYPE_FOCUS;
}
/**
CORBA_Environment * ev)
{
Registry *registry = REGISTRY (bonobo_object_from_servant (servant));
- registry->applications = g_list_remove (registry->applications, application);
+ GList *list = g_list_find_custom (registry->applications, application, compare_object_hash);
+ if (list)
+ {
+ fprintf (stderr, "deregistering application\n");
+ registry->applications = g_list_delete_link (registry->applications, list);
+ }
}
/*
Registry *registry = REGISTRY (bonobo_object_from_servant (servant));
/* fprintf(stderr, "registering %x/%x\n", listener, *listener); */
+ EventTypeStruct etype;
+ parse_event_type (&etype, event_name);
+
+ /* parse, check major event type */
+ switch (etype.major)
+ {
+ case (ETYPE_FOCUS) :
+ break;
+ case (ETYPE_WINDOW) :
+ break;
+ case (ETYPE_TOOLKIT) :
+ break;
+ default:
+ break;
+ }
+
registry->listeners = g_list_append (registry->listeners, CORBA_Object_duplicate(listener, ev));
/* fprintf(stderr, "there are now %d listeners registered.\n", g_list_length(registry->listeners)); */
/* should use hashtable and CORBA_Object_hash (...) */
registry = registry_new ();
- oaf_active_server_register (
+ bonobo_activation_active_server_register (
obj_id,
bonobo_object_corba_objref (bonobo_object (registry)));
#include <atk/atkobject.h>
#include <libspi/Accessibility.h>
#include "accessible.h"
-#include "atksimpleobject.h"
#include "application.h"
int
/* Create the accesssible application server object */
/* TODO: get app name and pid */
sprintf(sbuf, "application-%s", argv[1]);
- app = application_new(sbuf, "test application for accessibility SPI", "0001");
+ atko = g_object_new (atk_object_get_type(), NULL);
+ atk_object_set_name (atko, "sbuf");
+ atk_object_set_description( atko, "test application for accessibility SPI");
+ app = application_new(atko);
/* Create the Accessible 'source' for the event */
- atko = atk_simple_object_new ();
- atk_object_set_name (atko, "dummy");
accessible = accessible_new (atko);
fprintf(stderr, "accessible created.\n");
obj_id = "OAFIID:Accessibility_Registry:proto0.1";
- oclient = oaf_activate_from_id (obj_id, 0, NULL, &ev);
+ oclient = bonobo_activation_activate_from_id (obj_id, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
fprintf(stderr,
("Accessibility app error: exception during registry activation from id: %s\n"),
obj_id = "OAFIID:Accessibility_Registry:proto0.1";
- oclient = oaf_activate_from_id (obj_id, 0, NULL, &ev);
+ oclient = bonobo_activation_activate_from_id (obj_id, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
fprintf(stderr,
("Accessibility app error: exception during registry activation from id: %s\n"),