generate_syntax (const struct chisquare_dialog *scd)
{
gchar *text;
- GString *string;
+ struct string dss;
+ ds_init_cstr (&dss, "NPAR TEST\n\t/CHISQUARE=");
- string = g_string_new ("NPAR TEST\n\t/CHISQUARE=");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (scd->var_view), 0, string);
-
+ psppire_var_view_append_names_str (PSPPIRE_VAR_VIEW (scd->var_view), 0, &dss);
if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->range_button)))
{
- g_string_append (string, "(");
+ ds_put_cstr (&dss, "(");
- g_string_append (string,
+ ds_put_cstr (&dss,
gtk_entry_get_text (GTK_ENTRY (scd->value_lower)));
- g_string_append (string, ", ");
+ ds_put_cstr (&dss, ", ");
- g_string_append (string,
+ ds_put_cstr (&dss,
gtk_entry_get_text (GTK_ENTRY (scd->value_upper)));
- g_string_append (string, ")");
+ ds_put_cstr (&dss, ")");
}
-
-
-
if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->values_button)))
{
GtkListStore *ls = scd->expected_list;
GtkTreeIter iter;
gboolean ok;
- g_string_append (string, "\n\t");
- g_string_append (string, "/EXPECTED = ");
+ ds_put_cstr (&dss, "\n\t");
+ ds_put_cstr (&dss, "/EXPECTED = ");
for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(ls),
gtk_tree_model_get (GTK_TREE_MODEL (ls), &iter, 0, &v, -1);
- g_string_append_printf (string, " %g", v);
+ ds_put_c_format (&dss, " %g", v);
}
-
-
-
}
- g_string_append (string, ".\n");
+ ds_put_cstr (&dss, ".\n");
- text = string->str;
+ text = ds_steal_cstr (&dss);
- g_string_free (string, FALSE);
+ ds_destroy (&dss);
return text;
}
struct chisquare_dialog csd;
GtkBuilder *xml = builder_new ("chi-square.ui");
- PsppireVarStore *vs;
GtkWidget *dialog = get_widget_assert (xml, "chisquare-dialog");
csd.values_button = get_widget_assert (xml, "radiobutton2");
- g_object_get (dw->data_editor, "var-store", &vs, NULL);
-
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (dw));
- g_object_get (vs, "dictionary", &csd.dict, NULL);
+ g_object_get (dw->data_editor, "dictionary", &csd.dict, NULL);
g_object_set (dict_view,
"model", csd.dict,
"predicate", var_is_numeric,