char *text;
const struct fmt_spec *fp ;
const struct variable *pv ;
+ const struct dictionary *dict;
union value v;
int width;
- GString *s;
g_return_val_if_fail (store->dict, NULL);
g_return_val_if_fail (store->datasheet, NULL);
+ dict = store->dict->dict;
+
if (column >= psppire_dict_get_var_cnt (store->dict))
return NULL;
if (label)
{
value_destroy (&v, width);
- return recode_string (UTF8, psppire_dict_encoding (store->dict),
- label, -1);
+ return g_strdup (label);
}
}
fp = var_get_write_format (pv);
- s = g_string_sized_new (fp->w + 1);
- g_string_set_size (s, fp->w);
-
- memset (s->str, 0, fp->w);
-
- g_assert (fp->w == s->len);
-
- /* Converts binary value V into printable form in the exactly
- FP->W character in buffer S according to format specification
- FP. No null terminator is appended to the buffer. */
- data_out (&v, fp, s->str);
-
- text = recode_string (UTF8, psppire_dict_encoding (store->dict),
- s->str, fp->w);
- g_string_free (s, TRUE);
+ text = data_out (&v, dict_get_encoding (dict), fp);
g_strchomp (text);
static gchar *
get_row_button_label (const PsppireSheetModel *model, gint unit)
{
- PsppireDataStore *ds = PSPPIRE_DATA_STORE (model);
- gchar *s = g_strdup_printf (_("%d"), unit + FIRST_CASE_NUMBER);
-
- gchar *text = recode_string (UTF8, psppire_dict_encoding (ds->dict),
- s, -1);
+ // PsppireDataStore *ds = PSPPIRE_DATA_STORE (model);
- g_free (s);
-
- return text;
+ return g_strdup_printf (_("%d"), unit + FIRST_CASE_NUMBER);
}
static gchar *
get_column_subtitle (const PsppireSheetModel *model, gint col)
{
- gchar *text;
const struct variable *v ;
PsppireDataStore *ds = PSPPIRE_DATA_STORE (model);
if ( ! var_has_label (v))
return NULL;
- text = recode_string (UTF8, psppire_dict_encoding (ds->dict),
- var_get_label (v), -1);
-
- return text;
+ return xstrdup (var_get_label (v));
}
static gchar *
get_column_button_label (const PsppireSheetModel *model, gint col)
{
- gchar *text;
struct variable *pv ;
PsppireDataStore *ds = PSPPIRE_DATA_STORE (model);
pv = psppire_dict_get_variable (ds->dict, col);
- text = recode_string (UTF8, psppire_dict_encoding (ds->dict),
- var_get_name (pv), -1);
+ if (NULL == pv)
+ return NULL;
- return text;
+ return xstrdup (var_get_name (pv));
}
static gboolean