Change ag_chart_create_svg() to return the length of the SVG document
This is needed later for SVG export
This commit is contained in:
parent
cc7aed38c1
commit
f6e3f9e033
@ -612,7 +612,7 @@ ag_chart_save_to_file(AgChart *chart, GFile *file, GError **err)
|
||||
}
|
||||
|
||||
gchar *
|
||||
ag_chart_create_svg(AgChart *chart, GError **err)
|
||||
ag_chart_create_svg(AgChart *chart, gsize *length, GError **err)
|
||||
{
|
||||
xmlDocPtr doc = create_save_doc(chart);
|
||||
xmlDocPtr xslt_doc;
|
||||
@ -851,6 +851,10 @@ ag_chart_create_svg(AgChart *chart, GError **err)
|
||||
xmlDocDumpFormatMemoryEnc(svg_doc, (xmlChar **)&save_content, &save_length, "UTF-8", 1);
|
||||
xmlFreeDoc(svg_doc);
|
||||
|
||||
if (length != NULL) {
|
||||
*length = save_length;
|
||||
}
|
||||
|
||||
return save_content;
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ void ag_chart_set_city(AgChart *chart,
|
||||
const gchar *city);
|
||||
gchar *ag_chart_get_city(AgChart *chart);
|
||||
gchar *ag_chart_create_svg(AgChart *chart,
|
||||
gsize *length,
|
||||
GError **err);
|
||||
|
||||
#define AG_CHART_ERROR (ag_chart_error_quark())
|
||||
|
@ -176,7 +176,7 @@ ag_window_redraw_chart(AgWindow *window)
|
||||
GError *err = NULL;
|
||||
gchar *svg_content;
|
||||
|
||||
svg_content = ag_chart_create_svg(window->priv->chart, &err);
|
||||
svg_content = ag_chart_create_svg(window->priv->chart, NULL, &err);
|
||||
|
||||
if (svg_content == NULL) {
|
||||
GtkWidget *dialog;
|
||||
|
Loading…
Reference in New Issue
Block a user