Nowadays, a document (such as an AbiWord word-processing document) may contain things like GIMP-pictures, Gnumeric-spreadsheets etcetera. In the previous chapter, we saw how compound files (stream/stores) can be used to store heterogenous content. However, this still leaves a problem: how do we know how to save all these objects? We cannot 'simply' add code to support file operations for every possible embeddable component; this would bloat our code tremendously, and be outdated as soon as somebody writes a new component.
There must be a better solution. And indeed, there is. Instead of dealing with the saving and loading (persistence) of containees (components) ourselves, this task is delegated to the components: we make them responsible for their own persistence.
Every component that wants to support storing its state to some persistent medium (such as a disk file), must support one or more of the following Bonobo interfaces:
GNOME::Persist;
GNOME::PersistFile;
GNOME::PersistStorage;
GNOME::PersistStream.
In this chapter we will describe these interfaces, and show how to use them.