constness
[pspp] / src / ui / gui / psppire-import-assistant.c
index 6650b5d9cfb2d132467cd634f29c92f55f19cbb5..f7454c5b3e230a1683a7ce157a4bede2fcd4a264 100644 (file)
@@ -1194,7 +1194,11 @@ GtkWidget *
 psppire_import_assistant_new (GtkWindow *toplevel)
 {
   return GTK_WIDGET (g_object_new (PSPPIRE_TYPE_IMPORT_ASSISTANT,
-                                  "transient-for", toplevel,
+                                  /* Some window managers (notably ratpoison)
+                                     ignore the maximise command when a window is
+                                     transient.  This causes problems for this
+                                     window. */
+                                  /* "transient-for", toplevel, */
                                   NULL));
 }
 
@@ -1294,7 +1298,7 @@ parse_field (PsppireImportAssistant *ia,
   bool ok;
 
   struct substring field = ia->columns[column].contents[row];
-  struct variable *var = dict_get_var (ia->dict, column);
+  const struct variable *var = dict_get_var (ia->dict, column);
   union value val;
 
   value_init (&val, var_get_width (var));
@@ -1856,6 +1860,35 @@ my_advance (struct casereader *reader, void *aux, casenumber cnt)
 }
 
 
+static void
+foo (struct dictionary *dict, void *aux)
+{
+  PsppireImportAssistant *ia = PSPPIRE_IMPORT_ASSISTANT (aux);
+  g_print ("%s:%d\n", __FILE__, __LINE__);
+
+  struct caseproto *proto = caseproto_create ();
+
+  int i;
+  for (i = 0 ; i < dict_get_var_cnt (ia->dict); ++i)
+    {
+      const struct variable *var = dict_get_var (ia->dict, i);
+      proto = caseproto_add_width (proto, var_get_width (var));
+    }
+
+
+  gint n_rows = gtk_tree_model_iter_n_children (ia->delimiters_model, NULL);
+
+  struct casereader *reader =
+    casereader_create_random (proto, n_rows, &my_casereader_class,  ia);
+
+
+  PsppireDataStore *store = NULL;
+    
+  g_object_get (ia->data_sheet, "data-model", &store, NULL);
+  
+  psppire_data_store_set_reader (store, reader);
+}
+
 /* Called just before the formats page of the assistant is
    displayed. */
 static void
@@ -1870,6 +1903,8 @@ prepare_formats_page (PsppireImportAssistant *ia)
 
   struct caseproto *proto = caseproto_create ();
 
+  dict_set_change_callback (ia->dict, foo, ia);
+
   int i;
   for (i = 0 ; i < dict_get_var_cnt (ia->dict); ++i)
     {
@@ -1923,7 +1958,6 @@ formats_page_create (PsppireImportAssistant *ia)
   add_page_to_assistant (ia, w,
                         GTK_ASSISTANT_PAGE_CONFIRM, _("Adjust Variable Formats"));
 
-  ia->data_tree_view = NULL;
   ia->modified_vars = NULL;
   ia->modified_var_cnt = 0;
 }