NPar two samples dialog and T-Test paired dialogs: Converted to PsppireDialogAction 20131012030504/pspp 20131013030505/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 12 Oct 2013 07:01:26 +0000 (09:01 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 12 Oct 2013 07:01:26 +0000 (09:01 +0200)
15 files changed:
src/ui/gui/automake.mk
src/ui/gui/data-editor.ui
src/ui/gui/npar-two-sample-related.c [deleted file]
src/ui/gui/npar-two-sample-related.h [deleted file]
src/ui/gui/paired-dialog.c [deleted file]
src/ui/gui/paired-dialog.h [deleted file]
src/ui/gui/psppire-data-window.c
src/ui/gui/psppire-dialog-action-paired.c [new file with mode: 0644]
src/ui/gui/psppire-dialog-action-paired.h [new file with mode: 0644]
src/ui/gui/psppire-dialog-action-two-sample.c [new file with mode: 0644]
src/ui/gui/psppire-dialog-action-two-sample.h [new file with mode: 0644]
src/ui/gui/psppire-dialog.c
src/ui/gui/t-test-paired-samples.c [deleted file]
src/ui/gui/t-test-paired-samples.h [deleted file]
src/ui/gui/widgets.c

index 9722010256c2fe55503b820573b2131e10c6e557..98f67e8aa0e737fc7d11e5bebee9c9d7a77694c7 100644 (file)
@@ -160,8 +160,6 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/missing-val-dialog.h \
         src/ui/gui/oneway-anova-dialog.c \
         src/ui/gui/oneway-anova-dialog.h \
-       src/ui/gui/paired-dialog.c \
-       src/ui/gui/paired-dialog.h \
        src/ui/gui/psppire.c \
        src/ui/gui/psppire.h \
        src/ui/gui/psppire-acr.h \
@@ -215,6 +213,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/psppire-dialog-action-k-related.h \
        src/ui/gui/psppire-dialog-action-means.c \
        src/ui/gui/psppire-dialog-action-means.h \
+       src/ui/gui/psppire-dialog-action-paired.c \
+       src/ui/gui/psppire-dialog-action-paired.h \
        src/ui/gui/psppire-dialog-action-rank.c \
        src/ui/gui/psppire-dialog-action-rank.h \
        src/ui/gui/psppire-dialog-action-regression.c \
@@ -229,6 +229,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/psppire-dialog-action-sort.h \
        src/ui/gui/psppire-dialog-action-tt1s.c \
        src/ui/gui/psppire-dialog-action-tt1s.h \
+       src/ui/gui/psppire-dialog-action-two-sample.c \
+       src/ui/gui/psppire-dialog-action-two-sample.h \
        src/ui/gui/psppire-dialog-action-univariate.c \
        src/ui/gui/psppire-dialog-action-univariate.h \
        src/ui/gui/psppire-dialog-action-var-info.c \
@@ -297,10 +299,6 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/text-data-import-dialog.h \
        src/ui/gui/t-test-options.c \
        src/ui/gui/t-test-options.h \
-       src/ui/gui/t-test-paired-samples.c \
-       src/ui/gui/t-test-paired-samples.h \
-       src/ui/gui/npar-two-sample-related.c \
-       src/ui/gui/npar-two-sample-related.h \
        src/ui/gui/val-labs-dialog.c \
        src/ui/gui/val-labs-dialog.h \
        src/ui/gui/var-display.c \
index 658116092c04ae1e3dc22c142b43ecdabeb37b58..f7d0a6c8db7e07dae4c462ee4b9c337c578aeef6 100644 (file)
           </object>
         </child>
         <child>
-          <object class="GtkAction" id="paired-t-test">
+          <object class="PsppireDialogActionPaired" id="paired-t-test">
             <property name="name">paired-t-test</property>
+            <property name="manager">uimanager1</property>
             <property name="label" translatable="yes">_Paired Samples T Test...</property>
           </object>
         </child>
           </object>
         </child>
         <child>
-          <object class="GtkAction" id="two-related-samples">
+          <object class="PsppireDialogActionTwoSample" id="two-related-samples">
             <property name="name">"two-related-samples"></property>
+            <property name="manager">uimanager1</property>
             <property name="label" translatable="yes">2 _Related Samples...</property>
           </object>
         </child>
diff --git a/src/ui/gui/npar-two-sample-related.c b/src/ui/gui/npar-two-sample-related.c
deleted file mode 100644 (file)
index c26f611..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2011, 2012  Free Software Foundation
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "psppire-data-window.h"
-#include "psppire-selector.h"
-#include "psppire-var-view.h"
-
-#include "psppire-dict.h"
-
-#include "dialog-common.h"
-#include "psppire-dialog.h"
-
-#include "executor.h"
-
-#include "helper.h"
-
-#include "psppire-var-ptr.h"
-
-#include "paired-dialog.h"
-#include "npar-two-sample-related.h"
-
-#include <gettext.h>
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-enum test
-  {
-    NT_WILCOXON,
-    NT_SIGN,
-    NT_MCNEMAR,
-    n_Tests
-  };
-
-struct ts_test
-{
-  GtkWidget *button;
-  char syntax[16];
-};
-
-
-static void
-refresh (void *aux)
-{
-  int i;
-  struct ts_test *tst = aux;
-
-  for (i = 0 ; i < n_Tests; ++i)
-    {
-      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tst[i].button), FALSE);
-    }
-}
-
-
-static gboolean
-valid (void *aux)
-{
-  int i;
-  struct ts_test *tst = aux;
-
-  for (i = 0 ; i < n_Tests; ++i)
-    {
-      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tst[i].button)))
-       return TRUE;
-    }
-
-  return FALSE;
-}
-
-
-
-static gchar *
-generate_syntax (struct paired_samples_dialog *psd, const struct ts_test *test)
-{
-  int i;
-  gchar *text = NULL;
-  GString *str = g_string_new ("NPAR TEST");
-
-  for (i = 0 ; i < n_Tests; ++i)
-  {
-    if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (test[i].button)))
-      continue;
-
-    g_string_append (str, "\n\t");
-    g_string_append (str, test[i].syntax);
-
-    psppire_var_view_append_names (PSPPIRE_VAR_VIEW (psd->pairs_treeview), 0, str);
-
-    g_string_append (str, " WITH ");
-
-    psppire_var_view_append_names (PSPPIRE_VAR_VIEW (psd->pairs_treeview), 1, str);
-
-    g_string_append (str, " (PAIRED)");
-  }
-
-  g_string_append (str, ".\n");
-
-  text = str->str;
-  g_string_free (str, FALSE);
-
-  return text;
-}
-
-/* Pops up the dialog box */
-void
-two_related_dialog (PsppireDataWindow *de)
-{
-  gint response;
-  struct ts_test nts[n_Tests];
-  struct paired_samples_dialog *tt_d = two_sample_dialog_create (de);
-
-  GtkWidget *frame = gtk_frame_new (_("Test Type"));
-  GtkWidget *bb = gtk_vbutton_box_new ();
-
-  strcpy (nts[NT_WILCOXON].syntax, "/WILCOXON");
-  strcpy (nts[NT_SIGN].syntax, "/SIGN");
-  strcpy (nts[NT_MCNEMAR].syntax, "/MCNEMAR");
-
-  nts[NT_WILCOXON].button = gtk_check_button_new_with_mnemonic (_("_Wilcoxon"));
-  nts[NT_SIGN].button = gtk_check_button_new_with_mnemonic (_("_Sign"));
-  nts[NT_MCNEMAR].button = gtk_check_button_new_with_mnemonic (_("_McNemar"));
-
-  gtk_box_pack_start (GTK_BOX (bb), nts[NT_WILCOXON].button, FALSE, FALSE, 5);
-  gtk_box_pack_start (GTK_BOX (bb), nts[NT_SIGN].button,     FALSE, FALSE, 5);
-  gtk_box_pack_start (GTK_BOX (bb), nts[NT_MCNEMAR].button,  FALSE, FALSE, 5);
-
-  gtk_container_add (GTK_CONTAINER (frame), bb);
-
-  gtk_widget_show_all (frame);
-  two_sample_dialog_add_widget (tt_d, frame);
-
-  tt_d->refresh = refresh;
-  tt_d->valid = valid;
-  tt_d->aux = nts;
-
-  gtk_window_set_title (GTK_WINDOW (tt_d->dialog), _("Two-Related-Samples Tests"));
-
-  response = psppire_dialog_run (PSPPIRE_DIALOG (tt_d->dialog));
-
-  switch (response)
-    {
-    case GTK_RESPONSE_OK:
-      g_free (execute_syntax_string (de, generate_syntax (tt_d, nts)));
-      break;
-    case PSPPIRE_RESPONSE_PASTE:
-      g_free (paste_syntax_to_window (generate_syntax (tt_d, nts)));
-      break;
-    default:
-      break;
-    }
-
-  two_sample_dialog_destroy (tt_d);
-}
diff --git a/src/ui/gui/npar-two-sample-related.h b/src/ui/gui/npar-two-sample-related.h
deleted file mode 100644 (file)
index de3a860..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2011  Free Software Foundation
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef NPAR_PAIRED_H
-#define NPAR_PAIRED_H 1
-
-#include "psppire-data-window.h"
-
-/* Pops up the dialog box */
-void two_related_dialog (PsppireDataWindow *de);
-
-#endif
diff --git a/src/ui/gui/paired-dialog.c b/src/ui/gui/paired-dialog.c
deleted file mode 100644 (file)
index 3cf2aa3..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2011, 2012  Free Software Foundation
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <config.h>
-
-#include <gtk/gtk.h>
-
-
-#include "paired-dialog.h"
-
-#include "psppire-data-window.h"
-#include "psppire-selector.h"
-#include "psppire-var-view.h"
-
-#include "psppire-dict.h"
-
-#include "dialog-common.h"
-#include "psppire-dialog.h"
-
-#include "psppire-var-ptr.h"
-
-
-#include "builder-wrapper.h"
-
-
-
-static void
-refresh (struct paired_samples_dialog *tt_d)
-{
-  gtk_list_store_clear (GTK_LIST_STORE (tt_d->list_store));
-
-  if (tt_d->refresh)
-    tt_d->refresh (tt_d->aux);
-}
-
-static gboolean
-dialog_state_valid (gpointer data)
-{
-  struct variable *v = NULL;
-  struct paired_samples_dialog *tt_d = data;
-  GtkTreeIter dest_iter;
-
-  gint n_rows = gtk_tree_model_iter_n_children  (tt_d->list_store, NULL);
-
-  if ( n_rows == 0 )
-    return FALSE;
-
-  /* Get the last row */
-  gtk_tree_model_iter_nth_child (tt_d->list_store, &dest_iter,
-                                NULL, n_rows - 1);
-
-  /* Get the last (2nd) column */
-  gtk_tree_model_get (tt_d->list_store, &dest_iter, 1, &v, -1);
-
-
-  if (v == NULL)
-    return FALSE;
-    
-  if ( NULL == tt_d->valid)
-    return TRUE;
-
-  return tt_d->valid (tt_d->aux);
-}
-
-
-
-static void
-select_as_pair_member (GtkTreeIter source_iter,
-                      GtkWidget *dest,
-                      GtkTreeModel *source_model,
-                      gpointer data)
-{
-  struct variable *v;
-  struct variable *v1;
-  gint n_rows;
-  GtkTreeIter dest_iter;
-  struct paired_samples_dialog *tt_d = data;
-
-
-  gtk_tree_model_get (source_model, &source_iter,
-                     DICT_TVM_COL_VAR, &v, -1);
-
-  n_rows = gtk_tree_model_iter_n_children  (tt_d->list_store, NULL);
-
-  if ( n_rows > 0 )
-    {
-
-      gtk_tree_model_iter_nth_child (tt_d->list_store,
-                                    &dest_iter, NULL, n_rows - 1);
-
-      gtk_tree_model_get (tt_d->list_store, &dest_iter, 1, &v1, -1);
-    }
-  else
-    v1 = NULL;
-
-  if ( n_rows == 0 || v1 != NULL)
-    {
-      gtk_list_store_append (GTK_LIST_STORE (tt_d->list_store), &dest_iter);
-
-      gtk_list_store_set (GTK_LIST_STORE (tt_d->list_store), &dest_iter,
-                         0, v,
-                         1, NULL,
-                         -1);
-    }
-  else
-    {
-      gtk_list_store_set (GTK_LIST_STORE (tt_d->list_store), &dest_iter,
-                         1, v,
-                         -1);
-
-    }
-}
-
-void
-two_sample_dialog_add_widget (struct paired_samples_dialog *psd, GtkWidget *w)
-{
-  GtkWidget *box = get_widget_assert (psd->xml, "vbox3");
-  gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE,  5);
-}
-
-void
-two_sample_dialog_destroy (struct paired_samples_dialog *psd)
-{
-  g_object_unref (psd->xml);
-  free (psd);
-}
-
-struct paired_samples_dialog *
-two_sample_dialog_create (PsppireDataWindow *de)
-{
-  GtkWidget *dict_view ;
-  GtkWidget *selector ;
-  struct paired_samples_dialog *tt_d = g_malloc (sizeof *tt_d);
-
-  tt_d->xml = builder_new ("paired-samples.ui");
-
-  dict_view = get_widget_assert (tt_d->xml, "paired-samples-t-test-treeview1");
-
-  selector = get_widget_assert (tt_d->xml, "psppire-selector3");
-
-  tt_d->dialog = get_widget_assert (tt_d->xml, "t-test-paired-samples-dialog");
-
-  g_object_get (de->data_editor, "dictionary", &tt_d->dict, NULL);
-  tt_d->pairs_treeview =
-   get_widget_assert (tt_d->xml, "paired-samples-t-test-treeview2");
-
-  gtk_window_set_transient_for (GTK_WINDOW (tt_d->dialog), GTK_WINDOW (de));
-
-
-  g_object_set (dict_view, "model", tt_d->dict,
-               "predicate",
-               var_is_numeric, NULL);
-
-  
-  tt_d->list_store = gtk_tree_view_get_model (GTK_TREE_VIEW (tt_d->pairs_treeview));
-
-  psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
-                                   select_as_pair_member,
-                                   tt_d);
-
-  g_signal_connect_swapped (tt_d->dialog, "refresh",
-                           G_CALLBACK (refresh),  tt_d);
-
-  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (tt_d->dialog),
-                                     dialog_state_valid, tt_d);
-
-  return tt_d;
-}
diff --git a/src/ui/gui/paired-dialog.h b/src/ui/gui/paired-dialog.h
deleted file mode 100644 (file)
index c370f77..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef PAIRED_DIALOG_H
-#define PAIRED_DIALOG_H 1
-
-#include  "psppire-data-window.h"
-#include  "psppire-dict.h"
-
-#include <gtk/gtk.h>
-
-typedef void refresh_f (void *aux);
-typedef gboolean valid_f (void *aux);
-
-struct paired_samples_dialog
-{
-  PsppireDict *dict;
-  GtkWidget *pairs_treeview;
-  GtkTreeModel *list_store;
-  GtkWidget *dialog;
-  GtkBuilder *xml;
-
-  refresh_f *refresh;
-  valid_f *valid;
-  void *aux;
-};
-
-
-struct paired_samples_dialog *two_sample_dialog_create (PsppireDataWindow *de);
-void two_sample_dialog_destroy (struct paired_samples_dialog *psd);
-void two_sample_dialog_add_widget (struct paired_samples_dialog *psd, GtkWidget *w);
-
-
-#endif
index 7979257b5d3339788199f5f4e9201c8e862f86e7..1b1ba315e89c1b04abb33e32b7d38b8a21f34d21 100644 (file)
@@ -33,7 +33,6 @@
 #include "ui/gui/help-menu.h"
 #include "ui/gui/helper.h"
 #include "ui/gui/helper.h"
