Reading XML files

Normally you instantiate a new application context to be used to load objects into. Create a file object by passing the application context and filename. Then open it and read the content. At the end you close the file descriptor. To use your application start the main loop.

Example 2.2. Reading 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_audio_application_context_new();
    
file = g_object_new(AGS_TYPE_FILE,
                    "application-context", application_context,
                    "filename", filename,
                    NULL);
error = NULL;
ags_file_open(file,
              &error);

ags_file_read(file);
ags_file_close(file);

ags_thread_start(application_context->main_loop);