From 25ffd534e5b4833e1215a5672bfae2389dbc3b46 Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Wed, 18 Sep 2013 11:22:23 +0200 Subject: [PATCH] Implemented ag_chart_save_to_file --- src/ag-chart.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ag-chart.c b/src/ag-chart.c index b4bf767..b9a9c94 100644 --- a/src/ag-chart.c +++ b/src/ag-chart.c @@ -641,5 +641,14 @@ create_save_doc(AgChart *chart) void ag_chart_save_to_file(AgChart *chart, GFile *file, GError **err) { + xmlChar *content = NULL; + int length; + xmlDocPtr save_doc = create_save_doc(chart); + + xmlDocDumpFormatMemoryEnc(save_doc, &content, &length, "UTF-8", 1); + + g_file_replace_contents(file, (const gchar *)content, length, NULL, FALSE, G_FILE_CREATE_NONE, NULL, NULL, err); + + xmlFreeDoc(save_doc); }