+ var = psppire_dict_get_variable (dict, idx + 1);
+
+ g_assert (var_get_dict_index (var) == idx + 1);
+
+ iter->user_data = var;
+
+ return TRUE;
+}
+
+static GtkTreePath *
+tree_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
+{
+ GtkTreePath *path;
+ struct variable *var;
+ PsppireDict *dict = PSPPIRE_DICT (model);
+
+ g_return_val_if_fail (iter->stamp == dict->stamp, FALSE);
+
+ var = iter->user_data;
+
+ path = gtk_tree_path_new ();
+ gtk_tree_path_append_index (path, var_get_dict_index (var));
+
+ return path;
+}
+
+
+static void
+tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter,
+ gint column, GValue *value)
+{
+ struct variable *var;
+ PsppireDict *dict = PSPPIRE_DICT (model);
+
+ g_return_if_fail (iter->stamp == dict->stamp);
+
+ var = iter->user_data;
+
+ switch (column)
+ {
+ case DICT_TVM_COL_NAME:
+ {
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, var_get_name (var));
+ }
+ break;
+ case DICT_TVM_COL_VAR:
+ g_value_init (value, G_TYPE_POINTER);
+ g_value_set_pointer (value, var);
+ break;
+ default:
+ g_return_if_reached ();
+ break;
+ }
+}
+
+static gboolean
+tree_model_iter_children (GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ GtkTreeIter *parent)
+{
+ return FALSE;
+}
+
+static gint
+tree_model_n_children (GtkTreeModel *model,
+ GtkTreeIter *iter)
+{
+ PsppireDict *dict = PSPPIRE_DICT (model);
+
+ if ( iter == NULL )
+ return psppire_dict_get_var_cnt (dict);
+
+ return 0;
+}
+
+static gboolean
+tree_model_nth_child (GtkTreeModel *model, GtkTreeIter *iter,
+ GtkTreeIter *parent, gint n)
+{
+ PsppireDict *dict;
+
+ g_return_val_if_fail (PSPPIRE_IS_DICT (model), FALSE);
+
+ dict = PSPPIRE_DICT (model);
+
+ if ( parent )
+ return FALSE;
+
+ if ( n >= psppire_dict_get_var_cnt (dict) )
+ return FALSE;
+
+ iter->stamp = dict->stamp;
+ iter->user_data = psppire_dict_get_variable (dict, n);
+
+ if ( !iter->user_data)
+ return FALSE;
+