Fix bug in two sample non-parametric dialog.
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 4 Dec 2015 09:37:48 +0000 (10:37 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 4 Dec 2015 09:37:48 +0000 (10:37 +0100)
Commit fc6620099bbc53762095569d5356b67a81a85402 changed all dialog
boxes such that the previous (existing) dialog widget and all
children are re-used each time the dialog is summoned, instead of
creating a new one each time.

The two sample non-parametric test, however has some special code
on activation to populate the dialog, and this had not been moved
to the conditional case - hence the pertinent widgets were getting
added each time.  This resulted in the dialog being overpopulated.

This change fixes these things.

src/ui/gui/psppire-dialog-action-two-sample.c

index 8cc0c00121101fff73e1aa103ec0301f29e9cc12..c570993b843ca52368f8b0e2ca84f07ddfdab935 100644 (file)
@@ -180,43 +180,43 @@ psppire_dialog_action_two_sample_activate (GtkAction *a)
     {
       xml = builder_new ("paired-samples.ui");
       g_hash_table_insert (thing, a, xml);
-    }
 
-  GtkWidget *selector = get_widget_assert (xml, "psppire-selector3");
 
-  pda->dialog = get_widget_assert   (xml, "t-test-paired-samples-dialog");
-  pda->source = get_widget_assert   (xml, "paired-samples-t-test-treeview1");
+      /* NPAR Specific options */
+      GtkWidget *frame = gtk_frame_new (_("Test Type"));
+      GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
+      GtkWidget *box = get_widget_assert (xml, "vbox3");
 
-  gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Two-Related-Samples Tests"));
 
-  act->pairs_treeview = get_widget_assert (xml, "paired-samples-t-test-treeview2");
-  act->list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (act->pairs_treeview)));
+      strcpy (act->nts[NT_WILCOXON].syntax, "/WILCOXON");
+      strcpy (act->nts[NT_SIGN].syntax, "/SIGN");
+      strcpy (act->nts[NT_MCNEMAR].syntax, "/MCNEMAR");
 
-  {
-    /* NPAR Specific options */
-    GtkWidget *frame = gtk_frame_new (_("Test Type"));
-    GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
-    GtkWidget *box = get_widget_assert (xml, "vbox3");
+      act->nts[NT_WILCOXON].button = gtk_check_button_new_with_mnemonic (_("_Wilcoxon"));
+      act->nts[NT_SIGN].button = gtk_check_button_new_with_mnemonic (_("_Sign"));
+      act->nts[NT_MCNEMAR].button = gtk_check_button_new_with_mnemonic (_("_McNemar"));
+
+      gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_WILCOXON].button, FALSE, FALSE, 5);
+      gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_SIGN].button,     FALSE, FALSE, 5);
+      gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_MCNEMAR].button,  FALSE, FALSE, 5);
 
+      gtk_container_add (GTK_CONTAINER (frame), bb);
 
-    strcpy (act->nts[NT_WILCOXON].syntax, "/WILCOXON");
-    strcpy (act->nts[NT_SIGN].syntax, "/SIGN");
-    strcpy (act->nts[NT_MCNEMAR].syntax, "/MCNEMAR");
+      gtk_widget_show_all (frame);
 
-    act->nts[NT_WILCOXON].button = gtk_check_button_new_with_mnemonic (_("_Wilcoxon"));
-    act->nts[NT_SIGN].button = gtk_check_button_new_with_mnemonic (_("_Sign"));
-    act->nts[NT_MCNEMAR].button = gtk_check_button_new_with_mnemonic (_("_McNemar"));
+      gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE,  5);
+    }
 
-    gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_WILCOXON].button, FALSE, FALSE, 5);
-    gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_SIGN].button,     FALSE, FALSE, 5);
-    gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_MCNEMAR].button,  FALSE, FALSE, 5);
+  GtkWidget *selector = get_widget_assert (xml, "psppire-selector3");
 
-    gtk_container_add (GTK_CONTAINER (frame), bb);
+  pda->dialog = get_widget_assert   (xml, "t-test-paired-samples-dialog");
+  pda->source = get_widget_assert   (xml, "paired-samples-t-test-treeview1");
 
-    gtk_widget_show_all (frame);
+  gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Two-Related-Samples Tests"));
+
+  act->pairs_treeview = get_widget_assert (xml, "paired-samples-t-test-treeview2");
+  act->list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (act->pairs_treeview)));
 
-    gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE,  5);
-  }
 
   psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
   psppire_dialog_action_set_refresh (pda, refresh);