Add "dictionary" property to PsppireVarStore and use it.
[pspp-builds.git] / src / ui / gui / transpose-dialog.c
index 272ef1b3934daaa4f07043dc3dc2f5a5d9e04a8d..36640f6f752a71829b391c1310a243d97de8eb17 100644 (file)
 #include "transpose-dialog.h"
 #include "psppire-selector.h"
 #include "psppire-dialog.h"
-#include "helper.h"
-#include "data-editor.h"
+#include "executor.h"
+#include "psppire-data-window.h"
 #include "dict-display.h"
 #include <language/syntax-string-source.h>
-#include "syntax-editor.h"
+#include "helper.h"
 
 #include "dialog-common.h"
 
@@ -79,7 +79,8 @@ void
 transpose_dialog (GObject *o, gpointer data)
 {
   gint response ;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
+  PsppireDict *dict = NULL;
 
   GtkBuilder *xml = builder_new ("psppire.ui");
 
@@ -94,11 +95,10 @@ transpose_dialog (GObject *o, gpointer data)
 
   g_object_get (de->data_editor, "var-store", &vs, NULL);
 
-  attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
-                                vs->dict,
-                                GTK_SELECTION_MULTIPLE, NULL);
+  g_object_get (vs, "dictionary", &dict, NULL);
+  g_object_set (source, "dictionary", dict, NULL);
 
-  set_dest_model (GTK_TREE_VIEW (dest), vs->dict);
+  set_dest_model (GTK_TREE_VIEW (dest), dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1),
                                 source, dest,
@@ -116,7 +116,7 @@ transpose_dialog (GObject *o, gpointer data)
 
   g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  xml);
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
                                      dialog_state_valid, xml);
@@ -127,7 +127,8 @@ transpose_dialog (GObject *o, gpointer data)
     {
     case GTK_RESPONSE_OK:
       {
-       gchar *syntax = generate_syntax (vs->dict, xml);
+       gchar *syntax = generate_syntax (dict, xml);
+
        struct getl_interface *sss = create_syntax_string_source (syntax);
        execute_syntax (sss);
 
@@ -136,12 +137,8 @@ transpose_dialog (GObject *o, gpointer data)
       break;
     case PSPPIRE_RESPONSE_PASTE:
       {
-       gchar *syntax = generate_syntax (vs->dict, xml);
-
-       struct syntax_editor *se =
-         (struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL);
-
-       gtk_text_buffer_insert_at_cursor (se->buffer, syntax, -1);
+       gchar *syntax = generate_syntax (dict, xml);
+        paste_syntax_in_new_window (syntax);
 
        g_free (syntax);
       }