- DBusError error;
-
- spi_registry_set_debug (g_getenv ("AT_SPI_DEBUG"));
- /*
- * TODO: FIXME, this module makes the foolish assumptions that
- * registryd uses the same display as the apps, and that the
- * DISPLAY environment variable is set.
- */
- gdk_init (NULL, NULL);
-
- registry->exit_notify_timeout = 200;
- registry->queue_handler_id = 0;
-
- dbus_error_init (&error);
- registry->droute.bus = dbus_bus_get(DBUS_BUS_SESSION, &error);
- if (!registry->droute.bus)
- {
- g_warning("Couldn't connect to dbus: %s\n", error.message);
- return;
- }
- spi_registry_initialize_registry_interface (®istry->droute);
- spi_registry_initialize_desktop_interface (®istry->droute);
- spi_registry_initialize_dec_interface (®istry->droute);
- // todo: initialize accessible and component interfaces, for desktop?
- if (!dbus_connection_try_register_fallback (registry->droute.bus, "/org/freedesktop/atspi", &droute_vtable, ®istry->droute, &error))
- {
- g_warning("Couldn't register droute.\n");
- }
- dbus_connection_setup_with_g_main(registry->droute.bus, g_main_context_default());
-
- // TODO: decide whether focus_object is still relevant
- registry->desktop = spi_desktop_new ();
- /* Register callback notification for application addition and removal */
- g_signal_connect (G_OBJECT (registry->desktop),
- "application_added",
- G_CALLBACK (desktop_add_application),
- registry);
-
- g_signal_connect (G_OBJECT (registry->desktop),
- "application_removed",
- G_CALLBACK (desktop_remove_application),
- registry);
-
- registry->de_controller = spi_device_event_controller_new (registry);
+ char *name, *old, *new;
+ SpiRegistry *reg = SPI_REGISTRY (user_data);
+
+ 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')
+ {
+ remove_application(bus, reg, old);
+ }
+ }