Ok, so I just tried to implement this :-) Here's a the OAF patch: =================================================================== RCS file: /cvs/gnome/oaf/idl/oaf-factory.idl,v retrieving revision 1.8 diff -u -u -r1.8 oaf-factory.idl --- idl/oaf-factory.idl 2000/09/08 03:32:58 1.8 +++ idl/oaf-factory.idl 2001/04/25 13:22:06 @@ -26,8 +26,8 @@ Object create_object (in string oaf_id, in stringlist params) raises (CannotActivate); - void ref(); - oneway void unref(); + void ref_factory(); + oneway void unref_factory(); }; }; =================================================================== Here's a new Bonobo::ObjectFactory CORBA Object: ==== #ifndef __BONOBO_FACTORY_IDL__ #define __BONOBO_FACTORY_IDL__ #include <oaf-factory.idl> module Bonobo { interface ObjectFactory : Bonobo::Unknown, GNOME::ObjectFactory { }; }; #endif /* ! __BONOBO_FACTORY_IDL__ */ ==== The following is a bit hackish, to explain what it does, look at this: typedef struct { PortableServer_ServantBase__epv *_base_epv; POA_Bonobo_Unknown__epv *Bonobo_Unknown_epv; POA_GNOME_ObjectFactory__epv *GNOME_ObjectFactory_epv; POA_Bonobo_ObjectFactory__epv *Bonobo_ObjectFactory_epv; } POA_Bonobo_ObjectFactory__vepv; This vepv contains the Bonobo_Unknown_epv, one foreign object and then the other epv's. So we have vepv_base_depth == 1. =================================================================== RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-object.h,v retrieving revision 1.61 diff -u -u -r1.61 bonobo-object.h --- bonobo-object.h 2001/04/18 22:09:07 1.61 +++ bonobo-object.h 2001/04/25 13:25:56 @@ -135,13 +135,15 @@ BonoboObjectPOAFn init_fn, BonoboObjectPOAFn fini_fn, int epv_struct_offset, + int vepv_base_depth, const GTypeInfo *info, const gchar *type_name); gboolean bonobo_type_setup (GType type, BonoboObjectPOAFn init_fn, BonoboObjectPOAFn fini_fn, - int epv_struct_offset); + int epv_struct_offset, + int vepv_base_depth); #define BONOBO_TYPE_FUNC_FULL(class_name, corba_name, parent, prefix) \ GType \ @@ -165,7 +167,7 @@ type = bonobo_type_unique (ptype, \ POA_##corba_name##__init, POA_##corba_name##__fini, \ G_STRUCT_OFFSET (class_name##Class, epv), \ - &info, #class_name); \ + 0, &info, #class_name); \ } \ return type; \ } @@ -190,7 +192,7 @@ }; \ ptype = (parent); \ type = bonobo_type_unique (ptype, NULL, NULL, 0, \ - &info, #class_name); \ + 0, &info, #class_name); \ } \ return type; \ } Index: bonobo-object.c =================================================================== RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-object.c,v retrieving revision 1.109 diff -u -u -r1.109 bonobo-object.c --- bonobo-object.c 2001/04/18 22:09:06 1.109 +++ bonobo-object.c 2001/04/25 13:25:58 @@ -1141,7 +1141,8 @@ bonobo_type_setup (GType type, BonoboObjectPOAFn init_fn, BonoboObjectPOAFn fini_fn, - int epv_struct_offset) + int epv_struct_offset, + int vepv_base_depth) { GType p, b_type; int depth; @@ -1181,7 +1182,7 @@ bonobo_object_epv_init (&klass->epv); klass->epv._private = NULL; - vepv = g_new0 (gpointer, depth + 2); + vepv = g_new0 (gpointer, depth + vepv_base_depth + 2); klass->vepv = (POA_Bonobo_Unknown__vepv *) vepv; klass->vepv->_base_epv = NULL; klass->vepv->Bonobo_Unknown_epv = &klass->epv; @@ -1196,7 +1197,7 @@ xklass = g_type_class_peek (p); if (xklass->epv_struct_offset) { - vepv [i + 1] = ((guchar *)klass) + + vepv [i + vepv_base_depth + 1] = ((guchar *)klass) + xklass->epv_struct_offset; i--; } @@ -1228,6 +1229,7 @@ BonoboObjectPOAFn init_fn, BonoboObjectPOAFn fini_fn, int epv_struct_offset, + int vepv_base_depth, const GTypeInfo *info, const gchar *type_name) { @@ -1247,7 +1249,7 @@ return 0; if (bonobo_type_setup (type, init_fn, fini_fn, - epv_struct_offset)) + epv_struct_offset, vepv_base_depth)) return type; else return 0; =================================================================== Here's the full patch:
Attachment:
diff
Description: Binary data
Now I start wondering whether it's really worth doing this stuff just to make BonoboGenericFactory a BonoboObject. -- Martin Baulig martin gnome org (private) baulig suse de (work)