Add "dictionary" property to PsppireVarStore and use it.
[pspp-builds.git] / src / ui / gui / recode-dialog.c
index 859737f63e7d4d7895c1347f2a585c60d28cb5ab..0bb82eb335a9a6d3c75a13f6c1cf34e47863c8a3 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007  Free Software Foundation
+   Copyright (C) 2007, 2009  Free Software Foundation
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include "recode-dialog.h"
 
+#include "executor.h"
+
 #include <gtk/gtk.h>
 
+#include <xalloc.h>
 #include <language/syntax-string-source.h>
 #include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
@@ -33,7 +36,7 @@
 #include <ui/gui/helper.h>
 #include <ui/gui/psppire-dialog.h>
 #include <ui/gui/psppire-var-store.h>
-#include <ui/gui/helper.h>
+
 #include <ui/syntax-gen.h>
 
 #include "psppire-acr.h"
@@ -71,7 +74,7 @@ new_value_copy (struct new_value *nv)
   struct new_value *copy = g_memdup (nv, sizeof (*copy));
 
   if ( nv->type == NV_STRING )
-    copy->v.s = strdup (nv->v.s);
+    copy->v.s = xstrdup (nv->v.s);
 
   return copy;
 }
@@ -864,7 +867,7 @@ recode_dialog (PsppireDataWindow *de, gboolean diff)
   rd.new_name_entry = get_widget_assert (builder, "dest-name-entry");
   rd.new_label_entry = get_widget_assert (builder, "dest-label-entry");
 
-  rd.dict = vs->dict;
+  g_object_get (vs, "dictionary", &rd.dict, NULL);
 
   rd.value_map = gtk_list_store_new (2,
                                     old_value_get_type (),
@@ -885,14 +888,11 @@ recode_dialog (PsppireDataWindow *de, gboolean diff)
   gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), GTK_WINDOW (de));
 
 
-  attach_dictionary_to_treeview (GTK_TREE_VIEW (rd.dict_treeview),
-                                vs->dict,
-                                GTK_SELECTION_MULTIPLE, NULL);
-
+  g_object_set (rd.dict_treeview, "dictionary", rd.dict, NULL);
 
   if ( ! rd.different )
     {
-      set_dest_model (GTK_TREE_VIEW (rd.variable_treeview), vs->dict);
+      set_dest_model (GTK_TREE_VIEW (rd.variable_treeview), rd.dict);
     }
   else
     {
@@ -916,7 +916,7 @@ recode_dialog (PsppireDataWindow *de, gboolean diff)
 
       gtk_tree_view_column_set_cell_data_func (col, renderer,
                                               cell_var_name,
-                                              vs->dict, 0);
+                                              rd.dict, 0);
 
 
       gtk_tree_view_append_column (GTK_TREE_VIEW (rd.variable_treeview), col);