Add an (empty) datasheet to the import assistant
[pspp] / src / ui / gui / psppire-import-assistant.c
index 6441e47193ba9eb2cf17e32af00c1b6371fe2395..de4e76252a1fe3eecd2a900423c23ca7943be710 100644 (file)
 #include "psppire-spreadsheet-model.h"
 #include "psppire-text-file.h"
 #include "psppire-delimited-text.h"
+#include "psppire-data-sheet.h"
+#include "psppire-data-store.h"
+#include "psppire-dict.h"
+#include "psppire-variable-sheet.h"
 
 #include "ui/syntax-gen.h"
 
@@ -1801,6 +1805,9 @@ prepare_formats_page (PsppireImportAssistant *ia)
 {
   PsppireDict *dict = psppire_dict_new_from_dict (ia->dict);
   g_object_set (ia->var_sheet, "data-model", dict, NULL);
+
+  PsppireDataStore *store = psppire_data_store_new (dict);
+  g_object_set (ia->data_sheet, "data-model", store, NULL);
 }
 
 static void
@@ -1823,6 +1830,15 @@ formats_page_create (PsppireImportAssistant *ia)
 
       gtk_widget_show_all (vars_scroller);
     }
+  GtkWidget *data_scroller = get_widget_assert (builder, "data-scroller");
+  if (ia->data_sheet == NULL)
+    {
+      ia->data_sheet = psppire_data_sheet_new ();
+
+      gtk_container_add (GTK_CONTAINER (data_scroller), ia->data_sheet);
+
+      gtk_widget_show_all (data_scroller);
+    }
 
   add_page_to_assistant (ia, w,
                         GTK_ASSISTANT_PAGE_CONFIRM, _("Adjust Variable Formats"));