Re: What is the replacement of bonobo_persist_stream_new ?



Il mar, 2002-03-26 alle 11:59, Michael Meeks ha scritto:
> Hi Paolo,
> 
> On Tue, 2002-03-26 at 08:28, Paolo Bacchilega wrote:
> > bonobo_persist_stream_new is tagged as deprecated, what is the new way
> > of adding a Bonobo::PersistStream interface to an object ?
> 
> 	The 'right' way to do it in Bonobo 2.0 is to simply inherit from the
> BonoboPersist object - ie. copy the libbonobo/samples/echo/echo.[ch] but
> instead sub-class BonoboPersist, and switch Sample_Echo ->
> Persist_Stream.
> 
> 	Then in the class_init method you need to override the:
> 
>    typedef struct
>    {
>       void *_private;
>       void (*load) (PortableServer_Servant _servant,
> 		    const Bonobo_Stream stream, const CORBA_char * type,
> 		    CORBA_Environment * ev);
>       void (*save) (PortableServer_Servant _servant,
> 		    const Bonobo_Stream stream, const CORBA_char * type,
> 		    CORBA_Environment * ev);
>    }
>    POA_Bonobo_PersistStream__epv;
> 
> 	Methods.
> 
> 	ie. the wrapper is just totally obsoleted by BonoboObject - so there is
> no point in it, and it just encourages somewhat acute ugliness - IMHO
> ;-)
> 
> 	Let me know how you get on - quite possibly we need some sample code
> for this.

Actually I needed to add the Bonobo::PersistStream interface to a
control so I couldn't inherit it from the BonoboPersist object.

I have created a class that implements the Bonobo::PersistStream
interface, starting from the Echo example as you said, and then added
the interface to the control, all seems to work well, thank you.

PS: perhaps bonobo_persist_stream_new is ugly, but it was a single line
of code that now must be replaced by a new class definition :(

Cheers,

Paolo.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]