X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-var-store.c;h=8c400890a86667642b5681a71b8d02cdd3b8208e;hb=5c3291dc396b795696e94f47780308fd7ace6fc4;hp=b64bc64ee79c805d3e21cf58a4de56b4077be995;hpb=dd5535725f86158e55b3fc263c17058005b0c0a5;p=pspp-builds.git diff --git a/src/ui/gui/psppire-var-store.c b/src/ui/gui/psppire-var-store.c index b64bc64e..8c400890 100644 --- a/src/ui/gui/psppire-var-store.c +++ b/src/ui/gui/psppire-var-store.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 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 @@ -467,14 +467,15 @@ psppire_var_store_set_string (PsppireSheetModel *model, { case PSPPIRE_VAR_STORE_COL_NAME: { - int i; - /* Until non-ascii in variable names is better managed, - simply refuse to allow them to be entered. */ - for (i = 0 ; i < strlen (text) ; ++i ) - if (!g_ascii_isprint (text[i])) - return FALSE; - return psppire_dict_rename_var (var_store->dict, pv, text); - break; + gboolean ok; + char *s = recode_string (psppire_dict_encoding (var_store->dict), + UTF8, + text, -1); + + ok = psppire_dict_rename_var (var_store->dict, pv, s); + + free (s); + return ok; } case PSPPIRE_VAR_STORE_COL_COLUMNS: if ( ! text) return FALSE; @@ -687,20 +688,20 @@ text_for_column (PsppireVarStore *vs, gchar *ss; GString *gstr = g_string_sized_new (10); const struct val_labs *vls = var_get_value_labels (pv); - struct val_labs_iterator *ip = 0; - struct val_lab *vl = val_labs_first_sorted (vls, &ip); + const struct val_lab **labels = val_labs_sorted (vls); + const struct val_lab *vl = labels[0]; + free (labels); g_assert (vl); { gchar *const vstr = value_to_text (vl->value, *write_spec); - g_string_printf (gstr, "{%s,\"%s\"}_", vstr, vl->label); + g_string_printf (gstr, "{%s,\"%s\"}_", + vstr, val_lab_get_label (vl)); g_free (vstr); } - val_labs_done (&ip); - ss = recode_string (UTF8, psppire_dict_encoding (dict), gstr->str, gstr->len); g_string_free (gstr, TRUE);