X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fgui%2Faggregate-dialog.c;h=5d477d30c554c172b9e8a1493810962bbd164316;hb=159abf428abd3028a73d064508fac95e542d9f09;hp=16ae1ce0cb08a5377ff72e7d5c4071b5293b7f03;hpb=90963a3499338e490bbe0203168748a2bdd83295;p=pspp diff --git a/src/ui/gui/aggregate-dialog.c b/src/ui/gui/aggregate-dialog.c index 16ae1ce0cb..5d477d30c5 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 @@ -93,15 +94,6 @@ struct aggregate static char * generate_syntax (const struct aggregate *rd); -/* Makes widget W's sensitivity follow the active state of TOGGLE */ -static void -sensitive_if_active (GtkToggleButton *toggle, GtkWidget *w) -{ - gboolean active = gtk_toggle_button_get_active (toggle); - - gtk_widget_set_sensitive (w, active); -} - static void update_arguments (struct aggregate *agg); @@ -435,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); } @@ -469,8 +460,6 @@ aggregate_dialog (PsppireDataWindow *dw) struct aggregate fd; gint response; - PsppireVarStore *vs; - GtkWidget *dialog ; GtkWidget *source ; @@ -566,11 +555,9 @@ aggregate_dialog (PsppireDataWindow *dw) g_signal_connect_swapped (dialog, "refresh", G_CALLBACK (refresh), &fd); - g_object_get (fd.de->data_editor, "var-store", &vs, NULL); - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fd.de)); - g_object_get (vs, "dictionary", &fd.dict, NULL); + g_object_get (fd.de->data_editor, "dictionary", &fd.dict, NULL); g_object_set (source, "model", fd.dict, NULL); @@ -581,7 +568,7 @@ aggregate_dialog (PsppireDataWindow *dw) dialog_state_valid, &fd); g_signal_connect (fd.filename_radiobutton, "toggled", - G_CALLBACK (sensitive_if_active), fd.filename_box ); + G_CALLBACK (set_sensitivity_from_toggle), fd.filename_box ); g_signal_connect_swapped (fd.filename_button, "clicked", G_CALLBACK (choose_filename), &fd); @@ -683,17 +670,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);