Add "dictionary" property to PsppireVarStore and use it.
[pspp-builds.git] / src / ui / gui / frequencies-dialog.c
index cba8573d2860de40625e6565a055700ce6ffee37..8706f3a4e63ac105e0caee6a46e597cee048fc40 100644 (file)
@@ -29,7 +29,7 @@
 #include <ui/gui/helper.h>
 #include <ui/gui/psppire-dialog.h>
 #include <ui/gui/psppire-var-store.h>
-#include <ui/gui/psppire-syntax-window.h>
+#include "executor.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -311,7 +311,7 @@ frequencies_dialog (GObject *o, gpointer data)
 
   struct frequencies_dialog fd;
 
-  GladeXML *xml = XML_NEW ("frequencies.glade");
+  GtkBuilder *xml = builder_new ("frequencies.ui");
 
   GtkWidget *dialog = get_widget_assert   (xml, "frequencies-dialog");
   GtkWidget *source = get_widget_assert   (xml, "dict-treeview");
@@ -333,11 +333,11 @@ frequencies_dialog (GObject *o, gpointer data)
 
   gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
-  attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
-                                vs->dict,
-                                GTK_SELECTION_MULTIPLE, NULL);
+  g_object_get (vs, "dictionary", &fd.dict, NULL);
+  g_object_set (source, "dictionary", fd.dict, NULL);
 
-  set_dest_model (GTK_TREE_VIEW (dest), vs->dict);
+
+  set_dest_model (GTK_TREE_VIEW (dest), fd.dict);
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
@@ -349,7 +349,6 @@ frequencies_dialog (GObject *o, gpointer data)
 
 
   fd.stat_vars = GTK_TREE_VIEW (dest);
-  fd.dict = vs->dict;
   fd.table_button = get_widget_assert (xml, "checkbutton1");
   fd.format_dialog = get_widget_assert (xml, "format-dialog");
   fd.maximum_cats = get_widget_assert (xml, "hbox5");
@@ -393,6 +392,7 @@ frequencies_dialog (GObject *o, gpointer data)
     case GTK_RESPONSE_OK:
       {
        gchar *syntax = generate_syntax (&fd);
+
        struct getl_interface *sss = create_syntax_string_source (syntax);
        execute_syntax (sss);
 
@@ -402,13 +402,7 @@ frequencies_dialog (GObject *o, gpointer data)
     case PSPPIRE_RESPONSE_PASTE:
       {
        gchar *syntax = generate_syntax (&fd);
-
-        GtkWidget *se = psppire_syntax_window_new ();
-
-       gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1);
-
-       gtk_widget_show (se);
-
+       paste_syntax_in_new_window (syntax);
        g_free (syntax);
       }
       break;