Table of Contents
Saving and restoring your files is done by using XML supporting XPath. The complete persistence layer is described by ags_file.dtd installed on your system. There various classes involved by doing XML IO. It does it in stages as following for reading:
Writing files does ommit the last step. The current AgsConfig is going to be embedded in your file. So you can have per project configuration. Certain objects implement AgsPlugin interface to do an abstraction of reading and writing xmlNode.
Writing files is pretty easy. You just have to instantiate AgsFile, set the application context, open it in read-write mode, call ags_file_write() and finally ags_file_close().
Example 2.1. Writing XML
#include <glib.h> #include <glib-object.h> #include <ags/libags.h> AgsApplicationContext *application_context; AgsFile *file; GError *error; static const gchar *filename = "my_file.xml"; application_context = ags_application_context_get_instance(); file = (AgsFile *) g_object_new(AGS_TYPE_FILE, "application-context", application_context, "filename", filename, NULL); error = NULL; ags_file_rw_open(file, TRUE, &error); ags_file_write(file); ags_file_close(file);