<!-- ##### SECTION Title ##### -->
BonoboPersistStream

<!-- ##### SECTION Short_Description ##### -->
Interface for anything that can save / load itself from a Bonobo stream.

<!-- ##### SECTION Long_Description ##### -->
<para>
The PersistStream interface is the interface to use for all new
components that are able to load and save themselves to a stream.
It should be associated with any #BonoboEmbeddable for use by the
container in creating a compound document.
</para>

<para>
This interface works by connecting callbacks to the methods, in
a somewhat 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:
</para>

<para>
  <example>
    <title>Implementing the PersistStream callbacks</title>
    <programlisting>
static void
load_from_stream (BonoboPersistStream        *ps,
                  const Bonobo_Stream         stream,
                  Bonobo_Persist_ContentType  type,
                  void                       *closure,
                  CORBA_Environment          *ev)
{
	EogImageData *image_data = closure;

	g_warning ("Load content from stream of type '%s'", type);
}

static gint
save_to_stream (BonoboPersistStream        *ps,
                const Bonobo_Stream         stream,
                Bonobo_Persist_ContentType  type,
                void                       *closure,
                CORBA_Environment          *ev)
{
	EogImageData *image_data = closure;

	g_warning ("Save content to stream with type '%s'", type);
}

static Bonobo_Persist_ContentTypeList *
get_supported_types (BonoboPersistStream *ps,
                     void                *closure,
                     CORBA_Environment   *ev)
{
	return bonobo_persist_generate_content_types (
		2, "text/plain", "text/html");
}
    </programlisting>
  </example>
Having implemented the callbacks we then have to register them
and aggregate the interface to our object:
  <example>
     <title>Aggregating a new PersistStream</title>
    <programlisting>
EogImageData *
eog_image_data_construct (EogImageData *image_data)
{
	BonoboObject        *retval;
	BonoboPersistStream *ps;

	ps = bonobo_persist_stream_new (
		load_from_stream, save_to_stream,
		get_supported_types, NULL,
		image_data);

	if (ps == NULL) {
		bonobo_object_unref (BONOBO_OBJECT (image_data));
		return NULL;
	}

	bonobo_object_add_interface (BONOBO_OBJECT (image_data),
				     BONOBO_OBJECT (ps));

	return image_data;
}
    </programlisting>
  </example>
</para>

<!-- ##### SECTION See_Also ##### -->
<para>

</para>

<!-- ##### SECTION Stability_Level ##### -->


<!-- ##### STRUCT BonoboPersistStream ##### -->
<para>

</para>


<!-- ##### STRUCT BonoboPersistStreamClass ##### -->
<para>

</para>

@parent_class: 
@epv: 
@load: 
@save: 
@get_content_types: 

<!-- ##### USER_FUNCTION BonoboPersistStreamIOFn ##### -->
<para>

</para>

@ps: 
@stream: 
@type: 
@closure: 
@ev: 


<!-- ##### USER_FUNCTION BonoboPersistStreamTypesFn ##### -->
<para>

</para>

@ps: 
@closure: 
@ev: 
@Returns: 


<!-- ##### FUNCTION bonobo_persist_stream_new ##### -->
<para>

</para>

@load_fn: 
@save_fn: 
@types_fn: 
@iid: 
@closure: 
@Returns: 


<!-- ##### FUNCTION bonobo_persist_stream_construct ##### -->
<para>

</para>

@ps: 
@load_fn: 
@save_fn: 
@types_fn: 
@iid: 
@closure: 
@Returns: 


