- return (SpiAccessibleImage *)
- ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface));
+
+/**
+ * Accessible_queryInterface:
+ * @obj: a pointer to the #Accessible instance to query.
+ * @interface_name: a UTF-8 character string specifiying the requested interface.
+ *
+ * Query an #Accessible object to for a named interface.
+ *
+ * Returns: an instance of the named interface object, if it is implemented
+ * by @obj, or NULL otherwise.
+ *
+ **/
+GenericInterface *
+Accessible_queryInterface (Accessible *obj,
+ const char *interface_name)
+{
+ Bonobo_Unknown iface;
+
+ if (!obj)
+ {
+ return NULL;
+ }
+
+ iface = Accessibility_Accessible_queryInterface (CSPI_OBJREF (obj),
+ interface_name,
+ cspi_ev ());
+
+
+ cspi_return_val_if_ev ("queryInterface", NULL);
+
+ /*
+ * FIXME: we need to be fairly sure that references are going
+ * to mach up if we are going to expose QueryInterface, ie. we
+ * can't allow people to do:
+ * b = a.qi ("b"); b.unref, b.unref to release a's reference.
+ * this should be no real problem though for this level of API
+ * user.
+ */
+
+ return cspi_object_add (iface);