From bc873a118b5efdab4319c366e2a6f675d022d7b7 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 25 Dec 2012 15:56:19 +0100 Subject: [PATCH] Aggregate dialog: Fix locale dependent syntax generation --- src/ui/gui/aggregate-dialog.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/ui/gui/aggregate-dialog.c b/src/ui/gui/aggregate-dialog.c index 013e1bee76..562e7e8f32 100644 --- a/src/ui/gui/aggregate-dialog.c +++ b/src/ui/gui/aggregate-dialog.c @@ -18,6 +18,7 @@ #include "dialog-common.h" +#include #include #include @@ -426,15 +427,14 @@ on_acr_change (const struct aggregate *agg, GtkTreeView *tv) gtk_entry_set_text (GTK_ENTRY (agg->summary_var_label_entry), label); gtk_entry_set_text (GTK_ENTRY (agg->summary_sv_entry), srcvar); - text = g_strdup_printf ("%g", arg1); + text = c_xasprintf ("%g", arg1); gtk_entry_set_text (GTK_ENTRY (agg->summary_arg1_entry), text); g_free (text); - text = g_strdup_printf ("%g", arg2); + text = c_xasprintf ("%g", arg2); gtk_entry_set_text (GTK_ENTRY (agg->summary_arg2_entry), text); g_free (text); - gtk_combo_box_set_active (GTK_COMBO_BOX (agg->function_combo), f_idx); } @@ -674,17 +674,22 @@ append_summary_spec (const struct aggregate *agg, GtkTreeIter *iter, GString *st if ( has_src_vars != AGR_SV_NO) { - g_string_append (string, " ("); + struct string dss; + ds_init_cstr (&dss, " ("); - g_string_append (string, srcvar); + ds_put_cstr (&dss, srcvar); if ( arity > 0) - g_string_append_printf (string, ", %g", arg1); + ds_put_c_format (&dss, ", %g", arg1); if ( arity > 1) - g_string_append_printf (string, ", %g", arg2); + ds_put_c_format (&dss, ", %g", arg2); + + ds_put_cstr (&dss, ")"); + + g_string_append (string, ds_cstr (&dss)); - g_string_append (string, ")"); + ds_destroy (&dss); } free (label); -- 2.30.2