#include "recode-dialog.h"
#include <gtk/gtk.h>
-#include <gtksheet/gtksheet.h>
#include <language/syntax-string-source.h>
#include <ui/gui/data-editor.h>
#include <ui/gui/psppire-dialog.h>
#include <ui/gui/psppire-var-store.h>
#include <ui/gui/syntax-editor.h>
-#include <libpspp/syntax-gen.h>
+#include <ui/syntax-gen.h>
#include "psppire-acr.h"
GtkWidget *ov_high_down_entry;
GtkListStore *value_map;
- GtkListStore *local_store;
/* Indicates that the INTO {new variables} form of the dialog
is being used */
COL_OLD,
COL_NEW_NAME,
COL_NEW_LABEL,
- n_COLS
+ n_COL_VARS
};
enum {
GtkWidget *output_variable_box = get_widget_assert (xml,"frame4");
- GtkSheet *var_sheet =
- GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
+ PsppireVarStore *vs = NULL;
- PsppireVarStore *vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet));
+ g_object_get (de->data_editor, "var-store", &vs, NULL);
rd.change_button = get_widget_assert (xml, "change-button");
GtkTreeViewColumn *col;
GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
- rd.var_map = gtk_list_store_new (n_COLS, G_TYPE_INT,
+ rd.var_map = gtk_list_store_new (n_COL_VARS, G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_STRING);
break;
}
+
+ gtk_list_store_clear (GTK_LIST_STORE (rd.value_map));
+ g_object_unref (rd.value_map);
+
g_object_unref (xml);
}
run_old_and_new_dialog (struct recode_dialog *rd)
{
gint response;
- rd->local_store = clone_list_store (rd->value_map);
-
- g_object_ref (rd->local_store);
+ GtkListStore *local_store = clone_list_store (rd->value_map);
- psppire_acr_set_model (rd->acr, rd->local_store);
+ psppire_acr_set_model (rd->acr, local_store);
psppire_acr_set_get_value_func (rd->acr, set_value, rd);
gtk_window_set_title (GTK_WINDOW (rd->old_and_new_dialog),
if ( response == PSPPIRE_RESPONSE_CONTINUE )
- rd->value_map = clone_list_store (rd->local_store);
+ {
+ g_object_unref (rd->value_map);
+ rd->value_map = clone_list_store (local_store);
+ }
+ else
+ g_object_unref (local_store);
psppire_dialog_notify_change (PSPPIRE_DIALOG (rd->dialog));
break;
case NV_STRING:
{
- struct string ds;
- ds_init_cstr (&ds, nv->v.s);
- gen_quoted_string (&ds);
+ struct string ds = DS_EMPTY_INITIALIZER;
+ syntax_gen_string (&ds, ss_cstr (nv->v.s));
g_string_append (str, ds_cstr (&ds));
ds_destroy (&ds);
}
break;
case OV_STRING:
{
- struct string ds;
- ds_init_cstr (&ds, ov->v.s);
- gen_quoted_string (&ds);
+ struct string ds = DS_EMPTY_INITIALIZER;
+ syntax_gen_string (&ds, ss_cstr (ov->v.s));
g_string_append (str, ds_cstr (&ds));
ds_destroy (&ds);
}
continue;
}
- ds_init_cstr (&ls, label);
+ ds_init_empty (&ls);
+ syntax_gen_string (&ls, ss_cstr (label));
g_free (label);
- gen_quoted_string (&ls);
g_string_append_printf (str, "\nVARIABLE LABELS %s %s.",
name, ds_cstr (&ls));