Move data-editor.c to psppire-data-window.c
[pspp-builds.git] / src / ui / gui / rank-dialog.c
index 3e072aec571fe08be72a1b2da14294ae7e53d44c..c75f64f205d29abc680f1925d50860170a8c25b1 100644 (file)
 #include "rank-dialog.h"
 
 #include <gtk/gtk.h>
-#include <gtksheet/gtksheet.h>
 #include <stdlib.h>
 
 #include <language/syntax-string-source.h>
-#include <ui/gui/data-editor.h>
+#include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/dict-display.h>
 #include <ui/gui/helper.h>
 #include <ui/gui/psppire-dialog.h>
 #include <ui/gui/psppire-var-store.h>
-#include <ui/gui/syntax-editor.h>
+#include <ui/gui/psppire-syntax-window.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -111,7 +110,7 @@ generate_syntax (const struct rank_dialog *rd)
 
   GString *str = g_string_new ("RANK VARIABLES=");
 
-  append_variable_names (str, rd->dict, GTK_TREE_VIEW (rd->rank_vars));
+  append_variable_names (str, rd->dict, GTK_TREE_VIEW (rd->rank_vars), 0);
 
   g_string_append_printf (str, " (%c)",
                   gtk_toggle_button_get_active (rd->ascending_togglebutton)
@@ -121,7 +120,7 @@ generate_syntax (const struct rank_dialog *rd)
     {
       g_string_append (str, "\n\tBY ");
 
-      append_variable_names (str, rd->dict, GTK_TREE_VIEW (rd->group_vars));
+      append_variable_names (str, rd->dict, GTK_TREE_VIEW (rd->group_vars), 0);
     }
 
   g_string_append (str, "\n\t/PRINT = ");
@@ -221,7 +220,7 @@ void
 rank_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   struct rank_dialog rd;
 
@@ -235,11 +234,9 @@ rank_dialog (GObject *o, gpointer data)
   GtkWidget *types_button = get_widget_assert (xml, "button1");
   GtkWidget *ties_button = get_widget_assert (xml, "button2");
 
-  GtkSheet *var_sheet =
-    GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
-
-  PsppireVarStore *vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet));
+  PsppireVarStore *vs = NULL;
 
+  g_object_get (de->data_editor, "var-store", &vs, NULL);
 
   rd.dict = vs->dict;
   rd.rank_vars =   get_widget_assert (xml, "variables-treeview");
@@ -307,7 +304,7 @@ rank_dialog (GObject *o, gpointer data)
                    G_CALLBACK (on_ntiles_toggle),
                    rd.ntiles_entry);
 
-  gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (vars),
                                 vs->dict,
@@ -320,6 +317,7 @@ rank_dialog (GObject *o, gpointer data)
                                 vars,
                                 rd.rank_vars,
                                 insert_source_row_into_tree_view,
+                                NULL,
                                 NULL);
 
   set_dest_model (GTK_TREE_VIEW (rd.group_vars), vs->dict);
@@ -328,6 +326,7 @@ rank_dialog (GObject *o, gpointer data)
                                 vars,
                                 rd.group_vars,
                                 insert_source_row_into_tree_view,
+                                NULL,
                                 NULL);
 
 
@@ -360,10 +359,11 @@ rank_dialog (GObject *o, gpointer data)
       {
        gchar *syntax = generate_syntax (&rd);
 
-       struct syntax_editor *se =
-         (struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL);
+        GtkWidget *se = psppire_syntax_window_new ();
+
+       gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1);
 
-       gtk_text_buffer_insert_at_cursor (se->buffer, syntax, -1);
+       gtk_widget_show (se);
 
        g_free (syntax);
       }