![]() |
![]() |
![]() |
Libbonobo Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
BonoboPersistFileBonoboPersistFile — Interface for anything that can save / load itself from a file. |
struct BonoboPersistFile; int (*BonoboPersistFileIOFn) (BonoboPersistFile *pf
,const CORBA_char *uri
,CORBA_Environment *ev
,void *closure
); BonoboPersistFileClass; BonoboPersistFile * bonobo_persist_file_new (BonoboPersistFileIOFn load_fn
,BonoboPersistFileIOFn save_fn
,const gchar *iid
,void *closure
); BonoboPersistFile * bonobo_persist_file_construct (BonoboPersistFile *pf
,BonoboPersistFileIOFn load_fn
,BonoboPersistFileIOFn save_fn
,const gchar *iid
,void *closure
);
The PersistFile interface is a useful interface for Bonoboizing legacy applications, however, for new / correct applications it is far preferable to implement the BonoboPersistStream interface, since this will not only result in a nice clean to your application architecture, but also allow the transparent use of local, remote, and synthetic streams.
This interface works by connecting callbacks to the methods, in a pretty deprecated fashion, it is probably better nowadays to simply sub-class the BonoboXObject and override the epv methods. Either way, after all the caveats here is an example use:
Having implemented the callbacks we then have to register them
and aggregate the interface to our object:
Note again, that you should be writing a BonoboPersistStream
interface, however if you have already done this you might like
to just have hooks through so that old apps can use the PersistFile
interface:
The mime type data can be extracted from gnome-vfs or gnome-mime.
struct BonoboPersistFile;
BonoboPersistFile
is deprecated and should not be used in newly-written code.
int (*BonoboPersistFileIOFn) (BonoboPersistFile *pf
,const CORBA_char *uri
,CORBA_Environment *ev
,void *closure
);
BonoboPersistFileIOFn
is deprecated and should not be used in newly-written code.
typedef struct { BonoboPersistClass parent_class; POA_Bonobo_PersistFile__epv epv; /* methods */ int (*load) (BonoboPersistFile *ps, const CORBA_char *uri, CORBA_Environment *ev); int (*save) (BonoboPersistFile *ps, const CORBA_char *uri, CORBA_Environment *ev); char *(*get_current_file) (BonoboPersistFile *ps, CORBA_Environment *ev); } BonoboPersistFileClass;
BonoboPersistFileClass
is deprecated and should not be used in newly-written code.
BonoboPersistFile * bonobo_persist_file_new (BonoboPersistFileIOFn load_fn
,BonoboPersistFileIOFn save_fn
,const gchar *iid
,void *closure
);
bonobo_persist_file_new
is deprecated and should not be used in newly-written code.
Creates a BonoboPersistFile object. The load_fn
and save_fn
parameters might be NULL. If this is the case, the load and save
operations are performed by the class load and save methods
|
Loading routine |
|
Saving routine |
|
OAF IID of the object this interface is aggregated to |
|
Data passed to IO routines. |
Returns : |
the BonoboPersistFile. |
BonoboPersistFile * bonobo_persist_file_construct (BonoboPersistFile *pf
,BonoboPersistFileIOFn load_fn
,BonoboPersistFileIOFn save_fn
,const gchar *iid
,void *closure
);
bonobo_persist_file_construct
is deprecated and should not be used in newly-written code.
Initializes the BonoboPersistFile object. The load_fn
and save_fn
parameters might be NULL. If this is the case, the load and save
operations are performed by the class load and save methods
|
A BonoboPersistFile |
|
Loading routine |
|
Saving routine |
|
OAF IID of the object this interface is aggregated to |
|
Data passed to IO routines. |
Returns : |
the BonoboPersistFile. |