+static gchar * generate_syntax (PsppireDict *dict, GtkBuilder *xml);
+
+static void
+refresh (PsppireDialog *dialog, gpointer data)
+{
+ GtkBuilder *xml = data;
+ GtkWidget *dest = get_widget_assert (xml, "variables-treeview");
+ GtkWidget *entry = get_widget_assert (xml, "new-name-entry");
+ GtkTreeModel *dmodel = gtk_tree_view_get_model (GTK_TREE_VIEW (dest));
+
+ gtk_list_store_clear (GTK_LIST_STORE (dmodel));
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
+}
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ GtkBuilder *xml = data;
+
+ GtkWidget *tv = get_widget_assert (xml, "variables-treeview");
+ GtkWidget *entry = get_widget_assert (xml, "new-name-entry");
+
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tv));
+
+ gint n_rows = gtk_tree_model_iter_n_children (model, NULL);
+
+ if ( n_rows == 0 )
+ return FALSE;
+
+ if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (entry))))
+ return FALSE;
+
+ return TRUE;
+}
+