From: Friedrich Beckmann Date: Sun, 12 Jul 2020 16:36:16 +0000 (+0200) Subject: gui: Pasting also considers labels as valid data X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36c0d2ad88eb077c1cf411f7ba7061a8e65688fe;p=pspp gui: Pasting also considers labels as valid data With this patch pasting from clipboard also interprets labels as valid data. First it is checked if the pasted data is a label for the destination variable. Then the corresponding data is stored. --- diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index c780e06eb0..c0fc42a2f2 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -155,9 +155,20 @@ psppire_data_store_string_to_value (GtkTreeModel *model, gint col, gint row, union value val; value_init (&val, width); - char *xx = - data_in (ss_cstr (in), psppire_dict_encoding (store->dict), - fmt->type, &val, width, "UTF-8"); + const struct val_labs *value_labels = var_get_value_labels (variable); + const union value *vp = NULL; + if (value_labels) + { + vp = val_labs_find_value (value_labels, in); + if (vp) + value_copy (&val, vp, width); + } + char *xx = NULL; + if (vp == NULL) + { + xx = data_in (ss_cstr (in), psppire_dict_encoding (store->dict), + fmt->type, &val, width, "UTF-8"); + } GVariant *vrnt = value_variant_new (&val, width); value_destroy (&val, width);