Move data-editor.c to psppire-data-window.c
[pspp-builds.git] / src / ui / gui / rank-dialog.c
index b463b25b7156cebbff3d7330fb0a0dd2dd55f2e2..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)
@@ -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,
@@ -362,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);
       }