* AT-SPI - Assistive Technology Service Provider Interface
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
*
- * Copyright 2001 Sun Microsystems Inc.
+ * Copyright 2008, Codethink Ltd.
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* Boston, MA 02111-1307, USA.
*/
-/* registry.c: the main accessibility service registry implementation */
-
-#undef SPI_LISTENER_DEBUG
-
#include <config.h>
-#ifdef SPI_DEBUG
-# include <stdio.h>
-#endif
+#include <spi-common/spi-dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
-#include <bonobo/bonobo-exception.h>
-#include "../libspi/spi-private.h"
#include "registry.h"
-/* Our parent GObject type */
-#define PARENT_TYPE SPI_LISTENER_TYPE
-
-/* A pointer to our parent object class */
-static SpiListenerClass *spi_registry_parent_class;
-
-typedef enum {
- ETYPE_FOCUS,
- ETYPE_OBJECT,
- ETYPE_PROPERTY,
- ETYPE_WINDOW,
- ETYPE_TOOLKIT,
- ETYPE_KEYBOARD,
-
- ETYPE_LAST_DEFINED
-} EventTypeCategory;
-
-typedef struct {
- char *event_name;
- EventTypeCategory type_cat;
- GQuark major; /* from string segment[1] */
- GQuark minor; /* from string segment[1]+segment[2] */
- GQuark detail; /* from string segment[3] (not concatenated) */
-} EventTypeStruct;
-
-typedef struct {
- Accessibility_EventListener listener;
- GQuark event_type_quark;
- EventTypeCategory event_type_cat;
-} SpiListenerStruct;
-
-
-SpiListenerStruct *
-spi_listener_struct_new (Accessibility_EventListener listener, CORBA_Environment *ev)
-{
- SpiListenerStruct *retval = g_malloc (sizeof (SpiListenerStruct));
- retval->listener = bonobo_object_dup_ref (listener, ev);
- return retval;
-}
-
-
-void
-spi_listener_struct_free (SpiListenerStruct *ls, CORBA_Environment *ev)
-{
- bonobo_object_release_unref (ls->listener, ev);
- g_free (ls);
-}
+/*---------------------------------------------------------------------------*/
+G_DEFINE_TYPE(SpiRegistry, spi_registry, G_TYPE_OBJECT)
static void
-spi_registry_object_finalize (GObject *object)
-{
- printf ("spi_registry_object_finalize called\n");
-
- /* TODO: unref deviceeventcontroller, which disconnects key listener */
- G_OBJECT_CLASS (spi_registry_parent_class)->finalize (object);
-}
-
-static long
-_get_unique_id (void)
+spi_registry_class_init (SpiRegistryClass *klass)
{
- static long id = 0;
+ GObjectClass * object_class = (GObjectClass *) klass;
- return ++id;
+ spi_registry_parent_class = g_type_class_ref (G_TYPE_OBJECT);
}
-/**
- * registerApplication:
- * @application: a reference to the requesting @Application
- * return values: void
- *
- * Register a new application with the accessibility broker.
- *
- **/
static void
-impl_accessibility_registry_register_application (PortableServer_Servant servant,
- const Accessibility_Application application,
- CORBA_Environment * ev)
+spi_registry_init (SpiRegistry *registry)
{
- SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
-
-#ifdef SPI_DEBUG
- fprintf (stderr, "registering app %p\n", application);
-#endif
- spi_desktop_add_application (registry->desktop, application);
-
- Accessibility_Application__set_id (application, _get_unique_id (), ev);
-
- /*
- * TODO: change the implementation below to a WM-aware one;
- * e.g. don't add all apps to the SpiDesktop
- */
+ registry->apps = g_sequence_new (g_free);
}
-#ifdef USE_A_HASH_IN_FUTURE
-static gint
-compare_corba_objects (gconstpointer p1, gconstpointer p2)
+/*---------------------------------------------------------------------------*/
+
+static void emit(SpiRegistry *reg, const char *itf, const char *name, int ftype, ...)
{
- CORBA_Environment ev;
- gint retval;
+ va_list arg;
-#ifdef SPI_DEBUG
- fprintf (stderr, "comparing %p to %p\n",
- p1, p2);
-#endif
-
- retval = !CORBA_Object_is_equivalent ((CORBA_Object) p1, (CORBA_Object) p2, &ev);
- return retval;
+ va_start(arg, ftype);
+ spi_dbus_emit_valist(reg->bus, SPI_DBUS_PATH_DEC, itf, name, ftype, arg);
+ va_end(arg);
}
-#endif
+
+/*---------------------------------------------------------------------------*/
static void
-register_with_toolkits (SpiRegistry *spi_registry_bonobo_object, EventTypeStruct *etype, CORBA_Environment *ev)
+add_bus_name_cb (gpointer item, gpointer data)
{
- gint n_desktops;
- gint n_apps;
- gint i, j;
- Accessibility_Desktop desktop;
- Accessibility_Application app;
- Accessibility_Registry registry;
- registry = BONOBO_OBJREF (spi_registry_bonobo_object);
-
- /* for each app in each desktop, call ...Application_registerToolkitEventListener */
+ DBusMessageIter *iter_array = (DBusMessageIter *) data;
- n_desktops = Accessibility_Registry_getDesktopCount (registry, ev);
-
- for (i=0; i<n_desktops; ++i)
- {
- desktop = Accessibility_Registry_getDesktop (registry, i, ev);
- n_apps = Accessibility_Desktop__get_childCount (desktop, ev);
- for (j=0; j<n_apps; ++j)
- {
- app = (Accessibility_Application) Accessibility_Desktop_getChildAtIndex (desktop,
- j,
- ev);
- Accessibility_Application_registerToolkitEventListener (app,
- registry,
- CORBA_string_dup (etype->event_name),
- ev);
- }
- }
+ dbus_message_iter_append_basic (iter_array, DBUS_TYPE_STRING, (gchar **) &item);
}
-#ifdef USE_A_HASH_IN_FUTURE
-
-static gint
-compare_listener_quarks (gconstpointer p1, gconstpointer p2)
+static DBusMessage *
+impl_getApplications (DBusConnection *bus, DBusMessage *message, void *user_data)
{
- return (((SpiListenerStruct *)p2)->event_type_quark !=
- ((SpiListenerStruct *)p1)->event_type_quark);
-}
+ DBusMessage *reply;
+ DBusMessageIter iter, iter_array;
+ SpiRegistry *reg = SPI_REGISTRY (user_data);
-static gint
-compare_listener_corbaref (gconstpointer p1, gconstpointer p2)
-{
- return compare_corba_objects (((SpiListenerStruct *)p2)->listener,
- ((SpiListenerStruct *)p1)->listener);
+ reply = dbus_message_new_method_return (message);
+
+ dbus_message_iter_init_append (reply, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &iter_array);
+ g_sequence_foreach (reg->apps, add_bus_name_cb, &iter_array);
+ dbus_message_iter_close_container(&iter, &iter_array);
+ return reply;
}
-#endif
-static void
-parse_event_type (EventTypeStruct *etype, const char *event_name)
+static DBusHandlerResult
+message_handler (DBusConnection *bus, DBusMessage *message, void *user_data)
{
- gchar **split_string;
- gchar *s;
-
- split_string = g_strsplit (event_name, ":", 4);
- etype->event_name = g_strdup (event_name);
-
- if (!g_ascii_strncasecmp (event_name, "focus:", 6))
- {
- etype->type_cat = ETYPE_FOCUS;
- }
- else if (!g_ascii_strncasecmp (event_name, "object:", 7))
- {
- etype->type_cat = ETYPE_OBJECT;
- }
- else if (!g_ascii_strncasecmp (event_name, "window:", 7))
- {
- etype->type_cat = ETYPE_WINDOW;
- }
- else
- {
- etype->type_cat = ETYPE_TOOLKIT;
- }
+ DBusMessage *reply = NULL;
- if (split_string[1])
+ if (dbus_message_is_method_call (message, SPI_DBUS_INTERFACE_REGISTRY, "getApplications"))
{
- if (split_string[2])
+ reply = impl_getApplications (bus, message, user_data);
+ if (reply)
{
- etype->minor = g_quark_from_string (s = g_strconcat (split_string[1], split_string[2], NULL));
- g_free (s);
- if (split_string[3])
- {
- etype->detail = g_quark_from_string (split_string[3]);
- s = g_strconcat (split_string[1], split_string[2], split_string[3], NULL);
- etype->major = g_quark_from_string (s);
- g_free (s);
- }
- else
- {
- etype->detail = g_quark_from_static_string ("");
- s = g_strconcat (split_string[1], split_string[2], NULL);
- etype->major = g_quark_from_string (s);
- g_free (s);
- }
- }
- else
- {
- etype->major = g_quark_from_string (split_string[1]);
- etype->minor = etype->major;
- etype->detail = etype->major;
+ dbus_connection_send (bus, reply, NULL);
+ dbus_message_unref (reply);
}
+ return DBUS_HANDLER_RESULT_HANDLED;
}
else
{
- etype->major = g_quark_from_static_string ("");
- etype->minor = etype->major;
- etype->detail = etype->major;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
-
- g_strfreev (split_string);
}
-/**
- * deregisterApplication:
- * @application: a reference to the @Application
- * to be deregistered.
- * return values: void
- *
- * De-register an application previously registered with the broker.
- *
- **/
-static void
-impl_accessibility_registry_deregister_application (PortableServer_Servant servant,
- const Accessibility_Application application,
- CORBA_Environment * ev)
-{
- SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
-
- spi_desktop_remove_application (registry->desktop, application);
+/*---------------------------------------------------------------------------*/
-#ifdef SPI_DEBUG
- fprintf (stderr, "de-registered app %p\n", application);
-#endif
-}
-
-static GList **
-get_listener_list (SpiRegistry *registry,
- EventTypeCategory cat)
+static gint
+data_str_cmp (gpointer a, gpointer b, gpointer data)
{
- GList **ret;
-
- switch (cat)
- {
- case ETYPE_OBJECT:
- case ETYPE_PROPERTY:
- case ETYPE_FOCUS:
- ret = ®istry->object_listeners;
- break;
- case ETYPE_WINDOW:
- ret = ®istry->window_listeners;
- break;
- case ETYPE_TOOLKIT:
- ret = ®istry->toolkit_listeners;
- break;
- case ETYPE_KEYBOARD:
- default:
- ret = NULL;
- break;
- }
- return ret;
+ return g_strcmp0(a, b);
}
-/*
- * CORBA Accessibility::Registry::registerGlobalEventListener method implementation
- */
-static void
-impl_accessibility_registry_register_global_event_listener (
- PortableServer_Servant servant,
- Accessibility_EventListener listener,
- const CORBA_char *event_name,
- CORBA_Environment *ev)
+static gboolean
+seq_remove_string (GSequence *seq, gchar *str)
{
- SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
- SpiListenerStruct *ls = spi_listener_struct_new (listener, ev);
- EventTypeStruct etype;
- GList **list;
-
-#ifdef SPI_DEBUG
- fprintf (stderr, "registering for events of type %s\n", event_name);
-#endif
-
- /* parse, check major event type and add listener accordingly */
- parse_event_type (&etype, event_name);
- ls->event_type_quark = etype.major;
- ls->event_type_cat = etype.type_cat;
+ GSequenceIter *iter;
+ gchar *item;
+ gboolean res = FALSE;
- list = get_listener_list (registry, etype.type_cat);
+ iter = g_sequence_search (seq, str, (GCompareDataFunc) data_str_cmp, NULL);
+ iter = g_sequence_iter_prev (iter);
- if (list)
+ if (!g_sequence_iter_is_end (iter))
{
- *list = g_list_prepend (*list, ls);
-
- if (etype.type_cat == ETYPE_TOOLKIT)
+ item = g_sequence_get (iter);
+ if (!g_strcmp0 (item, str))
{
- register_with_toolkits (registry, &etype, ev);
- }
- }
- else
- {
- spi_listener_struct_free (ls, ev);
- }
-}
-
-static SpiReEnterantContinue
-remove_listener_cb (GList * const *list, gpointer user_data)
-{
- SpiListenerStruct *ls = (SpiListenerStruct *) (*list)->data;
- CORBA_Environment ev;
- Accessibility_EventListener listener = user_data;
-
- CORBA_exception_init (&ev);
-
- if (CORBA_Object_is_equivalent (ls->listener, listener, &ev))
- {
- spi_re_enterant_list_delete_link (list);
- spi_listener_struct_free (ls, &ev);
+ g_sequence_remove (iter);
+ res = TRUE;
+ }
}
-
- CORBA_exception_free (&ev);
-
- return SPI_RE_ENTERANT_CONTINUE;
+ return res;
}
-/*
- * CORBA Accessibility::Registry::deregisterGlobalEventListenerAll method implementation
- */
static void
-impl_accessibility_registry_deregister_global_event_listener_all (
- PortableServer_Servant servant,
- Accessibility_EventListener listener,
- CORBA_Environment *ev)
+handle_register_application (SpiRegistry *reg, DBusMessage *message)
{
- int i;
- GList **lists[2];
- SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
-
- lists[0] = ®istry->object_listeners;
- lists[1] = ®istry->window_listeners;
- lists[2] = ®istry->toolkit_listeners;
+ gchar *app_name;
- for (i = 0; i < sizeof (lists) / sizeof (lists[0]); i++)
- {
- spi_re_enterant_list_foreach (lists [i], remove_listener_cb, listener);
- }
+ if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &app_name, DBUS_TYPE_INVALID))
+ g_sequence_insert_sorted (reg->apps, app_name, (GCompareDataFunc) data_str_cmp, NULL);
}
-
-/*
- * CORBA Accessibility::Registry::deregisterGlobalEventListener method implementation
- */
static void
-impl_accessibility_registry_deregister_global_event_listener (
- PortableServer_Servant servant,
- Accessibility_EventListener listener,
- const CORBA_char *event_name,
- CORBA_Environment *ev)
-{
- SpiRegistry *registry;
- EventTypeStruct etype;
-
- registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
-
- parse_event_type (&etype, (char *) event_name);
-
- spi_re_enterant_list_foreach (get_listener_list (registry, etype.type_cat),
- remove_listener_cb, listener);
-}
-
-
-/**
- * getDesktopCount:
- * return values: a short integer indicating the current number of
- * @Desktops.
- *
- * Get the current number of desktops.
- *
- **/
-static short
-impl_accessibility_registry_get_desktop_count (PortableServer_Servant servant,
- CORBA_Environment * ev)
-{
- /* TODO: implement support for multiple virtual desktops */
- CORBA_short n_desktops;
- n_desktops = (CORBA_short) 1;
- return n_desktops;
-}
-
-
-/**
- * getDesktop:
- * @n: the index of the requested @Desktop.
- * return values: a reference to the requested @Desktop.
- *
- * Get the nth accessible desktop.
- *
- **/
-static Accessibility_Desktop
-impl_accessibility_registry_get_desktop (PortableServer_Servant servant,
- const CORBA_short n,
- CORBA_Environment * ev)
-{
- SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
-
- /* TODO: implement support for multiple virtual desktops */
- if (n == 0)
- {
- return (Accessibility_Desktop)
- bonobo_object_dup_ref (BONOBO_OBJREF (registry->desktop), ev);
- }
- else
- {
- return (Accessibility_Desktop) CORBA_OBJECT_NIL;
- }
-}
-
-
-/**
- * getDesktopList:
- * return values: a sequence containing references to
- * the @Desktops.
- *
- * Get a list of accessible desktops.
- *
- **/
-static Accessibility_DesktopSeq *
-impl_accessibility_registry_get_desktop_list (PortableServer_Servant servant,
- CORBA_Environment * ev)
+handle_deregister_application (SpiRegistry *reg, DBusMessage *message)
{
- SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
- Accessibility_DesktopSeq *desktops;
+ gchar *app_name;
- desktops = Accessibility_DesktopSeq__alloc ();
- desktops->_length = desktops->_maximum = 1;
- desktops->_buffer = Accessibility_DesktopSeq_allocbuf (desktops->_length);
- desktops->_buffer [0] = bonobo_object_dup_ref (BONOBO_OBJREF (registry->desktop), ev);
-
- return desktops;
+ if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &app_name, DBUS_TYPE_INVALID))
+ seq_remove_string (reg->apps, app_name);
}
-
-static Accessibility_DeviceEventController
-impl_accessibility_registry_get_device_event_controller (PortableServer_Servant servant,
- CORBA_Environment *ev)
+static void
+handle_disconnection (SpiRegistry *reg, DBusMessage *message)
{
- SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
+ char *name, *old, *new;
- if (!registry->de_controller)
+ if (dbus_message_get_args (message, NULL,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &old,
+ DBUS_TYPE_STRING, &new,
+ DBUS_TYPE_INVALID))
+ {
+ if (*old != '\0' && *new == '\0')
{
- registry->de_controller = spi_device_event_controller_new (registry);
+ if (seq_remove_string (reg->apps, old))
+ {
+ /*Emit deregistered signal here*/
+ emit (reg, SPI_DBUS_INTERFACE_TREE, "deregisterApplication", DBUS_TYPE_STRING, old);
+ /*TODO spi_remove_device_listeners (registry->de_controller, old);*/
+ }
}
-
- return bonobo_object_dup_ref (BONOBO_OBJREF (registry->de_controller), ev);
+ }
}
-typedef struct {
- CORBA_Environment *ev;
- Bonobo_Unknown source;
- EventTypeStruct etype;
- Accessibility_Event e_out;
-} NotifyContext;
-
-static SpiReEnterantContinue
-notify_listeners_cb (GList * const *list, gpointer user_data)
+static DBusHandlerResult
+signal_handler (DBusConnection *bus, DBusMessage *message, void *user_data)
{
- SpiListenerStruct *ls;
- NotifyContext *ctx = user_data;
-#ifdef SPI_DEBUG
- CORBA_string s;
-#endif
+ SpiRegistry *registry = SPI_REGISTRY (user_data);
+ guint res = DBUS_HANDLER_RESULT_HANDLED;
+ const char *iface = dbus_message_get_interface (message);
+ const char *member = dbus_message_get_member (message);
- ls = (*list)->data;
-
-#ifdef SPI_LISTENER_DEBUG
- fprintf (stderr, "event quarks: %lx %lx %lx\n", ls->event_type_quark, etype.major, etype.minor);
- fprintf (stderr, "event name: %s\n", etype.event_name);
-#endif
+ g_print ("\n%s", iface);
+ g_print ("\n%d", dbus_message_get_type (message));
+ g_print ("\n%s\n", member);
- if ((ls->event_type_quark == ctx->etype.major) ||
- (ls->event_type_quark == ctx->etype.minor))
- {
-#ifdef SPI_DEBUG
- fprintf (stderr, "notifying listener %d\n", g_list_index (listeners, l->data));
- s = Accessibility_Accessible__get_name (ctx->source, ev);
- fprintf (stderr, "event source name %s\n", s);
- CORBA_free (s);
+#if 0
+ if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
+ handle_disconnection (registry, message);
+ else if (dbus_message_is_signal (message, SPI_DBUS_INTERFACE_TREE, "registerApplication"))
+ handle_register_application (registry, message);
+ else if (dbus_message_is_signal (message, SPI_DBUS_INTERFACE_TREE, "deregisterApplication"))
+ handle_deregister_application (registry, message);
+ else
+ res = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
#endif
-
- ctx->e_out.source = bonobo_object_dup_ref (ctx->source, ctx->ev);
- if (BONOBO_EX (ctx->ev))
- {
- return SPI_RE_ENTERANT_CONTINUE;;
- }
- if ((*list) && (*list)->data == ls)
- {
- Accessibility_EventListener_notifyEvent (
- (Accessibility_EventListener) ls->listener, &ctx->e_out, ctx->ev);
- if (ctx->ev->_major != CORBA_NO_EXCEPTION)
- {
- g_warning ("Accessibility app error: exception during "
- "event notification: %s\n",
- CORBA_exception_id (ctx->ev));
- }
- }
- else /* dup re-entered */
- {
- bonobo_object_release_unref (ctx->e_out.source, ctx->ev);
- }
- }
+ if (!g_strcmp0(iface, DBUS_INTERFACE_DBUS) && !g_strcmp0(member, "NameOwnerChanged"))
+ handle_disconnection (registry, message);
+ else if (!g_strcmp0(iface, SPI_DBUS_INTERFACE_TREE) && !g_strcmp0(member, "registerApplication"))
+ handle_register_application (registry, message);
+ else if (!g_strcmp0(iface, SPI_DBUS_INTERFACE_TREE) && !g_strcmp0(member, "deregisterApplication"))
+ handle_deregister_application (registry, message);
+ else
+ res = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- return SPI_RE_ENTERANT_CONTINUE;
+ return res;
}
-static void
-impl_registry_notify_event (PortableServer_Servant servant,
- const Accessibility_Event *e,
- CORBA_Environment *ev)
-{
- SpiRegistry *registry;
- GList **list;
- NotifyContext ctx;
-
- registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
-
- parse_event_type (&ctx.etype, e->type);
+/*---------------------------------------------------------------------------*/
- list = get_listener_list (registry, ctx.etype.type_cat);
-
- if (list)
- {
- ctx.ev = ev;
- ctx.e_out = *e;
- ctx.source = e->source;
- parse_event_type (&ctx.etype, e->type);
-
- spi_re_enterant_list_foreach (list, notify_listeners_cb, &ctx);
- }
-
- if (e->source != CORBA_OBJECT_NIL)
- {
- Accessibility_Accessible_unref (e->source, ev);
- }
-}
+static gchar *app_reg_sig_match = "type='signal', interface='org.freedesktop.atspi.Tree', member='registerApplication'";
+static gchar *app_dereg_sig_match = "type='signal', interface='org.freedesktop.atspi.Tree', member='deregisterApplication'";
+static gchar *app_sig_match_blank = "";
-static void
-spi_registry_class_init (SpiRegistryClass *klass)
+static DBusObjectPathVTable reg_vtable =
{
- GObjectClass * object_class = (GObjectClass *) klass;
- POA_Accessibility_Registry__epv *epv = &klass->epv;
-
- spi_registry_parent_class = g_type_class_ref (SPI_LISTENER_TYPE);
-
- object_class->finalize = spi_registry_object_finalize;
-
- klass->parent_class.epv.notifyEvent = impl_registry_notify_event;
-
- epv->registerApplication = impl_accessibility_registry_register_application;
- epv->deregisterApplication = impl_accessibility_registry_deregister_application;
- epv->registerGlobalEventListener = impl_accessibility_registry_register_global_event_listener;
- epv->deregisterGlobalEventListener = impl_accessibility_registry_deregister_global_event_listener;
- epv->deregisterGlobalEventListenerAll = impl_accessibility_registry_deregister_global_event_listener_all;
- epv->getDeviceEventController = impl_accessibility_registry_get_device_event_controller;
- epv->getDesktopCount = impl_accessibility_registry_get_desktop_count;
- epv->getDesktop = impl_accessibility_registry_get_desktop;
- epv->getDesktopList = impl_accessibility_registry_get_desktop_list;
-}
+ NULL,
+ &message_handler,
+ NULL, NULL, NULL, NULL
+};
-static void
-spi_registry_init (SpiRegistry *registry)
+SpiRegistry *
+spi_registry_new (DBusConnection *bus)
{
- registry->object_listeners = NULL;
- registry->window_listeners = NULL;
- registry->toolkit_listeners = NULL;
- registry->desktop = spi_desktop_new ();
- registry->de_controller = NULL;
-}
+ SpiRegistry *reg = g_object_new (SPI_REGISTRY_TYPE, NULL);
-BONOBO_TYPE_FUNC_FULL (SpiRegistry,
- Accessibility_Registry,
- PARENT_TYPE,
- spi_registry);
+ reg->bus = bus;
-SpiRegistry *
-spi_registry_new (void)
-{
- SpiRegistry *retval = g_object_new (SPI_REGISTRY_TYPE, NULL);
- bonobo_object_set_immortal (BONOBO_OBJECT (retval), TRUE);
- return retval;
+ dbus_connection_register_object_path(bus, SPI_DBUS_PATH_REGISTRY, ®_vtable, reg);
+
+ //dbus_bus_add_match (bus, app_reg_sig_match, NULL);
+ //dbus_bus_add_match (bus, app_dereg_sig_match, NULL);
+ dbus_bus_add_match (bus, app_sig_match_blank, NULL);
+ dbus_connection_add_filter (bus, signal_handler, reg, NULL);
+
+ return reg;
}