-#include "ui/gui/npar-two-sample-related.h"
 #include "ui/gui/oneway-anova-dialog.h"
 #include "ui/gui/psppire-data-window.h"
 #include "ui/gui/psppire-dialog-action.h"
@@ -43,7 +42,6 @@
 #include "ui/gui/recode-dialog.h"
 #include "ui/gui/select-cases-dialog.h"
 #include "ui/gui/split-file-dialog.h"
-#include "ui/gui/t-test-paired-samples.h"
 #include "ui/gui/text-data-import-dialog.h"
 #include "ui/gui/weight-cases-dialog.h"
 #include "ui/syntax-gen.h"
@@ -958,11 +956,9 @@ psppire_data_window_finish_init (PsppireDataWindow *de,
   connect_action (de, "data_split-file", G_CALLBACK (split_file_dialog));
   connect_action (de, "data_weight-cases", G_CALLBACK (weight_cases_dialog));
   connect_action (de, "oneway-anova", G_CALLBACK (oneway_anova_dialog));
-  connect_action (de, "paired-t-test", G_CALLBACK (t_test_paired_samples_dialog));
   connect_action (de, "utilities_comments", G_CALLBACK (comments_dialog));
   connect_action (de, "transform_recode-same", G_CALLBACK (recode_same_dialog));
   connect_action (de, "transform_recode-different", G_CALLBACK (recode_different_dialog));
-  connect_action (de, "two-related-samples", G_CALLBACK (two_related_dialog));
 
   {
     GtkWidget *recent_data =
diff --git a/src/ui/gui/psppire-dialog-action-paired.c b/src/ui/gui/psppire-dialog-action-paired.c
new file mode 100644 (file)
index 0000000..fbd09b9
--- /dev/null
@@ -0,0 +1,226 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2012, 2013  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <config.h>
+
+#include "psppire-dialog-action-paired.h"
+
+#include "psppire-var-view.h"
+
+#include "psppire-selector.h"
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+
+#include "t-test-options.h"
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+static void psppire_dialog_action_paired_init            (PsppireDialogActionPaired      *act);
+static void psppire_dialog_action_paired_class_init      (PsppireDialogActionPairedClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionPaired, psppire_dialog_action_paired, PSPPIRE_TYPE_DIALOG_ACTION);
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+  PsppireDialogActionPaired *pd = PSPPIRE_DIALOG_ACTION_PAIRED (data);
+  gint n_rows = gtk_tree_model_iter_n_children  (GTK_TREE_MODEL (pd->list_store), NULL);
+  struct variable *v = NULL;
+  GtkTreeIter dest_iter;
+
+  if ( n_rows == 0 )
+    return FALSE;
+
+  /* Get the last row */
+  gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (pd->list_store), &dest_iter,
+                                NULL, n_rows - 1);
+
+  /* Get the last (2nd) column */
+  gtk_tree_model_get (GTK_TREE_MODEL (pd->list_store), &dest_iter, 1, &v, -1);
+
+  if (v == NULL)
+    return FALSE;
+    
+  /* if ( NULL == pd->valid) */
+  /*   return TRUE; */
+
+  return TRUE;
+  //  return pd->valid (pd->aux);
+}
+
+static void
+refresh (PsppireDialogAction *rd_)
+{
+  PsppireDialogActionPaired *pd = PSPPIRE_DIALOG_ACTION_PAIRED (rd_);
+
+  gtk_list_store_clear (GTK_LIST_STORE (pd->list_store));
+}
+
+
+static void
+select_as_pair_member (GtkTreeIter source_iter,
+                      GtkWidget *dest,
+                      GtkTreeModel *source_model,
+                      gpointer data)
+{
+  struct variable *v;
+  struct variable *v1;
+  gint n_rows;
+  GtkTreeIter dest_iter;
+  PsppireDialogActionPaired *tt_d = PSPPIRE_DIALOG_ACTION_PAIRED (data);
+
+
+  gtk_tree_model_get (source_model, &source_iter,
+                     DICT_TVM_COL_VAR, &v, -1);
+
+  n_rows = gtk_tree_model_iter_n_children  (GTK_TREE_MODEL (tt_d->list_store), NULL);
+
+  if ( n_rows > 0 )
+    {
+
+      gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (tt_d->list_store),
+                                    &dest_iter, NULL, n_rows - 1);
+
+      gtk_tree_model_get (GTK_TREE_MODEL (tt_d->list_store), &dest_iter, 1, &v1, -1);
+    }
+  else
+    v1 = NULL;
+
+  if ( n_rows == 0 || v1 != NULL)
+    {
+      gtk_list_store_append (tt_d->list_store, &dest_iter);
+
+      gtk_list_store_set (tt_d->list_store, &dest_iter,
+                         0, v,
+                         1, NULL,
+                         -1);
+    }
+  else
+    {
+      gtk_list_store_set (tt_d->list_store, &dest_iter,
+                         1, v,
+                         -1);
+    }
+}
+
+
+
+static gchar *
+generate_syntax (PsppireDialogAction *pda)
+{
+  PsppireDialogActionPaired *d = PSPPIRE_DIALOG_ACTION_PAIRED (pda);
+  gchar *text = NULL;
+  GString *str =   g_string_new ("T-TEST \n\tPAIRS = ");
+
+  psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 0, str);
+
+  g_string_append (str, " WITH ");
+
+  psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 1, str);
+
+  g_string_append (str, " (PAIRED)");
+  g_string_append (str, "\n");
+
+  tt_options_dialog_append_syntax (d->opt, str);
+
+  g_string_append (str, ".\n");
+
+  text = str->str;
+  g_string_free (str, FALSE);
+
+  return text;
+}
+
+static void
+psppire_dialog_action_paired_activate (GtkAction *a)
+{
+  PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+  PsppireDialogActionPaired *act = PSPPIRE_DIALOG_ACTION_PAIRED (a);
+
+  GtkBuilder *xml = builder_new ("paired-samples.ui");
+  GtkWidget *selector = get_widget_assert (xml, "psppire-selector3");
+  GtkWidget *bb = gtk_hbutton_box_new ();
+  GtkWidget *button = gtk_button_new_with_mnemonic (_("O_ptions..."));
+  GtkWidget *box = get_widget_assert (xml, "vbox3");
+
+
+  pda->dialog = get_widget_assert   (xml, "t-test-paired-samples-dialog");
+  pda->source = get_widget_assert   (xml, "paired-samples-t-test-treeview1");
+
+  gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Paired Samples T Test"));
+
+  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)));
+
+  act->opt = tt_options_dialog_create (GTK_WINDOW (pda->toplevel));
+
+
+  g_signal_connect_swapped (button, "clicked", G_CALLBACK (tt_options_dialog_run), act->opt);
+
+
+  gtk_box_pack_start (GTK_BOX (bb), button, TRUE, TRUE, 5);
+  gtk_box_pack_start (GTK_BOX (box), bb, FALSE, FALSE, 5);
+  gtk_widget_show_all (box);
+
+  psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
+  psppire_dialog_action_set_refresh (pda, refresh);
+
+  g_object_set (pda->source,
+               "predicate", var_is_numeric,
+               NULL);
+
+  psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
+                                   select_as_pair_member,
+                                   act);
+  
+  g_object_unref (xml);
+
+  if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_paired_parent_class)->activate)
+    PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_paired_parent_class)->activate (pda);
+}
+
+static void
+psppire_dialog_action_paired_finalize (GObject *o)
+{
+  PsppireDialogActionPaired *act = PSPPIRE_DIALOG_ACTION_PAIRED (o);
+  tt_options_dialog_destroy (act->opt);
+}
+
+static void
+psppire_dialog_action_paired_class_init (PsppireDialogActionPairedClass *class)
+{
+  GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  action_class->activate = psppire_dialog_action_paired_activate;
+  PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+
+   object_class->finalize = psppire_dialog_action_paired_finalize;
+}
+
+
+static void
+psppire_dialog_action_paired_init (PsppireDialogActionPaired *act)
+{
+  act->opt = NULL;
+}
+
diff --git a/src/ui/gui/psppire-dialog-action-paired.h b/src/ui/gui/psppire-dialog-action-paired.h
new file mode 100644 (file)
index 0000000..d9ff91a
--- /dev/null
@@ -0,0 +1,83 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2013  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <glib-object.h>
+#include <glib.h>
+
+#include "psppire-dialog-action.h"
+
+#ifndef __PSPPIRE_DIALOG_ACTION_PAIRED_H__
+#define __PSPPIRE_DIALOG_ACTION_PAIRED_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_PAIRED (psppire_dialog_action_paired_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_PAIRED(obj)      \
+                     (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                                                 PSPPIRE_TYPE_DIALOG_ACTION_PAIRED, PsppireDialogActionPaired))
+
+#define PSPPIRE_DIALOG_ACTION_PAIRED_CLASS(klass) \
+                     (G_TYPE_CHECK_CLASS_CAST ((klass), \
+                                PSPPIRE_TYPE_DIALOG_ACTION_PAIRED, \
+                                 PsppireDialogActionPairedClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_PAIRED(obj) \
+                    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_PAIRED))
+
+#define PSPPIRE_IS_DIALOG_ACTION_PAIRED_CLASS(klass) \
+                     (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_PAIRED))
+
+
+#define PSPPIRE_DIALOG_ACTION_PAIRED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+                                  PSPPIRE_TYPE_DIALOG_ACTION_PAIRED, \
+                                  PsppireDialogActionPairedClass))
+
+typedef struct _PsppireDialogActionPaired       PsppireDialogActionPaired;
+typedef struct _PsppireDialogActionPairedClass  PsppireDialogActionPairedClass;
+
+
+struct tt_options_dialog;
+
+struct _PsppireDialogActionPaired
+{
+  PsppireDialogAction parent;
+
+  /*< private >*/
+  gboolean dispose_has_run;
+
+  GtkWidget *pairs_treeview ;
+  GtkListStore *list_store ;
+  struct tt_options_dialog *opt;
+};
+
+
+
+
+struct _PsppireDialogActionPairedClass
+{
+  PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_paired_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_PAIRED_H__ */
diff --git a/src/ui/gui/psppire-dialog-action-two-sample.c b/src/ui/gui/psppire-dialog-action-two-sample.c
new file mode 100644 (file)
index 0000000..0dd8d65
--- /dev/null
@@ -0,0 +1,245 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2012, 2013  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <config.h>
+
+#include "psppire-dialog-action-two-sample.h"
+
+#include "psppire-var-view.h"
+
+#include "psppire-selector.h"
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+static void psppire_dialog_action_two_sample_init            (PsppireDialogActionTwoSample      *act);
+static void psppire_dialog_action_two_sample_class_init      (PsppireDialogActionTwoSampleClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionTwoSample, psppire_dialog_action_two_sample, PSPPIRE_TYPE_DIALOG_ACTION);
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+  PsppireDialogActionTwoSample *pd = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (data);
+  gint n_rows = gtk_tree_model_iter_n_children  (GTK_TREE_MODEL (pd->list_store), NULL);
+  struct variable *v = NULL;
+  GtkTreeIter dest_iter;
+
+  if ( n_rows == 0 )
+    return FALSE;
+
+  /* Get the last row */
+  gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (pd->list_store), &dest_iter,
+                                NULL, n_rows - 1);
+
+  /* Get the last (2nd) column */
+  gtk_tree_model_get (GTK_TREE_MODEL (pd->list_store), &dest_iter, 1, &v, -1);
+
+  if (v == NULL)
+    return FALSE;
+
+
+  /* Now check that at least one toggle button is selected */
+
+  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pd->nts[NT_WILCOXON].button)))
+    return TRUE;
+
+  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pd->nts[NT_SIGN].button)))
+    return TRUE;
+
+  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pd->nts[NT_MCNEMAR].button)))
+    return TRUE;
+    
+  return FALSE;
+}
+
+static void
+refresh (PsppireDialogAction *rd_)
+{
+  PsppireDialogActionTwoSample *pd = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (rd_);
+
+  gtk_list_store_clear (GTK_LIST_STORE (pd->list_store));
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pd->nts[NT_WILCOXON].button), FALSE);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pd->nts[NT_SIGN].button), FALSE);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pd->nts[NT_MCNEMAR].button), FALSE);
+}
+
+
+static void
+select_as_pair_member (GtkTreeIter source_iter,
+                      GtkWidget *dest,
+                      GtkTreeModel *source_model,
+                      gpointer data)
+{
+  struct variable *v;
+  struct variable *v1;
+  gint n_rows;
+  GtkTreeIter dest_iter;
+  PsppireDialogActionTwoSample *tt_d = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (data);
+
+
+  gtk_tree_model_get (source_model, &source_iter,
+                     DICT_TVM_COL_VAR, &v, -1);
+
+  n_rows = gtk_tree_model_iter_n_children  (GTK_TREE_MODEL (tt_d->list_store), NULL);
+
+  if ( n_rows > 0 )
+    {
+
+      gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (tt_d->list_store),
+                                    &dest_iter, NULL, n_rows - 1);
+
+      gtk_tree_model_get (GTK_TREE_MODEL (tt_d->list_store), &dest_iter, 1, &v1, -1);
+    }
+  else
+    v1 = NULL;
+
+  if ( n_rows == 0 || v1 != NULL)
+    {
+      gtk_list_store_append (tt_d->list_store, &dest_iter);
+
+      gtk_list_store_set (tt_d->list_store, &dest_iter,
+                         0, v,
+                         1, NULL,
+                         -1);
+    }
+  else
+    {
+      gtk_list_store_set (tt_d->list_store, &dest_iter,
+                         1, v,
+                         -1);
+    }
+}
+
+
+
+static gchar *
+generate_syntax (PsppireDialogAction *pda)
+{
+  gint i;
+
+  PsppireDialogActionTwoSample *d = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (pda);
+  gchar *text = NULL;
+
+  GString *str = g_string_new ("NPAR TEST");
+
+  for (i = 0 ; i < n_Tests; ++i)
+  {
+    if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (d->nts[i].button)))
+      continue;
+
+    g_string_append (str, "\n\t");
+    g_string_append (str, d->nts[i].syntax);
+
+    psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 0, str);
+
+    g_string_append (str, " WITH ");
+
+    psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 1, str);
+
+    g_string_append (str, " (PAIRED)");
+  }
+
+  g_string_append (str, ".\n");
+
+  text = str->str;
+  g_string_free (str, FALSE);
+
+  return text;
+}
+
+static void
+psppire_dialog_action_two_sample_activate (GtkAction *a)
+{
+  PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+  PsppireDialogActionTwoSample *act = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (a);
+
+  GtkBuilder *xml = builder_new ("paired-samples.ui");
+  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");
+
+  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)));
+
+  {
+    /* NPAR Specific options */
+    GtkWidget *frame = gtk_frame_new (_("Test Type"));
+    GtkWidget *bb = gtk_vbutton_box_new ();
+    GtkWidget *box = get_widget_assert (xml, "vbox3");
+
+
+    strcpy (act->nts[NT_WILCOXON].syntax, "/WILCOXON");
+    strcpy (act->nts[NT_SIGN].syntax, "/SIGN");
+    strcpy (act->nts[NT_MCNEMAR].syntax, "/MCNEMAR");
+
+    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);
+
+    gtk_widget_show_all (frame);
+
+    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);
+
+  g_object_set (pda->source,
+               "predicate", var_is_numeric,
+               NULL);
+
+  psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
+                                   select_as_pair_member,
+                                   act);
+  
+  g_object_unref (xml);
+
+  if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_two_sample_parent_class)->activate)
+    PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_two_sample_parent_class)->activate (pda);
+}
+
+static void
+psppire_dialog_action_two_sample_class_init (PsppireDialogActionTwoSampleClass *class)
+{
+  GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+
+  action_class->activate = psppire_dialog_action_two_sample_activate;
+  PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+
+static void
+psppire_dialog_action_two_sample_init (PsppireDialogActionTwoSample *act)
+{
+}
+
diff --git a/src/ui/gui/psppire-dialog-action-two-sample.h b/src/ui/gui/psppire-dialog-action-two-sample.h
new file mode 100644 (file)
index 0000000..c754e74
--- /dev/null
@@ -0,0 +1,93 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2013  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <glib-object.h>
+#include <glib.h>
+
+#include "psppire-dialog-action.h"
+
+#ifndef __PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_H__
+#define __PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE (psppire_dialog_action_two_sample_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_TWO_SAMPLE(obj)  \
+                     (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                                                 PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE, PsppireDialogActionTwoSample))
+
+#define PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_CLASS(klass) \
+                     (G_TYPE_CHECK_CLASS_CAST ((klass), \
+                                PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE, \
+                                 PsppireDialogActionTwoSampleClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_TWO_SAMPLE(obj) \
+                    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE))
+
+#define PSPPIRE_IS_DIALOG_ACTION_TWO_SAMPLE_CLASS(klass) \
+                     (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE))
+
+
+#define PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+                                  PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE, \
+                                  PsppireDialogActionTwoSampleClass))
+
+typedef struct _PsppireDialogActionTwoSample       PsppireDialogActionTwoSample;
+typedef struct _PsppireDialogActionTwoSampleClass  PsppireDialogActionTwoSampleClass;
+
+
+enum test
+  {
+    NT_WILCOXON,
+    NT_SIGN,
+    NT_MCNEMAR,
+    n_Tests
+  };
+
+struct ts_test
+{
+  GtkWidget *button;
+  char syntax[16];
+};
+
+struct _PsppireDialogActionTwoSample
+{
+  PsppireDialogAction parent;
+
+  /*< private >*/
+  gboolean dispose_has_run;
+
+  GtkWidget *pairs_treeview ;
+  GtkListStore *list_store ;
+  struct ts_test nts[n_Tests];
+};
+
+
+struct _PsppireDialogActionTwoSampleClass
+{
+  PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_two_sample_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_H__ */
index 2f5087f245d3c0e277e5f9f4c6154336b4ae860b..d89b3b4ec288f8d9f00fd812a15f72f9d4b49202 100644 (file)
@@ -474,6 +474,12 @@ connect_notify_signal (GtkWidget *w, gpointer data)
 gint
 psppire_dialog_run (PsppireDialog *dialog)
 {
+  gchar *title = NULL;
+  g_object_get (dialog, "title", &title, NULL);
+
+  if (title == NULL)
+    g_warning ("PsppireDialog %s has no title", gtk_widget_get_name (GTK_WIDGET (dialog)));
+  
   if ( dialog->contents_are_valid != NULL )
     gtk_container_foreach (GTK_CONTAINER (dialog->box),
                           connect_notify_signal,
diff --git a/src/ui/gui/t-test-paired-samples.c b/src/ui/gui/t-test-paired-samples.c
deleted file mode 100644 (file)
index 4f8baee..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2011, 2012  Free Software Foundation
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "t-test-options.h"
-#include "t-test-paired-samples.h"
-
-#include "psppire-data-window.h"
-#include "psppire-selector.h"
-#include "psppire-var-view.h"
-
-#include "psppire-dict.h"
-
-#include "dialog-common.h"
-#include "psppire-dialog.h"
-
-#include "executor.h"
-
-#include "helper.h"
-
-#include "psppire-var-ptr.h"
-
-#include "paired-dialog.h"
-
-#include <gettext.h>
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-
-static void
-refresh (void *aux)
-{
-}
-
-
-static gboolean
-valid (void *aux)
-{
-  return TRUE;
-}
-
-static gchar *
-generate_syntax (const struct paired_samples_dialog *d, const struct tt_options_dialog *opt)
-{
-  gchar *text = NULL;
-  GString *str =   g_string_new ("T-TEST \n\tPAIRS = ");
-
-  psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 0, str);
-
-  g_string_append (str, " WITH ");
-
-  psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 1, str);
-
-  g_string_append (str, " (PAIRED)");
-  g_string_append (str, "\n");
-
-  tt_options_dialog_append_syntax (opt, str);
-
-  g_string_append (str, ".\n");
-
-  text = str->str;
-  g_string_free (str, FALSE);
-
-  return text;
-}
-
-/* Pops up the dialog box */
-void
-t_test_paired_samples_dialog (PsppireDataWindow *de)
-{
-  gint response;
-  struct paired_samples_dialog *tt_d = two_sample_dialog_create (de);
-  struct tt_options_dialog *opts = tt_options_dialog_create (GTK_WINDOW (de));
-
-  GtkWidget *bb = gtk_hbutton_box_new ();
-  GtkWidget *opt = gtk_button_new_with_mnemonic (_("O_ptions..."));
-  gtk_box_pack_start (GTK_BOX (bb), opt, TRUE, TRUE, 5);
-
-  gtk_widget_show_all (bb);
-  two_sample_dialog_add_widget (tt_d, bb);
-  
-  g_signal_connect_swapped (opt, "clicked", G_CALLBACK (tt_options_dialog_run), opts);
-
-  tt_d->refresh = refresh;
-  tt_d->valid = valid;
-  tt_d->aux = opts;
-
-  gtk_window_set_title (GTK_WINDOW (tt_d->dialog), _("Paired Samples T Test"));
-
-  response = psppire_dialog_run (PSPPIRE_DIALOG (tt_d->dialog));
-
-  switch (response)
-    {
-    case GTK_RESPONSE_OK:
-      g_free (execute_syntax_string (de, generate_syntax (tt_d, opts)));
-      break;
-    case PSPPIRE_RESPONSE_PASTE:
-      g_free (paste_syntax_to_window (generate_syntax (tt_d, opts)));
-      break;
-    default:
-      break;
-    }
-
-  two_sample_dialog_destroy (tt_d);
-  tt_options_dialog_destroy (opts);
-}
diff --git a/src/ui/gui/t-test-paired-samples.h b/src/ui/gui/t-test-paired-samples.h
deleted file mode 100644 (file)
index d7941fc..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef T_TEST_PAIRED_SAMPLES_DIALOG
-#define T_TEST_PAIRED_SAMPLES_DIALOG
-
-#include "psppire-data-window.h"
-
-void t_test_paired_samples_dialog (PsppireDataWindow *) ;
-
-#endif
index 93257e5b084e147724de8479aaa74d90d8ed891d..3d78f1f4a573f8117a4a799bf2c7e448a8d73154 100644 (file)
@@ -33,6 +33,7 @@
 #include "psppire-dialog-action-kmeans.h"
 #include "psppire-dialog-action-logistic.h"
 #include "psppire-dialog-action-means.h"
+#include "psppire-dialog-action-paired.h"
 #include "psppire-means-layer.h"
 #include "psppire-dialog-action-rank.h"
 #include "psppire-dialog-action-regression.h"
@@ -41,6 +42,7 @@
 #include "psppire-dialog-action-runs.h"
 #include "psppire-dialog-action-sort.h"
 #include "psppire-dialog-action-tt1s.h"
+#include "psppire-dialog-action-two-sample.h"
 #include "psppire-dialog-action-univariate.h"
 #include "psppire-dialog-action-var-info.h"
 #include "psppire-value-entry.h"
@@ -81,6 +83,7 @@ preregister_widgets (void)
   psppire_dialog_action_kmeans_get_type ();
   psppire_dialog_action_k_related_get_type ();
   psppire_dialog_action_means_get_type ();
+  psppire_dialog_action_paired_get_type ();
   psppire_dialog_action_indep_samps_get_type ();
   psppire_means_layer_get_type ();
   psppire_dialog_action_var_info_get_type ();
@@ -91,6 +94,7 @@ preregister_widgets (void)
   psppire_dialog_action_runs_get_type ();
   psppire_dialog_action_sort_get_type ();
   psppire_dialog_action_tt1s_get_type ();
+  psppire_dialog_action_two_sample_get_type ();
   psppire_dialog_action_univariate_get_type ();
 
   /* This seems to be necessary on Cygwin.