Make the default view the variable view instead of the data view
[pspp] / src / ui / gui / psppire-data-window.c
index 8af85b946b590e233417451317d6afd0f6809219..9b90930edd6cf149bf822e3fa4477d4689afc4d3 100644 (file)
@@ -47,7 +47,7 @@
 #include "gl/c-strcasestr.h"
 #include "gl/xvasprintf.h"
 
-#include "ui/gui/efficient-sheet/src/jmd-sheet.h"
+#include <ssw-sheet.h>
 
 #include "find-dialog.h"
 #include "options-dialog.h"
@@ -69,6 +69,7 @@
 #include "psppire-dialog-action-frequencies.h"
 #include "psppire-dialog-action-histogram.h"
 #include "psppire-dialog-action-indep-samps.h"
+#include "psppire-dialog-action-k-independent.h"
 #include "psppire-dialog-action-k-related.h"
 #include "psppire-dialog-action-kmeans.h"
 #include "psppire-dialog-action-logistic.h"
@@ -970,14 +971,9 @@ file_import (PsppireDataWindow *dw)
   PsppireImportAssistant *asst = PSPPIRE_IMPORT_ASSISTANT (w);
   gtk_widget_show_all (w);
 
-  asst->main_loop = g_main_loop_new (NULL, TRUE);
-  g_main_loop_run (asst->main_loop);
-  g_main_loop_unref (asst->main_loop);
+  int response = psppire_import_assistant_run (asst);
 
-  if (!asst->file_name)
-    goto end;
-
-  switch (asst->response)
+  switch (response)
     {
     case GTK_RESPONSE_APPLY:
       {
@@ -993,7 +989,6 @@ file_import (PsppireDataWindow *dw)
       break;
     }
 
- end:
   gtk_widget_destroy (GTK_WIDGET (asst));
 }
 
@@ -1058,10 +1053,9 @@ connect_action_to_menuitem (GActionMap *map, const gchar *action_name, GtkWidget
 
 
 static void
-set_data_page (PsppireDataWindow *dw)
+on_realize (PsppireDataWindow *dw)
 {
   gtk_notebook_set_current_page (GTK_NOTEBOOK (dw->data_editor), 1);
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (dw->data_editor), 0);
 }
 
 
@@ -1075,8 +1069,8 @@ on_cut (PsppireDataWindow *dw)
       g_object_get (dw->data_editor, "dictionary", &dict, NULL);
 
       gint x, y;
-      JmdSheet *sheet = JMD_SHEET (dw->data_editor->data_sheet);
-      JmdRange sel = *sheet->selection;
+      SswSheet *sheet = SSW_SHEET (dw->data_editor->data_sheet);
+      SswRange sel = *sheet->selection;
 
       GtkClipboard *clip =
        gtk_clipboard_get_for_display (gtk_widget_get_display (GTK_WIDGET (dw)),
@@ -1128,7 +1122,7 @@ on_copy (PsppireDataWindow *dw)
        gtk_clipboard_get_for_display (gtk_widget_get_display (GTK_WIDGET (dw)),
                                   GDK_SELECTION_CLIPBOARD);
 
-      jmd_sheet_set_clip (JMD_SHEET (dw->data_editor->data_sheet), clip);
+      ssw_sheet_set_clip (SSW_SHEET (dw->data_editor->data_sheet), clip);
     }
 }
 
@@ -1149,7 +1143,7 @@ on_clear_cases (PsppireDataWindow *dw)
   int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (de));
   if (p == PSPPIRE_DATA_EDITOR_DATA_VIEW)
     {
-      JmdRange *range = JMD_SHEET(de->data_sheet)->selection;
+      SswRange *range = SSW_SHEET(de->data_sheet)->selection;
       psppire_data_store_delete_cases (de->data_store, range->start_y,
                                       range->end_y - range->start_y + 1);
       gtk_widget_queue_draw (GTK_WIDGET (de->data_sheet));
@@ -1179,12 +1173,12 @@ insert_variable (PsppireDataWindow *dw)
 
   if (p == PSPPIRE_DATA_EDITOR_DATA_VIEW)
     {
-      JmdRange *range = JMD_SHEET(de->data_sheet)->selection;
+      SswRange *range = SSW_SHEET(de->data_sheet)->selection;
       psppire_data_editor_insert_new_variable_at_posn (de, range->start_x);
     }
   else
     {
-      JmdRange *range = JMD_SHEET(de->var_sheet)->selection;
+      SswRange *range = SSW_SHEET(de->var_sheet)->selection;
       psppire_data_editor_insert_new_variable_at_posn (de, range->start_y);
     }
 }
@@ -1193,7 +1187,7 @@ static void
 insert_case_at_row (PsppireDataWindow *dw)
 {
   PsppireDataEditor *de = dw->data_editor;
-  JmdRange *range = JMD_SHEET(de->data_sheet)->selection;
+  SswRange *range = SSW_SHEET(de->data_sheet)->selection;
   psppire_data_editor_insert_new_case_at_posn (de, range->start_y);
 }
 
@@ -1458,7 +1452,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de,
     PSPPIRE_DATA_EDITOR (psppire_data_editor_new (de->dict, de->data_store));
 
   g_signal_connect (de, "realize",
-                    G_CALLBACK (set_data_page), de);
+                    G_CALLBACK (on_realize), de);
 
   g_signal_connect_swapped (de->data_store, "case-changed",
                            G_CALLBACK (set_unsaved), de);
@@ -1543,6 +1537,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de,
   connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_1SKS, de);
   connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE, de);
   connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_K_RELATED, de);
+  connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_K_INDEPENDENT, de);
 
   {
     GSimpleAction *file_import_action = g_simple_action_new ("file-import", NULL);