X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Ft-test-independent-samples-dialog.c;h=718709bf23869a3adbaf1459b665b4ff3680bc50;hb=3b064b5cce148b1c7d5386553a87cda37913429f;hp=1468bd01b363d954bb72218fb90a49fc823a1b46;hpb=4b067c7391b48b471b2503e62fd9ec760e7e7eee;p=pspp-builds.git diff --git a/src/ui/gui/t-test-independent-samples-dialog.c b/src/ui/gui/t-test-independent-samples-dialog.c index 1468bd01..718709bf 100644 --- a/src/ui/gui/t-test-independent-samples-dialog.c +++ b/src/ui/gui/t-test-independent-samples-dialog.c @@ -16,6 +16,7 @@ */ +#include #include #include #include "t-test-independent-samples-dialog.h" @@ -28,6 +29,7 @@ #include "dialog-common.h" #include "dict-display.h" #include "widget-io.h" +#include "t-test-options.h" #include #include "syntax-editor.h" @@ -43,8 +45,8 @@ struct tt_indep_samples_dialog GtkWidget *dialog; PsppireDict *dict; gboolean groups_defined; - gboolean non_default_options; - gdouble confidence_interval; + + struct tt_options_dialog *opts; }; @@ -78,21 +80,8 @@ generate_syntax (const struct tt_indep_samples_dialog *d) g_string_append (str, ")"); } - if ( d->non_default_options ) - { - GtkToggleButton *analysis = - GTK_TOGGLE_BUTTON (get_widget_assert (d->xml, "radiobutton1")); - - g_string_append (str, "\n\t"); - g_string_append_printf (str, "/CRITERIA=CIN(%g)", - d->confidence_interval/100.0); - - g_string_append (str, "\n\t"); - g_string_append_printf (str, "/MISSING=%s", - gtk_toggle_button_get_active (analysis) ? - "ANALYSIS" : "LISTWISE"); - } + tt_options_dialog_append_syntax (d->opts, str); g_string_append (str, ".\n"); @@ -158,43 +147,6 @@ run_define_groups (struct tt_indep_samples_dialog *ttd) } -static void -run_options (struct tt_indep_samples_dialog *ttd) -{ - gint response; - GtkWidget *dialog = - get_widget_assert (ttd->xml, "options-dialog"); - - GtkWidget *box = - get_widget_assert (ttd->xml, "vbox1"); - - GtkSpinButton *conf_percent = NULL; - - GtkWidget *confidence = - widget_scanf (_("Confidence Interval: %2d %%"), - &conf_percent); - - gtk_spin_button_set_value (conf_percent, ttd->confidence_interval); - - gtk_widget_show (confidence); - - gtk_box_pack_start_defaults (GTK_BOX (box), confidence); - - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (ttd->dialog)); - - response = psppire_dialog_run (PSPPIRE_DIALOG (dialog)); - - if ( response == PSPPIRE_RESPONSE_CONTINUE) - { - ttd->non_default_options = TRUE; - ttd->confidence_interval = gtk_spin_button_get_value (conf_percent); - } - - gtk_container_remove (GTK_CONTAINER (box), confidence); -} - - - static gboolean dialog_state_valid (gpointer data) @@ -234,9 +186,6 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) GladeXML *xml = XML_NEW ("t-test.glade"); - tt_d.dialog = get_widget_assert (xml, - "t-test-independent-samples-dialog"); - GtkSheet *var_sheet = GTK_SHEET (get_widget_assert (de->xml, "variable_sheet")); @@ -252,7 +201,6 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) GtkWidget *selector1 = get_widget_assert (xml, "indep-samples-t-test-selector1"); - GtkWidget *entry = get_widget_assert (xml, "indep-samples-t-test-entry"); @@ -264,11 +212,11 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet)); + tt_d.dialog = get_widget_assert (xml, "t-test-independent-samples-dialog"); tt_d.xml = xml; tt_d.dict = vs->dict; tt_d.groups_defined = FALSE; - tt_d.non_default_options = FALSE; - tt_d.confidence_interval = 95.0; + tt_d.opts = tt_options_dialog_create (xml, de->parent.window); gtk_window_set_transient_for (GTK_WINDOW (tt_d.dialog), de->parent.window); @@ -295,7 +243,7 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) g_signal_connect_swapped (options_button, "clicked", - G_CALLBACK (run_options), &tt_d); + G_CALLBACK (tt_options_dialog_run), tt_d.opts); g_signal_connect_swapped (tt_d.dialog, "refresh", G_CALLBACK (refresh), xml); @@ -333,7 +281,7 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) break; } - + tt_options_dialog_destroy (tt_d.opts); g_object_unref (xml); }