From 52ff709e14ee5d5ea1c15fc82e5ec63a8f7ca7e5 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sun, 5 Oct 2014 19:36:20 +0200 Subject: [PATCH] Refactor ag_chart_export_jpg_to_file() as ag_chart_export_to_image() It is capable of saving in any format (as long as GdkPixbuf supports it) --- src/ag-chart.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/ag-chart.c b/src/ag-chart.c index 60ea2cc..d3e9d6b 100644 --- a/src/ag-chart.c +++ b/src/ag-chart.c @@ -1983,11 +1983,12 @@ ag_chart_get_pixbuf(AgChart *chart, return pixbuf; } -void -ag_chart_export_jpg_to_file(AgChart *chart, - GFile *file, - AgDisplayTheme *theme, - GError **err) +static void +ag_chart_export_to_image(AgChart *chart, + GFile *file, + AgDisplayTheme *theme, + gchar *format, + GError **err) { gchar *jpg; gsize jpg_length; @@ -2003,7 +2004,7 @@ ag_chart_export_jpg_to_file(AgChart *chart, pixbuf, &jpg, &jpg_length, - "jpeg", + format, err, NULL )) { @@ -2029,6 +2030,15 @@ ag_chart_export_jpg_to_file(AgChart *chart, g_free(jpg); } +void +ag_chart_export_jpg_to_file(AgChart *chart, + GFile *file, + AgDisplayTheme *theme, + GError **err) +{ + ag_chart_export_to_image(chart, file, theme, "jpeg", err); +} + void ag_chart_set_note(AgChart *chart, const gchar *note) {