New module psppire-var-view
[pspp-builds.git] / src / ui / gui / crosstabs-dialog.c
index a3498d1f6d72c4b70b72a46ccc6569721898c29e..2b93a77b657afdfd2cdbb78657669c56ae11bb7b 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "checkbox-treeview.h"
 #include "crosstabs-dialog.h"
+#include "psppire-var-view.h"
 
 #include <gtk/gtk.h>
 #include <stdlib.h>
@@ -26,7 +27,7 @@
 #include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/dict-display.h>
-#include "helper.h"
+#include "executor.h"
 #include <ui/gui/psppire-dialog.h>
 #include <ui/gui/psppire-var-store.h>
 #include <ui/gui/helper.h>
@@ -259,9 +260,9 @@ generate_syntax (const struct crosstabs_dialog *cd)
   GString *string = g_string_new ("CROSSTABS");
 
   g_string_append (string, "\n\t/TABLES=");
-  append_variable_names (string, cd->dict, GTK_TREE_VIEW (cd->row_vars), 0);
+  psppire_var_view_append_names (PSPPIRE_VAR_VIEW (cd->row_vars), 0, string);
   g_string_append (string, "\tBY\t");
-  append_variable_names (string, cd->dict, GTK_TREE_VIEW (cd->col_vars), 0);
+  psppire_var_view_append_names (PSPPIRE_VAR_VIEW (cd->col_vars), 0, string);
 
   g_string_append (string, "\n\t/FORMAT=");
 
@@ -388,8 +389,8 @@ crosstabs_dialog (GObject *o, gpointer data)
   struct crosstabs_dialog cd;
 
   GtkBuilder *xml = builder_new ("crosstabs.ui");
-
   PsppireVarStore *vs = NULL;
+  PsppireDict *dict = NULL;
 
   PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
@@ -398,8 +399,6 @@ crosstabs_dialog (GObject *o, gpointer data)
   GtkWidget *source = get_widget_assert   (xml, "dict-treeview");
   GtkWidget *dest_rows =   get_widget_assert   (xml, "rows");
   GtkWidget *dest_cols =   get_widget_assert   (xml, "cols");
-  GtkWidget *row_selector = get_widget_assert (xml, "row-selector");
-  GtkWidget *col_selector = get_widget_assert (xml, "col-selector");
   GtkWidget *format_button = get_widget_assert (xml, "format-button");
   GtkWidget *stat_button = get_widget_assert (xml, "stats-button");
   GtkWidget *cell_button = get_widget_assert (xml, "cell-button");
@@ -423,30 +422,12 @@ crosstabs_dialog (GObject *o, gpointer data)
 
   gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
-  attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
-                                vs->dict,
-                                GTK_SELECTION_MULTIPLE, NULL);
-
-  set_dest_model (GTK_TREE_VIEW (dest_rows), vs->dict);
-  set_dest_model (GTK_TREE_VIEW (dest_cols), vs->dict);
-
-  psppire_selector_set_subjects (PSPPIRE_SELECTOR (row_selector),
-                                source,
-                                dest_rows,
-                                insert_source_row_into_tree_view,
-                                NULL,
-                                NULL);
-
-  psppire_selector_set_subjects (PSPPIRE_SELECTOR (col_selector),
-                                source,
-                                dest_cols,
-                                insert_source_row_into_tree_view,
-                                NULL,
-                                NULL);
+  g_object_get (vs, "dictionary", &dict, NULL);
+  g_object_set (source, "model", dict, NULL);
 
   cd.row_vars = GTK_TREE_VIEW (dest_rows);
   cd.col_vars = GTK_TREE_VIEW (dest_cols);
-  cd.dict = vs->dict;
+  g_object_get (vs, "dictionary", &cd.dict, NULL);
   cd.format_dialog = get_widget_assert (xml, "format-dialog");
   cd.table_button = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "print-tables"));
   cd.pivot_button = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "pivot"));