}
-void
+gboolean
psppire_dict_set_name (PsppireDict* d, gint idx, const gchar *name)
{
struct variable *var;
g_assert (d);
g_assert (PSPPIRE_IS_DICT (d));
+ if ( ! var_is_valid_name (name, false))
+ return FALSE;
if ( idx < dict_get_var_cnt (d->dict))
{
/* new variable */
dict_create_var (d->dict, name, 0);
}
+
+ return TRUE;
}
}
-void
+gboolean
psppire_dict_rename_var (PsppireDict *dict, struct variable *v,
- const gchar *text)
+ const gchar *name)
{
- dict_rename_var (dict->dict, v, text);
+ if ( ! var_is_valid_name (name, false))
+ return FALSE;
+
+ dict_rename_var (dict->dict, v, name);
+
+ return TRUE;
}
/* -- PsppireDict --- */
GType psppire_dict_get_type (void);
-PsppireDict* psppire_dict_new_from_dict (struct dictionary *d);
-void psppire_dict_set_name (PsppireDict* s, gint idx, const gchar *name);
+PsppireDict* psppire_dict_new_from_dict (struct dictionary *d);
+gboolean psppire_dict_set_name (PsppireDict* s, gint idx, const gchar *name);
void psppire_dict_delete_var (PsppireDict *s, gint idx);
/* Return the number of variables in the dictionary */
gint psppire_dict_get_next_value_idx (const PsppireDict *dict);
-void psppire_dict_rename_var (PsppireDict *dict, struct variable *v,
+gboolean psppire_dict_rename_var (PsppireDict *dict, struct variable *v,
const gchar *text);
void psppire_dict_replace_dictionary (PsppireDict *, struct dictionary *);
switch (col)
{
case COL_NAME:
- psppire_dict_rename_var (var_store->dict, pv, text);
- return TRUE;
+ return psppire_dict_rename_var (var_store->dict, pv, text);
break;
case COL_COLUMNS:
if ( ! text) return FALSE;